from typing import Callable, Type, TypeVar
T = TypeVar("T")
def repo(class_: Type[T]) -> Callable:
def instantiate(*args, **kwargs) -> T:
return class_(*args, **kwargs)
return instantiate
Code above throws "error: Too many arguments for 'object'" on pre-commit hook run but not on local run (python poetry run mypy repo.py
).
Neither error message nor difference of behaviour between hook and local run make sense to me.
Any clue?
Thanks.
you've got a version mismatch between your two environments.
the one that is failing is mypy<=0.910
:
$ mypy --version
mypy 0.910
$ mypy t.py
t.py:7: error: Too many arguments for "object"
Found 1 error in 1 file (checked 1 source file)
the one that's passing is mypy>0.910
$ mypy --version
mypy 0.971 (compiled: yes)
$ mypy t.py
Success: no issues found in 1 source file