type: ignore[misc]

This commit is contained in:
Jirka B 2024-11-12 22:30:53 +01:00
parent a35f1fe34b
commit 78582621fd
2 changed files with 3 additions and 3 deletions

View File

@ -367,8 +367,8 @@ def _replace_dunder_methods(base_cls: type, store_explicit_arg: Optional[str] =
# Check that __init__ belongs to the class
# https://stackoverflow.com/a/5253424
if "__init__" in cls.__dict__:
cls.__old__init__ = cls.__init__
cls.__init__ = _wrap_init_method(cls.__init__, store_explicit_arg)
cls.__old__init__ = cls.__init__ # type: ignore[misc]
cls.__init__ = _wrap_init_method(cls.__init__, store_explicit_arg) # type: ignore[misc]
# we want at least one setattr/delattr in the chain to be patched and it can happen, that none of the subclasses
# implement `__setattr__`/`__delattr__`. Therefore, we are always patching the `base_cls`

View File

@ -61,7 +61,7 @@ def parse_class_init_keys(cls: type) -> tuple[str, Optional[str], Optional[str]]
('self', 'my_args', 'my_kwargs')
"""
init_parameters = inspect.signature(cls.__init__).parameters
init_parameters = inspect.signature(cls.__init__).parameters # type: ignore[misc]
# docs claims the params are always ordered
# https://docs.python.org/3/library/inspect.html#inspect.Signature.parameters
init_params = list(init_parameters.values())