Bump the mypy group with 2 updates (#7291)
--- updated-dependencies: - dependency-name: mypy dependency-type: direct:production dependency-group: mypy - dependency-name: types-requests dependency-type: direct:production dependency-group: mypy ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
b29b677b19
commit
e1f6e2c812
|
@ -79,7 +79,7 @@ class SerializableDataclass(Serializable):
|
||||||
return tuple(fields)
|
return tuple(fields)
|
||||||
|
|
||||||
def get_state(self) -> State:
|
def get_state(self) -> State:
|
||||||
state = {}
|
state: dict[str, State] = {}
|
||||||
for field in self.__fields():
|
for field in self.__fields():
|
||||||
val = getattr(self, field.name)
|
val = getattr(self, field.name)
|
||||||
state[field.name] = _to_state(val, field.type, field.name)
|
state[field.name] = _to_state(val, field.type, field.name)
|
||||||
|
@ -105,7 +105,7 @@ class SerializableDataclass(Serializable):
|
||||||
continue
|
continue
|
||||||
except dataclasses.FrozenInstanceError:
|
except dataclasses.FrozenInstanceError:
|
||||||
pass
|
pass
|
||||||
val = _to_val(f_state, field.type, field.name)
|
val: typing.Any = _to_val(f_state, field.type, field.name)
|
||||||
try:
|
try:
|
||||||
setattr(self, field.name, val)
|
setattr(self, field.name, val)
|
||||||
except dataclasses.FrozenInstanceError:
|
except dataclasses.FrozenInstanceError:
|
||||||
|
@ -118,10 +118,9 @@ class SerializableDataclass(Serializable):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
V = TypeVar("V")
|
def _process(
|
||||||
|
attr_val: typing.Any, attr_type: typing.Any, attr_name: str, make: bool
|
||||||
|
) -> typing.Any:
|
||||||
def _process(attr_val: typing.Any, attr_type: type[V], attr_name: str, make: bool) -> V:
|
|
||||||
origin = typing.get_origin(attr_type)
|
origin = typing.get_origin(attr_type)
|
||||||
if origin is typing.Literal:
|
if origin is typing.Literal:
|
||||||
if attr_val not in typing.get_args(attr_type):
|
if attr_val not in typing.get_args(attr_type):
|
||||||
|
@ -190,11 +189,11 @@ def _process(attr_val: typing.Any, attr_type: type[V], attr_name: str, make: boo
|
||||||
raise TypeError(f"Unexpected type for {attr_name}: {attr_type!r}")
|
raise TypeError(f"Unexpected type for {attr_name}: {attr_type!r}")
|
||||||
|
|
||||||
|
|
||||||
def _to_val(state: typing.Any, attr_type: type[U], attr_name: str) -> U:
|
def _to_val(state: typing.Any, attr_type: typing.Any, attr_name: str) -> typing.Any:
|
||||||
"""Create an object based on the state given in val."""
|
"""Create an object based on the state given in val."""
|
||||||
return _process(state, attr_type, attr_name, True)
|
return _process(state, attr_type, attr_name, True)
|
||||||
|
|
||||||
|
|
||||||
def _to_state(value: typing.Any, attr_type: type[U], attr_name: str) -> U:
|
def _to_state(value: typing.Any, attr_type: typing.Any, attr_name: str) -> typing.Any:
|
||||||
"""Get the state of the object given as val."""
|
"""Get the state of the object given as val."""
|
||||||
return _process(value, attr_type, attr_name, False)
|
return _process(value, attr_type, attr_name, False)
|
||||||
|
|
|
@ -12,10 +12,10 @@ import socketserver
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
|
from io import BufferedIOBase
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from typing import cast
|
from typing import cast
|
||||||
from typing import ClassVar
|
from typing import ClassVar
|
||||||
from typing import IO
|
|
||||||
|
|
||||||
import pydivert.consts
|
import pydivert.consts
|
||||||
|
|
||||||
|
@ -33,14 +33,14 @@ logger = logging.getLogger(__name__)
|
||||||
# Resolver
|
# Resolver
|
||||||
|
|
||||||
|
|
||||||
def read(rfile: IO[bytes]) -> Any:
|
def read(rfile: BufferedIOBase) -> Any:
|
||||||
x = rfile.readline().strip()
|
x = rfile.readline().strip()
|
||||||
if not x:
|
if not x:
|
||||||
return None
|
return None
|
||||||
return json.loads(x)
|
return json.loads(x)
|
||||||
|
|
||||||
|
|
||||||
def write(data, wfile: IO[bytes]) -> None:
|
def write(data, wfile: BufferedIOBase) -> None:
|
||||||
wfile.write(json.dumps(data).encode() + b"\n")
|
wfile.write(json.dumps(data).encode() + b"\n")
|
||||||
wfile.flush()
|
wfile.flush()
|
||||||
|
|
||||||
|
@ -465,7 +465,8 @@ class TransparentProxy:
|
||||||
# TODO: Make sure that server can be killed cleanly. That's a bit difficult as we don't have access to
|
# TODO: Make sure that server can be killed cleanly. That's a bit difficult as we don't have access to
|
||||||
# controller.should_exit when this is called.
|
# controller.should_exit when this is called.
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Transparent mode on Windows is unsupported and flaky. Consider using local redirect mode or WireGuard mode instead."
|
"Transparent mode on Windows is unsupported, flaky, and deprecated. "
|
||||||
|
"Consider using local redirect mode or WireGuard mode instead."
|
||||||
)
|
)
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
server_unavailable = s.connect_ex((REDIRECT_API_HOST, REDIRECT_API_PORT))
|
server_unavailable = s.connect_ex((REDIRECT_API_HOST, REDIRECT_API_PORT))
|
||||||
|
|
|
@ -20,6 +20,7 @@ from ._events import QuicStreamDataReceived
|
||||||
from ._events import QuicStreamEvent
|
from ._events import QuicStreamEvent
|
||||||
from ._events import QuicStreamReset
|
from ._events import QuicStreamReset
|
||||||
from mitmproxy import connection
|
from mitmproxy import connection
|
||||||
|
from mitmproxy.connection import Connection
|
||||||
from mitmproxy.proxy import commands
|
from mitmproxy.proxy import commands
|
||||||
from mitmproxy.proxy import context
|
from mitmproxy.proxy import context
|
||||||
from mitmproxy.proxy import events
|
from mitmproxy.proxy import events
|
||||||
|
@ -259,7 +260,9 @@ class RawQuicLayer(layer.Layer):
|
||||||
yield from self.event_to_child(stream_layer, events.Start())
|
yield from self.event_to_child(stream_layer, events.Start())
|
||||||
|
|
||||||
# forward data and close events
|
# forward data and close events
|
||||||
conn = stream_layer.client if from_client else stream_layer.server
|
conn: Connection = (
|
||||||
|
stream_layer.client if from_client else stream_layer.server
|
||||||
|
)
|
||||||
if isinstance(event, QuicStreamDataReceived):
|
if isinstance(event, QuicStreamDataReceived):
|
||||||
if event.data:
|
if event.data:
|
||||||
yield from self.event_to_child(
|
yield from self.event_to_child(
|
||||||
|
|
|
@ -77,12 +77,12 @@ dev = [
|
||||||
"tox>=4.15.1,<=4.23.2",
|
"tox>=4.15.1,<=4.23.2",
|
||||||
"wheel>=0.36.2,<=0.44.0",
|
"wheel>=0.36.2,<=0.44.0",
|
||||||
"build>=0.10.0,<=1.2.2.post1",
|
"build>=0.10.0,<=1.2.2.post1",
|
||||||
"mypy>=1.10.1,<=1.11.2",
|
"mypy>=1.10.1,<=1.13.0",
|
||||||
"ruff>=0.5.0,<=0.7.2",
|
"ruff>=0.5.0,<=0.7.2",
|
||||||
"types-certifi>=2021.10.8.3,<=2021.10.8.3",
|
"types-certifi>=2021.10.8.3,<=2021.10.8.3",
|
||||||
"types-Flask>=1.1.6,<=1.1.6",
|
"types-Flask>=1.1.6,<=1.1.6",
|
||||||
"types-Werkzeug>=1.0.9,<=1.0.9",
|
"types-Werkzeug>=1.0.9,<=1.0.9",
|
||||||
"types-requests>=2.32.0.20240622,<=2.32.0.20240914",
|
"types-requests>=2.32.0.20240622,<=2.32.0.20241016",
|
||||||
"types-cryptography>=3.3.23.2,<=3.3.23.2",
|
"types-cryptography>=3.3.23.2,<=3.3.23.2",
|
||||||
"types-pyOpenSSL>=23.3.0.0,<=24.1.0.20240722",
|
"types-pyOpenSSL>=23.3.0.0,<=24.1.0.20240722",
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue