mirror of https://gitlab.com/litecord/litecord.git
run.py: fix typing in api_index()
This commit is contained in:
parent
fd1099607b
commit
c9c92890b4
13
run.py
13
run.py
|
|
@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
import asyncio
|
import asyncio
|
||||||
import sys
|
import sys
|
||||||
from multiprocessing.managers import BaseManager
|
from multiprocessing.managers import BaseManager
|
||||||
|
from typing import Dict, Tuple, List
|
||||||
|
|
||||||
import asyncpg
|
import asyncpg
|
||||||
import logbook
|
import logbook
|
||||||
|
|
@ -290,8 +291,8 @@ def init_app_managers(app_: Quart, *, init_voice=True):
|
||||||
|
|
||||||
|
|
||||||
async def api_index(app_):
|
async def api_index(app_):
|
||||||
to_find = {}
|
to_find: Dict[Tuple[str, str], str] = {}
|
||||||
found = []
|
found: List[str] = []
|
||||||
|
|
||||||
with open("discord_endpoints.txt") as fd:
|
with open("discord_endpoints.txt") as fd:
|
||||||
for line in fd.readlines():
|
for line in fd.readlines():
|
||||||
|
|
@ -325,17 +326,17 @@ async def api_index(app_):
|
||||||
if pathname:
|
if pathname:
|
||||||
found.append(pathname)
|
found.append(pathname)
|
||||||
|
|
||||||
found = set(found)
|
found_set = set(found)
|
||||||
api = set(to_find.values())
|
api = set(to_find.values())
|
||||||
|
|
||||||
missing = api - found
|
missing = api - found_set
|
||||||
|
|
||||||
percentage = (len(found) / len(api)) * 100
|
percentage = (len(found_set) / len(api)) * 100
|
||||||
percentage = round(percentage, 2)
|
percentage = round(percentage, 2)
|
||||||
|
|
||||||
log.debug(
|
log.debug(
|
||||||
"API compliance: {} out of {} ({} missing), {}% compliant",
|
"API compliance: {} out of {} ({} missing), {}% compliant",
|
||||||
len(found),
|
len(found_set),
|
||||||
len(api),
|
len(api),
|
||||||
len(missing),
|
len(missing),
|
||||||
percentage,
|
percentage,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue