chore: clear typehinting errors

This commit is contained in:
aclist committed 2026-05-12 15:58:09 +09:00
1 parent 2e5860650f
commit e52664cf9b
11 files changed
+35 -29

No files matched your search

+14 -14
View File
@@ -4,7 +4,7 @@ import struct
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import BinaryIO, Union
from typing import BinaryIO, Self, Union
from packaging.version import Version
@@ -69,7 +69,7 @@ class i64:
class PackedData:
@classmethod
def unpack(cls, data: BinaryIO):
def unpack(cls, data: BinaryIO) -> Self:
r = []
for key, value in cls.__annotations__.items():
if value is str:
@@ -449,18 +449,18 @@ def get_app_path(folders_path: Path, appid: int) -> Path:
# TODO: tests
def compare_versions(local: DayZVersion, remote: DayZVersion) -> VersionMatch:
local_str = Version(dayz_version_to_str(local))
remote_str = Version(dayz_version_to_str(remote))
if local_str == remote_str:
return VersionMatch.SAME_VERSION
if local_str < remote_str:
return VersionMatch.LOCAL_OLDER
if local_str > remote_str:
return VersionMatch.LOCAL_NEWER
#def compare_versions(local: DayZVersion, remote: DayZVersion) -> VersionMatch:
# local_str = Version(dayz_version_to_str(local))
# remote_str = Version(dayz_version_to_str(remote))
#
# if local_str == remote_str:
# return VersionMatch.SAME_VERSION
#
# if local_str < remote_str:
# return VersionMatch.LOCAL_OLDER
#
# if local_str > remote_str:
# return VersionMatch.LOCAL_NEWER
def get_pretty_version(steam_path: Path, appid: int) -> str | None:
+1 -1
View File
@@ -464,7 +464,7 @@ def query_by_ip(addr: str) -> A2SInfo:
record = short_ip_to_record(addr)
return query_by_record(record, update_gameport=True)
def query_by_id(server_id: int, key: str) -> dict[Any] | None:
def query_by_id(server_id: int, key: str) -> A2SInfo:
"""
Used with numeric Battlemetrics IDs
"""
+2 -2
View File
@@ -89,7 +89,7 @@ def get_remote_signatures(mods: list[str]) -> list[tuple[str, str, int, int]]:
# TODO:: set config to name=user, use official server and no mods,
# ensure that formatted string is identical to fixture with same hash
def connect(addr: str, appid: int, name: str, mods: list[str]) -> None:
def connect(addr: str, appid: int, name: str, mods: list[str]) -> int:
concat = concat_mods(mods)
params = [
"steam",
@@ -121,7 +121,7 @@ def find_user_id(path: Path) -> str | None:
def vdf2json(path: Path) -> str:
def _istr(indent: int, string: str):
def _istr(indent: int, string: str) -> str:
return (indent * " ") + string
jbuf = "{\n"