chore: update comments to the latest mypy release

This commit is contained in:
Evgenii Alekseev 2023-10-12 20:31:00 +03:00
parent a0b17981e3
commit bf9a46936c
33 changed files with 34 additions and 35 deletions

View File

@ -160,7 +160,7 @@ class Setup(Handler):
configuration = Configuration(allow_no_value=True) configuration = Configuration(allow_no_value=True)
# preserve case # preserve case
# stupid mypy thinks that it is impossible # stupid mypy thinks that it is impossible
configuration.optionxform = lambda key: key # type: ignore[method-assign] configuration.optionxform = lambda optionstr: optionstr # type: ignore[method-assign]
# load default configuration first # load default configuration first
# we cannot use Include here because it will be copied to new chroot, thus no includes there # we cannot use Include here because it will be copied to new chroot, thus no includes there

View File

@ -22,7 +22,7 @@ import shutil
from collections.abc import Callable, Generator from collections.abc import Callable, Generator
from functools import cached_property from functools import cached_property
from pathlib import Path from pathlib import Path
from pyalpm import DB, Handle, Package, SIG_PACKAGE, error as PyalpmError # type: ignore[import] from pyalpm import DB, Handle, Package, SIG_PACKAGE, error as PyalpmError # type: ignore[import-not-found]
from string import Template from string import Template
from ahriman.core.configuration import Configuration from ahriman.core.configuration import Configuration

View File

@ -20,7 +20,7 @@
from typing import Any from typing import Any
try: try:
import aiohttp_security # type: ignore[import] import aiohttp_security # type: ignore[import-untyped]
_has_aiohttp_security = True _has_aiohttp_security = True
except ImportError: except ImportError:
_has_aiohttp_security = False _has_aiohttp_security = False

View File

@ -19,7 +19,7 @@
# #
import ipaddress import ipaddress
from cerberus import TypeDefinition, Validator as RootValidator # type: ignore[import] from cerberus import TypeDefinition, Validator as RootValidator # type: ignore[import-untyped]
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
from urllib.parse import urlparse from urllib.parse import urlparse

View File

@ -42,6 +42,6 @@ class _JournalHandler(NullHandler):
try: try:
from systemd.journal import JournalHandler # type: ignore[import] from systemd.journal import JournalHandler # type: ignore[import-untyped]
except ImportError: except ImportError:
JournalHandler = _JournalHandler JournalHandler = _JournalHandler

View File

@ -59,7 +59,7 @@ class LogLoader:
return selected return selected
try: try:
from systemd.journal import JournalHandler # type: ignore[import] from systemd.journal import JournalHandler # type: ignore[import-untyped]
del JournalHandler del JournalHandler
return LogHandler.Journald # journald import was found return LogHandler.Journald # journald import was found
except ImportError: except ImportError:

View File

@ -98,7 +98,7 @@ class WebClient(Client, SyncHttpClient):
requests.Session: generated session object requests.Session: generated session object
""" """
if use_unix_socket: if use_unix_socket:
import requests_unixsocket # type: ignore[import] import requests_unixsocket # type: ignore[import-untyped]
session: requests.Session = requests_unixsocket.Session() session: requests.Session = requests_unixsocket.Session()
session.headers["User-Agent"] = f"ahriman/{__version__}" session.headers["User-Agent"] = f"ahriman/{__version__}"
return session return session

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import boto3 # type: ignore[import] import boto3 # type: ignore[import-untyped]
import hashlib import hashlib
import mimetypes import mimetypes

View File

@ -22,7 +22,7 @@ import inflection
from collections.abc import Callable from collections.abc import Callable
from dataclasses import dataclass, field, fields from dataclasses import dataclass, field, fields
from pyalpm import Package # type: ignore[import] from pyalpm import Package # type: ignore[import-not-found]
from typing import Any, Self from typing import Any, Self
from ahriman.core.util import filter_json, full_version from ahriman.core.util import filter_json, full_version

View File

@ -25,8 +25,8 @@ import copy
from collections.abc import Callable, Generator, Iterable from collections.abc import Callable, Generator, Iterable
from dataclasses import dataclass from dataclasses import dataclass
from pathlib import Path from pathlib import Path
from pyalpm import vercmp # type: ignore[import] from pyalpm import vercmp # type: ignore[import-not-found]
from srcinfo.parse import parse_srcinfo # type: ignore[import] from srcinfo.parse import parse_srcinfo # type: ignore[import-untyped]
from typing import Any, Self from typing import Any, Self
from urllib.parse import urlparse from urllib.parse import urlparse

View File

