mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-17 04:34:37 +03:00
appease mypy Version no-untyped-call (#864)
* appease mypy Version no-untyped-call Without the type hint we get: error: Call to untyped function "Version" in typed context [no-untyped-call] Note that our Version is derived from semantic_version, which doesn't have type hints. * mark class definition __init__ functions -> None. This prevents reviewdog from generating an no-untyped-call warning when a new instance of the class is created. This behavior is a time bomb. reviewdog flags the warning at the line the new instance was added, which is within the scope of the diffs, but the problem lies elsewhere, in the class definition. * fix mypy import-untyped error.
This commit is contained in:
@@ -173,7 +173,7 @@ class PackageUpdate:
|
||||
class Updates:
|
||||
package_updates: List[PackageUpdate]
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
self.package_updates = []
|
||||
|
||||
def extend(self, other):
|
||||
|
||||
@@ -24,7 +24,7 @@ DOCS_CONFIG = "https://aqtinstall.readthedocs.io/en/stable/configuration.html#co
|
||||
|
||||
|
||||
class AqtException(Exception):
|
||||
def __init__(self, *args, suggested_action: Optional[List[str]] = None, should_show_help: bool = False, **kwargs):
|
||||
def __init__(self, *args, suggested_action: Optional[List[str]] = None, should_show_help: bool = False, **kwargs) -> None:
|
||||
self.suggested_action: List[str] = suggested_action or []
|
||||
self.should_show_help: bool = should_show_help or False
|
||||
super(AqtException, self).__init__(*args, **kwargs)
|
||||
@@ -53,7 +53,7 @@ class ArchiveChecksumError(ArchiveDownloadError):
|
||||
|
||||
|
||||
class ChecksumDownloadFailure(ArchiveDownloadError):
|
||||
def __init__(self, *args, suggested_action: Optional[List[str]] = None, **kwargs):
|
||||
def __init__(self, *args, suggested_action: Optional[List[str]] = None, **kwargs) -> None:
|
||||
if suggested_action is None:
|
||||
suggested_action = []
|
||||
suggested_action.extend(
|
||||
|
||||
@@ -257,7 +257,7 @@ def altlink(url: str, alt: str) -> str:
|
||||
|
||||
|
||||
class MyQueueListener(QueueListener):
|
||||
def __init__(self, queue):
|
||||
def __init__(self, queue) -> None:
|
||||
handlers: List[Handler] = []
|
||||
super().__init__(queue, *handlers)
|
||||
|
||||
@@ -347,7 +347,7 @@ class SettingsClass:
|
||||
self.__dict__ = cls._shared_state
|
||||
return self
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
if self.config is None:
|
||||
with self._lock:
|
||||
if self.config is None:
|
||||
|
||||
@@ -149,7 +149,7 @@ class Cli:
|
||||
|
||||
UNHANDLED_EXCEPTION_CODE = 254
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="aqt",
|
||||
description="Another unofficial Qt Installer.\naqt helps you install Qt SDK, tools, examples and others\n",
|
||||
|
||||
@@ -79,7 +79,7 @@ class Version(SemanticVersion):
|
||||
prerelease=None,
|
||||
build=None,
|
||||
partial=False,
|
||||
):
|
||||
) -> None:
|
||||
if version_string is None:
|
||||
super(Version, self).__init__(
|
||||
version_string=None,
|
||||
|
||||
@@ -47,7 +47,7 @@ def unpatched_paths() -> List[str]:
|
||||
|
||||
|
||||
class Updater:
|
||||
def __init__(self, prefix: Path, logger):
|
||||
def __init__(self, prefix: Path, logger) -> None:
|
||||
self.logger = logger
|
||||
self.prefix = prefix
|
||||
self.qmake_path: Optional[Path] = None
|
||||
|
||||
@@ -69,6 +69,7 @@ check = [
|
||||
"pygments",
|
||||
"packaging",
|
||||
"pylint",
|
||||
"types-requests",
|
||||
]
|
||||
docs = [
|
||||
"sphinx>=7.0",
|
||||
|
||||
Reference in New Issue
Block a user