]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lint: fixes for new versions of tools
authorAleš Mrázek <ales.mrazek@nic.cz>
Mon, 19 Feb 2024 15:25:56 +0000 (16:25 +0100)
committerOto Šťáva <oto.stava@nic.cz>
Tue, 20 Feb 2024 12:34:14 +0000 (13:34 +0100)
manager/knot_resolver_manager/cli/command.py
manager/knot_resolver_manager/compat/asyncio.py
manager/knot_resolver_manager/compat/dataclasses.py
manager/knot_resolver_manager/datamodel/forward_schema.py
manager/knot_resolver_manager/kresd_controller/__init__.py
manager/knot_resolver_manager/kresd_controller/interface.py
manager/knot_resolver_manager/main.py
manager/knot_resolver_manager/utils/modeling/json_pointer.py

index ba490e47e8cf84642924d569bfaa2d17da324a18..e2f6811fe1a7f8feac8f334963917e1393b508c8 100644 (file)
@@ -40,7 +40,7 @@ def install_commands_parsers(parser: argparse.ArgumentParser) -> None:
 
 def get_socket_from_config(config: Path, optional_file: bool) -> Optional[SocketDesc]:
     try:
-        with open(config, "r") as f:
+        with open(config, "r", encoding="utf8") as f:
             data = parsing.try_to_parse(f.read())
         mkey = "management"
         if mkey in data:
index d98f06c1643f0d51410bd25907c55134aa54fbd7..9e10e6c64646816ba3f07f76ccc80fc5578a4b40 100644 (file)
@@ -91,7 +91,7 @@ def _cancel_all_tasks(loop: AbstractEventLoop) -> None:
     # Backported from:
     # https://github.com/python/cpython/blob/3.9/Lib/asyncio/runners.py#L55-L74
     #
-    to_cancel = tasks.Task.all_tasks(loop)
+    to_cancel = tasks.all_tasks(loop)
     if not to_cancel:
         return
 
@@ -103,7 +103,7 @@ def _cancel_all_tasks(loop: AbstractEventLoop) -> None:
         # since 3.10, the loop argument is removed
         loop.run_until_complete(tasks.gather(*to_cancel, return_exceptions=True))
     else:
-        loop.run_until_complete(tasks.gather(*to_cancel, loop=loop, return_exceptions=True))
+        loop.run_until_complete(tasks.gather(*to_cancel, loop=loop, return_exceptions=True))  # type: ignore[call-overload]
 
     for task in to_cancel:
         if task.cancelled():
index 440b34c8aef00bc8b8e69f0abc12e94e91dcac6f..f420b03dcf1d77609784a3cede6b7189f2c3d4e2 100644 (file)
@@ -2,7 +2,6 @@
 This module contains rather simplistic reimplementation of dataclasses due to them being unsupported on Python 3.6
 """
 
-
 from typing import Any, Dict, Set, Type
 
 dataclasses_import_success = False
index 25168ce5288875febd7888169f7faa8266a92749..8b4254265d775424547a5a09e468f01269a725f3 100644 (file)
@@ -26,7 +26,7 @@ class ForwardServerSchema(ConfigSchema):
 
     def _validate(self) -> None:
         if self.pin_sha256 and (self.hostname or self.ca_file):
-            ValueError("'pin-sha256' cannot be configurad together with 'hostname' or 'ca-file'")
+            raise ValueError("'pin-sha256' cannot be configurad together with 'hostname' or 'ca-file'")
 
 
 class ForwardOptionsSchema(ConfigSchema):
index 6c5053e2c7fa5ab4b47c36a8a16eb0da2a8e54e9..a21bc44cdbda6664208a6e2ed4ebdc68e33b6783 100644 (file)
@@ -5,6 +5,7 @@ from imports, they are located in functions which are invoked at the end of this
 We supported multiple subprocess controllers while developing it. It now all converged onto just supervisord.
 The interface however remains so that different controllers can be added in the future.
 """
+
 # pylint: disable=import-outside-toplevel
 
 import asyncio
index 77197a32047844596b4c27747644552b59c93871..1dc99505fb3344dd6248a2e7c43e64469334ecb1 100644 (file)
@@ -12,9 +12,8 @@ from weakref import WeakValueDictionary
 from knot_resolver_manager.constants import kresd_config_file
 from knot_resolver_manager.datamodel.config_schema import KresConfig
 from knot_resolver_manager.exceptions import SubprocessControllerException
-from knot_resolver_manager.utils.async_utils import writefile
-
 from knot_resolver_manager.kresd_controller.registered_workers import register_worker, unregister_worker
+from knot_resolver_manager.utils.async_utils import writefile
 
 logger = logging.getLogger(__name__)
 
index 5cbc7f28a77e96cb3bc0777335823a6db65f7f48..9428c880ebe1b588483c5f055324defedeaa8ae4 100644 (file)
@@ -10,7 +10,7 @@ from pathlib import Path
 from typing import NoReturn
 
 from knot_resolver_manager import compat
-from knot_resolver_manager.constants import DEFAULT_MANAGER_CONFIG_FILE, CONFIG_FILE_ENV_VAR
+from knot_resolver_manager.constants import CONFIG_FILE_ENV_VAR, DEFAULT_MANAGER_CONFIG_FILE
 from knot_resolver_manager.log import logger_startup
 from knot_resolver_manager.server import start_server
 
index 6d7c9e3970ae44fd216ba5bfc62f2b3151af31df..a60ba5d1e70fdb512e30058964f905cad62872a1 100644 (file)
@@ -3,7 +3,6 @@ Implements JSON pointer resolution based on RFC 6901:
 https://www.rfc-editor.org/rfc/rfc6901
 """
 
-
 from typing import Any, Optional, Tuple, Union
 
 # JSONPtrAddressable = Optional[Union[Dict[str, "JSONPtrAddressable"], List["JSONPtrAddressable"], int, float, bool, str, None]]