Even though *args and **kwds are technically a List and a Dict respectively, they are not typed the same way. See mypy docs or PEP-484. Changing both to Any solves this problem.
Mypy output when calling the DataclassReader Ctor:
reader = DataclassReader(
lines,
MyDataclass,
delimiter="+",
# ^ Argument "delimiter" to "DataclassReader" has incompatible type "str"; expected "Dict[str, Any]"
)
The type annotations for the DataclassReader are incorrect:
https://github.com/dfurtado/dataclass-csv/blob/872ce021fcda12bc0ccad8fd7719036dc0d87e4c/dataclass_csv/dataclass_reader.py#L48-L59
https://github.com/dfurtado/dataclass-csv/blob/872ce021fcda12bc0ccad8fd7719036dc0d87e4c/dataclass_csv/dataclass_reader.pyi#L5-L16
Even though
*args
and**kwds
are technically aList
and aDict
respectively, they are not typed the same way. See mypy docs or PEP-484. Changing both toAny
solves this problem.Mypy output when calling the DataclassReader Ctor: