diff --git a/poetry.lock b/poetry.lock index 0dd7721..987a6dc 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,10 +1,9 @@ -# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "attrs" version = "24.2.0" description = "Classes Without Boilerplate" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -24,7 +23,6 @@ tests-mypy = ["mypy (>=1.11.1)", "pytest-mypy-plugins"] name = "brokrpc" version = "0.2.0" description = "framework for gRPC like server-client communication over message brokers" -category = "dev" optional = false python-versions = "<4.0,>=3.12" files = [ @@ -44,7 +42,6 @@ protobuf = ["googleapis-common-protos (>=1.65.0,<2.0.0)", "protobuf (>=5.26.1,<6 name = "colorama" version = "0.4.6" description = "Cross-platform colored terminal text." -category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" files = [ @@ -56,7 +53,6 @@ files = [ name = "coverage" version = "7.6.8" description = "Code coverage measurement for Python" -category = "dev" optional = false python-versions = ">=3.9" files = [ @@ -134,7 +130,6 @@ toml = ["tomli"] name = "decorator" version = "5.1.1" description = "Decorators for Humans" -category = "dev" optional = false python-versions = ">=3.5" files = [ @@ -146,7 +141,6 @@ files = [ name = "exceptiongroup" version = "1.2.2" description = "Backport of PEP 654 (exception groups)" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -161,7 +155,6 @@ test = ["pytest (>=6)"] name = "grpc-stubs" version = "1.53.0.5" description = "Mypy stubs for gRPC" -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -176,7 +169,6 @@ grpcio = "*" name = "grpcio" version = "1.68.0" description = "HTTP/2-based RPC framework" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -244,7 +236,6 @@ protobuf = ["grpcio-tools (>=1.68.0)"] name = "idna" version = "3.10" description = "Internationalized Domain Names in Applications (IDNA)" -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -259,7 +250,6 @@ all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2 name = "iniconfig" version = "2.0.0" description = "brain-dead simple config-ini parsing" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -271,7 +261,6 @@ files = [ name = "jinja2" version = "3.1.4" description = "A very fast and expressive template engine." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -289,7 +278,6 @@ i18n = ["Babel (>=2.7)"] name = "jsonschema" version = "4.23.0" description = "An implementation of JSON Schema validation for Python" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -311,7 +299,6 @@ format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339- name = "jsonschema-specifications" version = "2024.10.1" description = "The JSON Schema meta-schemas and vocabularies, exposed as a Registry" -category = "dev" optional = false python-versions = ">=3.9" files = [ @@ -326,7 +313,6 @@ referencing = ">=0.31.0" name = "markupsafe" version = "3.0.2" description = "Safely add untrusted strings to HTML/XML markup." -category = "dev" optional = false python-versions = ">=3.9" files = [ @@ -397,7 +383,6 @@ files = [ name = "multidict" version = "6.1.0" description = "multidict implementation" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -499,7 +484,6 @@ files = [ name = "mypy" version = "1.13.0" description = "Optional static typing for Python" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -553,7 +537,6 @@ reports = ["lxml"] name = "mypy-extensions" version = "1.0.0" description = "Type system extensions for programs checked with the mypy type checker." -category = "dev" optional = false python-versions = ">=3.5" files = [ @@ -565,7 +548,6 @@ files = [ name = "packaging" version = "24.2" description = "Core utilities for Python packages" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -577,7 +559,6 @@ files = [ name = "pluggy" version = "1.5.0" description = "plugin and hook calling mechanisms for python" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -593,7 +574,6 @@ testing = ["pytest", "pytest-benchmark"] name = "propcache" version = "0.2.0" description = "Accelerated property cache" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -701,7 +681,6 @@ files = [ name = "protobuf" version = "5.28.3" description = "" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -722,7 +701,6 @@ files = [ name = "pytest" version = "8.3.3" description = "pytest: simple powerful testing with Python" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -745,7 +723,6 @@ dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments name = "pytest-cov" version = "6.0.0" description = "Pytest plugin for measuring coverage." -category = "dev" optional = false python-versions = ">=3.9" files = [ @@ -764,7 +741,6 @@ testing = ["fields", "hunter", "process-tests", "pytest-xdist", "virtualenv"] name = "pytest-mypy-plugins" version = "3.1.2" description = "pytest plugin for writing tests for mypy plugins" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -787,7 +763,6 @@ tomlkit = ">=0.11" name = "pyyaml" version = "6.0.2" description = "YAML parser and emitter for Python" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -850,7 +825,6 @@ files = [ name = "referencing" version = "0.35.1" description = "JSON Referencing + Python" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -866,7 +840,6 @@ rpds-py = ">=0.7.0" name = "regex" version = "2024.11.6" description = "Alternative regular expression module, to replace re." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -970,7 +943,6 @@ files = [ name = "rpds-py" version = "0.21.0" description = "Python bindings to Rust's persistent data structures (rpds)" -category = "dev" optional = false python-versions = ">=3.9" files = [ @@ -1068,37 +1040,35 @@ files = [ [[package]] name = "ruff" -version = "0.7.4" +version = "0.8.0" description = "An extremely fast Python linter and code formatter, written in Rust." -category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.7.4-py3-none-linux_armv6l.whl", hash = "sha256:a4919925e7684a3f18e18243cd6bea7cfb8e968a6eaa8437971f681b7ec51478"}, - {file = "ruff-0.7.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:cfb365c135b830778dda8c04fb7d4280ed0b984e1aec27f574445231e20d6c63"}, - {file = "ruff-0.7.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:63a569b36bc66fbadec5beaa539dd81e0527cb258b94e29e0531ce41bacc1f20"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d06218747d361d06fd2fdac734e7fa92df36df93035db3dc2ad7aa9852cb109"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e0cea28d0944f74ebc33e9f934238f15c758841f9f5edd180b5315c203293452"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:80094ecd4793c68b2571b128f91754d60f692d64bc0d7272ec9197fdd09bf9ea"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:997512325c6620d1c4c2b15db49ef59543ef9cd0f4aa8065ec2ae5103cedc7e7"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:00b4cf3a6b5fad6d1a66e7574d78956bbd09abfd6c8a997798f01f5da3d46a05"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7dbdc7d8274e1422722933d1edddfdc65b4336abf0b16dfcb9dedd6e6a517d06"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e92dfb5f00eaedb1501b2f906ccabfd67b2355bdf117fea9719fc99ac2145bc"}, - {file = "ruff-0.7.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3bd726099f277d735dc38900b6a8d6cf070f80828877941983a57bca1cd92172"}, - {file = "ruff-0.7.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:2e32829c429dd081ee5ba39aef436603e5b22335c3d3fff013cd585806a6486a"}, - {file = "ruff-0.7.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:662a63b4971807623f6f90c1fb664613f67cc182dc4d991471c23c541fee62dd"}, - {file = "ruff-0.7.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:876f5e09eaae3eb76814c1d3b68879891d6fde4824c015d48e7a7da4cf066a3a"}, - {file = "ruff-0.7.4-py3-none-win32.whl", hash = "sha256:75c53f54904be42dd52a548728a5b572344b50d9b2873d13a3f8c5e3b91f5cac"}, - {file = "ruff-0.7.4-py3-none-win_amd64.whl", hash = "sha256:745775c7b39f914238ed1f1b0bebed0b9155a17cd8bc0b08d3c87e4703b990d6"}, - {file = "ruff-0.7.4-py3-none-win_arm64.whl", hash = "sha256:11bff065102c3ae9d3ea4dc9ecdfe5a5171349cdd0787c1fc64761212fc9cf1f"}, - {file = "ruff-0.7.4.tar.gz", hash = "sha256:cd12e35031f5af6b9b93715d8c4f40360070b2041f81273d0527683d5708fce2"}, + {file = "ruff-0.8.0-py3-none-linux_armv6l.whl", hash = "sha256:fcb1bf2cc6706adae9d79c8d86478677e3bbd4ced796ccad106fd4776d395fea"}, + {file = "ruff-0.8.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:295bb4c02d58ff2ef4378a1870c20af30723013f441c9d1637a008baaf928c8b"}, + {file = "ruff-0.8.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:7b1f1c76b47c18fa92ee78b60d2d20d7e866c55ee603e7d19c1e991fad933a9a"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eb0d4f250a7711b67ad513fde67e8870109e5ce590a801c3722580fe98c33a99"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:0e55cce9aa93c5d0d4e3937e47b169035c7e91c8655b0974e61bb79cf398d49c"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3f4cd64916d8e732ce6b87f3f5296a8942d285bbbc161acee7fe561134af64f9"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c5c1466be2a2ebdf7c5450dd5d980cc87c8ba6976fb82582fea18823da6fa362"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2dabfd05b96b7b8f2da00d53c514eea842bff83e41e1cceb08ae1966254a51df"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:facebdfe5a5af6b1588a1d26d170635ead6892d0e314477e80256ef4a8470cf3"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87a8e86bae0dbd749c815211ca11e3a7bd559b9710746c559ed63106d382bd9c"}, + {file = "ruff-0.8.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:85e654f0ded7befe2d61eeaf3d3b1e4ef3894469cd664ffa85006c7720f1e4a2"}, + {file = "ruff-0.8.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:83a55679c4cb449fa527b8497cadf54f076603cc36779b2170b24f704171ce70"}, + {file = "ruff-0.8.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:812e2052121634cf13cd6fddf0c1871d0ead1aad40a1a258753c04c18bb71bbd"}, + {file = "ruff-0.8.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:780d5d8523c04202184405e60c98d7595bdb498c3c6abba3b6d4cdf2ca2af426"}, + {file = "ruff-0.8.0-py3-none-win32.whl", hash = "sha256:5fdb6efecc3eb60bba5819679466471fd7d13c53487df7248d6e27146e985468"}, + {file = "ruff-0.8.0-py3-none-win_amd64.whl", hash = "sha256:582891c57b96228d146725975fbb942e1f30a0c4ba19722e692ca3eb25cc9b4f"}, + {file = "ruff-0.8.0-py3-none-win_arm64.whl", hash = "sha256:ba93e6294e9a737cd726b74b09a6972e36bb511f9a102f1d9a7e1ce94dd206a6"}, + {file = "ruff-0.8.0.tar.gz", hash = "sha256:a7ccfe6331bf8c8dad715753e157457faf7351c2b69f62f32c165c2dbcbacd44"}, ] [[package]] name = "tomli" version = "2.1.0" description = "A lil' TOML parser" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -1110,7 +1080,6 @@ files = [ name = "tomlkit" version = "0.13.2" description = "Style preserving TOML library" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -1122,7 +1091,6 @@ files = [ name = "types-protobuf" version = "5.28.3.20241030" description = "Typing stubs for protobuf" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -1134,7 +1102,6 @@ files = [ name = "typing-extensions" version = "4.12.2" description = "Backported and Experimental Type Hints for Python 3.8+" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -1146,7 +1113,6 @@ files = [ name = "yarl" version = "1.18.0" description = "Yet another URL library" -category = "dev" optional = false python-versions = ">=3.9" files = [ @@ -1242,4 +1208,4 @@ propcache = ">=0.2.0" [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "54296d162df2f69d00be8d81994fda3412ef461ba1b688d2aed8331e0257fb10" +content-hash = "01f8c2ce5a461eda1d4308f56d57dc627191ac7fa8e2d48f7cfb111e3ca5fe2c" diff --git a/pyproject.toml b/pyproject.toml index 90826c7..9f13f92 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ mypy = "^1.13.0" pytest = "^8.3.3" pytest-cov = "^6.0.0" pytest-mypy-plugins = "^3.1.2" -ruff = "^0.7.4" +ruff = ">=0.7.4,<0.9.0" grpc-stubs = "^1.53.0.5" BrokRPC = { version = "^0.2.0", python = ">=3.12,<4.0" } @@ -49,6 +49,7 @@ build-backend = "poetry.core.masonry.api" [tool.ruff] +target-version = "py39" include = ["src/**/*.py", "tests/**/*.py"] extend-exclude = ["tests/**/expected_gen/**.py"] force-exclude = true diff --git a/src/pyprotostuben/codegen/mypy/builder.py b/src/pyprotostuben/codegen/mypy/builder.py index d87c5eb..dfed4fc 100644 --- a/src/pyprotostuben/codegen/mypy/builder.py +++ b/src/pyprotostuben/codegen/mypy/builder.py @@ -153,7 +153,7 @@ def __build_protobuf_message_has_field_method_stub(self, scope: ScopeInfo) -> as ) def __build_which_oneof_method_stubs(self, scope: ScopeInfo) -> t.Iterable[ast.stmt]: - oneofs: t.DefaultDict[str, t.List[ast.expr]] = defaultdict(list) + oneofs = defaultdict[str, list[ast.expr]](list) for field in scope.fields: if field.oneof_group is not None: oneofs[field.oneof_group].append(self.__inner.build_const(field.name)) @@ -429,7 +429,7 @@ def __build_stub_method_def(self, info: MethodInfo) -> ast.stmt: doc=info.doc, ) - def __build_servicer_method_inout_refs(self, info: MethodInfo) -> t.Tuple[ast.expr, ast.expr]: + def __build_servicer_method_inout_refs(self, info: MethodInfo) -> tuple[ast.expr, ast.expr]: if not info.server_input_streaming and not info.server_output_streaming: return ( self.__build_message_ref(info.server_input), @@ -457,7 +457,7 @@ def __build_servicer_method_inout_refs(self, info: MethodInfo) -> t.Tuple[ast.ex msg = "invalid method streaming options" raise ValueError(msg, info) - def __build_stub_method_inout_refs(self, info: MethodInfo) -> t.Tuple[ast.expr, ast.expr]: + def __build_stub_method_inout_refs(self, info: MethodInfo) -> tuple[ast.expr, ast.expr]: if not info.server_input_streaming and not info.server_output_streaming: return ( self.__build_message_ref(info.server_input), diff --git a/src/pyprotostuben/logging.py b/src/pyprotostuben/logging.py index 4669ffb..4245550 100644 --- a/src/pyprotostuben/logging.py +++ b/src/pyprotostuben/logging.py @@ -60,16 +60,17 @@ def configure(cls) -> None: def get( # allow callee to pass custom `cls` kwarg __cls, # noqa: N804 - __name: str, + name: str, + /, **kwargs: object, ) -> "Logger": - return __cls(getLogger(__name), kwargs) + return __cls(getLogger(name), kwargs) def process( self, msg: object, kwargs: t.MutableMapping[str, object], - ) -> t.Tuple[object, t.MutableMapping[str, object]]: + ) -> tuple[object, t.MutableMapping[str, object]]: exc_info = kwargs.pop("exc_info", None) return msg, { "exc_info": exc_info, diff --git a/src/pyprotostuben/protobuf/context.py b/src/pyprotostuben/protobuf/context.py index cea5d4c..d794332 100644 --- a/src/pyprotostuben/protobuf/context.py +++ b/src/pyprotostuben/protobuf/context.py @@ -40,9 +40,9 @@ class CodeGeneratorContext: @dataclass() class BuildContext: - files: t.Dict[str, ProtoFile] = field(default_factory=dict) - types: t.Dict[str, t.Union[EnumInfo, MessageInfo]] = field(default_factory=dict) - map_entries: t.Dict[str, MapEntryPlaceholder] = field(default_factory=dict) + files: dict[str, ProtoFile] = field(default_factory=dict) + types: dict[str, t.Union[EnumInfo, MessageInfo]] = field(default_factory=dict) + map_entries: dict[str, MapEntryPlaceholder] = field(default_factory=dict) class ContextBuilder(ProtoVisitor[BuildContext], LoggerMixin): @@ -141,7 +141,7 @@ def __build_type( EnumContext[BuildContext], DescriptorContext[BuildContext], ], - ) -> t.Tuple[str, ModuleInfo, t.Sequence[str]]: + ) -> tuple[str, ModuleInfo, t.Sequence[str]]: ns = [part.proto.name for part in context.parts[1:]] proto_path = ".".join(ns) diff --git a/src/pyprotostuben/protobuf/location.py b/src/pyprotostuben/protobuf/location.py index dbfc2d4..6184c70 100644 --- a/src/pyprotostuben/protobuf/location.py +++ b/src/pyprotostuben/protobuf/location.py @@ -7,7 +7,7 @@ def get_comment_blocks(location: t.Optional[SourceCodeInfo.Location]) -> t.Seque if location is None: return [] - blocks: t.List[str] = [] + blocks: list[str] = [] blocks.extend(comment.strip() for comment in location.leading_detached_comments) if location.HasField("leading_comments"): diff --git a/src/pyprotostuben/python/ast_builder.py b/src/pyprotostuben/python/ast_builder.py index 1e5dde0..ad82181 100644 --- a/src/pyprotostuben/python/ast_builder.py +++ b/src/pyprotostuben/python/ast_builder.py @@ -46,7 +46,7 @@ def get_dependencies(self) -> t.Sequence[ModuleInfo]: class ModuleDependencyResolver(DependencyResolver): def __init__(self, module: ModuleInfo) -> None: self.__module = module - self.__deps: t.Set[ModuleInfo] = set() + self.__deps: set[ModuleInfo] = set() def resolve(self, info: TypeInfo) -> TypeInfo: if info.module == self.__module: @@ -508,7 +508,7 @@ def build_call_stmt( def build_with_stmt( self, *, - items: t.Sequence[t.Tuple[str, TypeRef]], + items: t.Sequence[tuple[str, TypeRef]], body: t.Sequence[ast.stmt], is_async: bool = False, ) -> t.Union[ast.With, ast.AsyncWith]: @@ -660,7 +660,7 @@ def build_module( def _build_decorators( self, *decorators: t.Optional[t.Sequence[t.Union[ast.expr, TypeInfo, None]]], - ) -> t.List[ast.expr]: + ) -> list[ast.expr]: return [ self.build_ref(dec) for block in (decorators or ()) if block for dec in (block or ()) if dec is not None ] @@ -696,14 +696,14 @@ def _build_func_args(self, args: t.Optional[t.Sequence[FuncArgInfo]]) -> ast.arg ], ) - def _build_body(self, doc: t.Optional[str], body: t.Optional[t.Sequence[ast.stmt]]) -> t.List[ast.stmt]: - result: t.List[ast.stmt] = list(body or ()) + def _build_body(self, doc: t.Optional[str], body: t.Optional[t.Sequence[ast.stmt]]) -> list[ast.stmt]: + result: list[ast.stmt] = list(body or ()) if doc: result.insert(0, self.build_docstring(doc)) return result - def _build_stub_body(self, doc: t.Optional[str]) -> t.List[ast.stmt]: + def _build_stub_body(self, doc: t.Optional[str]) -> list[ast.stmt]: return ( [ ast.Expr(value=ast.Constant(value=...)), diff --git a/src/pyprotostuben/python/info.py b/src/pyprotostuben/python/info.py index e1607dc..5a19d3e 100644 --- a/src/pyprotostuben/python/info.py +++ b/src/pyprotostuben/python/info.py @@ -81,7 +81,7 @@ def from_str(cls, ref: str) -> "TypeInfo": return cls(ModuleInfo.from_str(module), ns.split(".")) @classmethod - def from_type(cls, type_: t.Type[object]) -> "TypeInfo": + def from_type(cls, type_: type[object]) -> "TypeInfo": return cls(ModuleInfo.from_str(type_.__module__), type_.__qualname__.split(".")) @classmethod diff --git a/src/pyprotostuben/stack.py b/src/pyprotostuben/stack.py index 28b7142..4a4a365 100644 --- a/src/pyprotostuben/stack.py +++ b/src/pyprotostuben/stack.py @@ -19,7 +19,7 @@ def get_last(self) -> V_co: class MutableStack(Stack[T]): def __init__(self, items: t.Optional[t.Sequence[T]] = None) -> None: - self.__impl: t.Deque[T] = deque(items or []) + self.__impl = deque[T](items or []) def __repr__(self) -> str: return f"{self.__class__.__name__}({self.__impl!r})" diff --git a/tests/stub/plugin.py b/tests/stub/plugin.py index c07b010..1b9c70a 100644 --- a/tests/stub/plugin.py +++ b/tests/stub/plugin.py @@ -11,7 +11,7 @@ class CustomPluginError(Exception): class ProtocPluginStub(ProtocPlugin): def __init__(self, side_effect: t.Optional[Exception], return_value: t.Optional[CodeGeneratorResponse]) -> None: - self.requests: t.List[CodeGeneratorRequest] = [] + self.requests: list[CodeGeneratorRequest] = [] self.__side_effect = side_effect self.__return_value = return_value