@ -19,7 +19,7 @@
# #
from dataclasses import dataclass, field, fields from dataclasses import dataclass, field, fields
from pathlib import Path from pathlib import Path
from pyalpm import Package # type: ignore[import] from pyalpm import Package # type: ignore[import-not-found]
from typing import Any, Self from typing import Any, Self
from ahriman.core.util import dataclass_view, filter_json, trim_package from ahriman.core.util import dataclass_view, filter_json, trim_package

View File

@ -144,10 +144,9 @@ class RepositoryPaths(LazyLogging):
""" """
return self.owner(self.root) return self.owner(self.root)
# TODO see https://github.com/python/mypy/issues/12534, remove type: ignore after release
# pylint: disable=protected-access # pylint: disable=protected-access
@classmethod @classmethod
def known_architectures(cls, root: Path, name: str = "") -> set[str]: # type: ignore[return] def known_architectures(cls, root: Path, name: str = "") -> set[str]:
""" """
get known architecture names get known architecture names

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import Application from aiohttp.web import Application
from typing import Any from typing import Any

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_cors # type: ignore[import] import aiohttp_cors # type: ignore[import-untyped]
from aiohttp.web import Application from aiohttp.web import Application

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_security # type: ignore[import] import aiohttp_security # type: ignore[import-untyped]
import socket import socket
import types import types

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from aiohttp_cors import CorsViewMixin # type: ignore[import] from aiohttp_cors import CorsViewMixin # type: ignore[import-untyped]
from aiohttp.web import HTTPBadRequest, Request, StreamResponse, View from aiohttp.web import HTTPBadRequest, Request, StreamResponse, View
from collections.abc import Awaitable, Callable from collections.abc import Awaitable, Callable
from typing import Any, TypeVar from typing import Any, TypeVar

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPBadRequest, Response, json_response from aiohttp.web import HTTPBadRequest, Response, json_response

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPBadRequest, HTTPNotFound, Response, json_response from aiohttp.web import HTTPBadRequest, HTTPNotFound, Response, json_response

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPNotFound, Response, json_response from aiohttp.web import HTTPNotFound, Response, json_response

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPBadRequest, Response, json_response from aiohttp.web import HTTPBadRequest, Response, json_response

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPBadRequest, Response, json_response from aiohttp.web import HTTPBadRequest, Response, json_response

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPBadRequest, Response, json_response from aiohttp.web import HTTPBadRequest, Response, json_response

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPBadRequest, HTTPNotFound, Response, json_response from aiohttp.web import HTTPBadRequest, HTTPNotFound, Response, json_response
from collections.abc import Callable from collections.abc import Callable

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPBadRequest, Response, json_response from aiohttp.web import HTTPBadRequest, Response, json_response

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
import shutil import shutil
from aiohttp import BodyPartReader from aiohttp import BodyPartReader

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPBadRequest, HTTPNoContent, HTTPNotFound, Response, json_response from aiohttp.web import HTTPBadRequest, HTTPNoContent, HTTPNotFound, Response, json_response

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPBadRequest, HTTPNoContent, HTTPNotFound, Response, json_response from aiohttp.web import HTTPBadRequest, HTTPNoContent, HTTPNotFound, Response, json_response

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
import itertools import itertools
from collections.abc import Callable from collections.abc import Callable

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPBadRequest, HTTPNoContent, Response, json_response from aiohttp.web import HTTPBadRequest, HTTPNoContent, Response, json_response

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPFound, HTTPMethodNotAllowed, HTTPUnauthorized from aiohttp.web import HTTPFound, HTTPMethodNotAllowed, HTTPUnauthorized

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPFound, HTTPUnauthorized from aiohttp.web import HTTPFound, HTTPUnauthorized

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import aiohttp_apispec # type: ignore[import] import aiohttp_apispec # type: ignore[import-untyped]
from aiohttp.web import HTTPNotFound, Response, json_response from aiohttp.web import HTTPNotFound, Response, json_response

View File

@ -167,7 +167,7 @@ def setup_service(repository_id: RepositoryId, configuration: Configuration, spa
# application.logger.info("setup debug panel") # application.logger.info("setup debug panel")
# debug_enabled = configuration.getboolean("web", "debug", fallback=False) # debug_enabled = configuration.getboolean("web", "debug", fallback=False)
# if debug_enabled: # if debug_enabled:
# import aiohttp_debugtoolbar # type: ignore[import] # import aiohttp_debugtoolbar # type: ignore[import-untyped]
# aiohttp_debugtoolbar.setup(application, # aiohttp_debugtoolbar.setup(application,
# hosts=configuration.getlist("web", "debug_allowed_hosts", fallback=[]), # hosts=configuration.getlist("web", "debug_allowed_hosts", fallback=[]),
# check_host=configuration.getboolean("web", "debug_check_host", fallback=False)) # check_host=configuration.getboolean("web", "debug_check_host", fallback=False))