diff --git a/mitmproxy/connection.py b/mitmproxy/connection.py index f18880c92..b7f4ad2f5 100644 --- a/mitmproxy/connection.py +++ b/mitmproxy/connection.py @@ -197,7 +197,9 @@ class Client(Connection): tls_state = ", tls" else: tls_state = "" - return f"Client({human.format_address(self.peername)}, state={self.state.name.lower()}{tls_state})" + state = self.state.name + assert state + return f"Client({human.format_address(self.peername)}, state={state.lower()}{tls_state})" @property def address(self): # pragma: no cover @@ -296,7 +298,9 @@ class Server(Connection): local_port = f", src_port={self.sockname[1]}" else: local_port = "" - return f"Server({human.format_address(self.address)}, state={self.state.name.lower()}{tls_state}{local_port})" + state = self.state.name + assert state + return f"Server({human.format_address(self.address)}, state={state.lower()}{tls_state}{local_port})" def __setattr__(self, name, value): if name in ("address", "via"): diff --git a/tox.ini b/tox.ini index b41164d32..5f3c0df80 100644 --- a/tox.ini +++ b/tox.ini @@ -29,13 +29,13 @@ commands = [testenv:mypy] deps = - mypy==0.991 + mypy==1.0.0 types-certifi==2021.10.8.3 types-Flask==1.1.6 types-Werkzeug==1.0.9 - types-requests==2.28.11.5 + types-requests==2.28.11.11 types-cryptography==3.3.23.2 - types-pyOpenSSL==22.1.0.2 + types-pyOpenSSL==23.0.0.2 -e .[dev] commands =