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.