mirror of
https://github.com/aclist/dztui.git
synced 2026-11-07 10:30:40 +01:00
chore: clear typehinting errors
This commit is contained in:
1 parent
e64feac425
commit
25640751a5
23 files changed
+86
-105
No files matched your search
+1
-20
@@ -1,4 +1,3 @@
|
||||
import dayzquery
|
||||
import hashlib
|
||||
import logging
|
||||
import shlex
|
||||
@@ -9,7 +8,7 @@ from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
import dzgui.api.pefile as PeFile
|
||||
from dzgui.api.servers import Record, get_rules, fqip_to_record
|
||||
from dzgui.api.servers import get_rules, fqip_to_record
|
||||
from dzgui.const.constants import (
|
||||
APP_NAME,
|
||||
APPID_DAYZ,
|
||||
@@ -17,7 +16,6 @@ from dzgui.const.constants import (
|
||||
WORKSHOP_PATH,
|
||||
)
|
||||
|
||||
from dzgui.util.strings import checkmark
|
||||
from dzgui.config.query import lookup
|
||||
from dzgui.const.enum import Preferences
|
||||
|
||||
@@ -110,23 +108,6 @@ def get_missing_mods(local: list, remote: list) -> list:
|
||||
return [mod for mod in remote if mod not in local]
|
||||
|
||||
|
||||
# TODO: drop
|
||||
# def get_server_modlist(server: Record, steam: Path) -> list:
|
||||
# try:
|
||||
# rules = dayzquery.dayz_rules((server.ip, server.qport))
|
||||
# except Exception as e:
|
||||
# raise e
|
||||
# remote_mods = [[mod.name, mod.workshop_id] for mod in rules.mods]
|
||||
# remote_mods.sort(key=lambda row: row[0])
|
||||
# local_mods = get_local_mod_ids(steam)
|
||||
# for mod in remote_mods:
|
||||
# if mod[1] in local_mods:
|
||||
# mod.append(checkmark)
|
||||
# else:
|
||||
# mod.append("")
|
||||
# return remote_mods
|
||||
|
||||
|
||||
def _hash(uid: str) -> str:
|
||||
md5 = hashlib.md5()
|
||||
md5.update(uid.encode("ascii"))
|
||||
|
||||
@@ -443,12 +443,12 @@ def get_rules(record: Record) -> list["DayzMod"]:
|
||||
return [mod for mod in mods]
|
||||
|
||||
|
||||
def query_by_id(addr: str, key: str, full: bool = False) -> dict[Any] | None:
|
||||
def query_by_id(server_id: int, key: str, full: bool = False) -> dict[Any] | None:
|
||||
"""
|
||||
Used with numeric Battlemetrics IDs
|
||||
"""
|
||||
try:
|
||||
resolved = map_id_to_record(key, addr)
|
||||
resolved = map_id_to_record(key, server_id)
|
||||
return query_direct(resolved.ip, resolved.qport, full)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
@@ -470,11 +470,11 @@ def query_playercount(record: Record) -> tuple[int, int] | None:
|
||||
return None
|
||||
|
||||
|
||||
def query_by_ip(addr: str, full: bool = False) -> dict[Any] | None:
|
||||
def query_by_ip(addr: str, full: bool = False) -> dict[str, Any] | PreReqs | None:
|
||||
record = short_ip_to_record(addr)
|
||||
return query_by_record(record, full)
|
||||
|
||||
def query_by_record(record: Record, full: bool = False) -> dict[Any] | None:
|
||||
def query_by_record(record: Record, full: bool = False) -> dict[str, Any] | PreReqs | None:
|
||||
if full:
|
||||
try:
|
||||
info = a2s.info((record.ip, record.qport), 3.0)
|
||||
@@ -511,11 +511,6 @@ def response_to_fqip(res: dict) -> str:
|
||||
return f"{ip}:{gameport}:{qport}"
|
||||
|
||||
|
||||
def source_info_to_record(res: a2s.SourceInfo) -> Record:
|
||||
print(res)
|
||||
return
|
||||
return Record(ip, int(gameport), int(qport))
|
||||
|
||||
def response_to_record(res: dict) -> Record:
|
||||
ip = res["addr"].split(":")[0]
|
||||
gameport = res["gameport"]
|
||||
|
||||
+2
-2
@@ -83,7 +83,7 @@ def find_user_id(path: Path) -> str | None:
|
||||
j = json.loads(vdf)
|
||||
for user in j["users"]:
|
||||
if j["users"][user]["MostRecent"] == "1":
|
||||
return user
|
||||
return str(user)
|
||||
return None
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
@@ -91,7 +91,7 @@ def find_user_id(path: Path) -> str | None:
|
||||
|
||||
|
||||
def vdf2json(path: Path) -> str:
|
||||
def _istr(indent, string):
|
||||
def _istr(indent: int, string: str):
|
||||
return (indent * " ") + string
|
||||
|
||||
jbuf = "{\n"
|
||||
|
||||
Reference in new issue
Block a user