Verified Commit 1854cf97 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Improve mypy config and remove legacy workarounds

parent f1367d08
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -74,6 +74,11 @@ repos:
  rev: v1.11.1
  hooks:
  - id: mypy
    args: [--config-file=setup.cfg]
    additional_dependencies: [anyio, trio-typing]
    exclude: setup\.py|test_.*
    args:
    - --python-version=3.10
    - --follow-imports=silent
    - wpa_supplicant
    pass_filenames: false
    additional_dependencies:
    - anyio ~=4.0
    - trio-typing
+9 −0
Original line number Diff line number Diff line
@@ -7,3 +7,12 @@ force_single_line = true

[tool.unimport]
ignore-init = true


[tool.mypy]
allow_redefinition = true
explicit_package_bases = true
implicit_reexport = true
strict = true
warn_unreachable = true
warn_unused_configs = true
+2 −5
Original line number Diff line number Diff line
#  Copyright 2021  Dom Sekotill <dom.sekotill@kodo.org.uk>
#  Copyright 2021, 2024  Dom Sekotill <dom.sekotill@kodo.org.uk>
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
@@ -30,7 +30,6 @@ from typing import Coroutine
from typing import Dict
from typing import Protocol
from typing import Union
from typing import cast

import sniffio

@@ -135,12 +134,10 @@ else:
			else:
				break

		transport_, protocol_ = await asyncio.get_running_loop().create_datagram_endpoint(
		transport, protocol = await asyncio.get_running_loop().create_datagram_endpoint(
			_asyncio.DatagramProtocol,
			sock=sock,
		)
		transport = cast(asyncio.DatagramTransport, transport_)
		protocol = cast(_asyncio.DatagramProtocol, protocol_)
		if protocol.exception:
			transport.close()
			raise protocol.exception
+2 −2
Original line number Diff line number Diff line
#  Copyright 2019-2021  Dom Sekotill <dom.sekotill@kodo.org.uk>
#  Copyright 2019-2021, 2024  Dom Sekotill <dom.sekotill@kodo.org.uk>
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
@@ -84,4 +84,4 @@ def _kv2dict(keyvalues: str) -> StringMap:
	"""
	Convert a list of line-terminated "key=value" substrings into a dictionary
	"""
	return dict(kv.split("=", 1) for kv in keyvalues.splitlines())  # type: ignore
	return dict(kv.split("=", 1) for kv in keyvalues.splitlines())