From a7dc356dd9d91ee719d99bc9842a22dafd66fd88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Wed, 15 Nov 2023 12:55:36 +0100 Subject: [PATCH] mypy: enable warn_redundant_casts, warn_unused_ignores, warn_unreachable --- pyproject.toml | 6 +++--- src/capport/comm/message.pyi | 2 +- src/capport/utils/nft_socket.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index abd45c5..e738dbc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,11 +9,11 @@ build-backend = "setuptools.build_meta" python_version = "3.11" # disallow_any_generics = true # disallow_untyped_defs = true -# warn_redundant_casts = true +warn_redundant_casts = true warn_return_any = true warn_unused_configs = true -# warn_unused_ignores = true -# warn_unreachable = true +warn_unused_ignores = true +warn_unreachable = true exclude = [ '_pb2\.py$', # TOML literal string (single-quotes, no escaping necessary) ] diff --git a/src/capport/comm/message.pyi b/src/capport/comm/message.pyi index 5e4ff18..41c6b8c 100644 --- a/src/capport/comm/message.pyi +++ b/src/capport/comm/message.pyi @@ -18,7 +18,7 @@ class Message(google.protobuf.message.Message): ping: Ping | None = None, mac_states: MacStates | None = None, ) -> None: ... - def to_variant(self) -> Hello | AuthenticationResult | Ping | MacStates: ... + def to_variant(self) -> Hello | AuthenticationResult | Ping | MacStates | None: ... class Hello(google.protobuf.message.Message): instance_id: bytes diff --git a/src/capport/utils/nft_socket.py b/src/capport/utils/nft_socket.py index 41e1b66..8dec352 100644 --- a/src/capport/utils/nft_socket.py +++ b/src/capport/utils/nft_socket.py @@ -6,8 +6,8 @@ import typing import pyroute2.netlink # type: ignore import pyroute2.netlink.nlsocket # type: ignore from pyroute2.netlink.nfnetlink import NFNL_SUBSYS_NFTABLES # type: ignore -from pyroute2.netlink.nfnetlink import nfgen_msg # type: ignore -from pyroute2.netlink.nfnetlink import nftsocket as _nftsocket # type: ignore +from pyroute2.netlink.nfnetlink import nfgen_msg +from pyroute2.netlink.nfnetlink import nftsocket as _nftsocket NFPROTO_INET: int = 1 # nfgen_family "ipv4+ipv6"; strace decodes this as "AF_UNSPEC"