-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I am getting mypy errors when using the inject decorator on classes:
# file.py
from kink import di, inject
di["x"] = 42
@inject
class C:
def __init__(self, x: int) -> None:
print(x)
c = C()Running mypy with:
$ mypy file.py
file.py:13: error: Missing positional argument "x" in call to "C"
Found 1 error in 1 file (checked 1 source file)
Version info:
$ pip freeze
kink==0.6.2
mypy==0.910
mypy-extensions==0.4.3
toml==0.10.2
typing-extensions==3.10.0.2
$ python --version
Python 3.9.7
The only workaround I can see is this:
class C:
def __init__(self, x: int = di["x"]) -> None:Which means the inject decorator isn't needed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request