You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
According to the example I posted below, dacite provides information that the returned object is a Base instance, not a User. At least that's how it looks from a pylint perspective (mypy doesn't report any errors). Technically, the code below still works, but there were no warnings/errors when version 1.7.0 was used.
To Reproduce
from __future__ importannotationsfromdataclassesimportdataclassfromtypingimportType, TypeVarfromdaciteimportfrom_dictfromdacite.dataimportDataT=TypeVar("T")
@dataclassclassBase:
@classmethoddeffrom_dict(cls: Type[T], data: Data) ->T:
returnfrom_dict(data_class=cls, data=data)
@dataclassclassUser(Base):
name: struser=User.from_dict({"name": "John"})
print(user.name) # E1101: Instance of 'Base' has no 'name' member (no-member)
Expected behavior
No pylint errors as it was in version 1.7.0.
Environment
Python version: 3.8.10
dacite version: 1.8.1
pylint version: 2.17.4
Additional context
We implemented such a "base" dataclass a long time ago. And maybe it is not the best piece of the code but it forces us to use the from_dict() function always the same way, no matter which class we talk about (consistency).
In the near future, we plan to upgrade our code to Python 3.11, then, I will verify it once again. But if I find some free time for open-source coding in the meantime, I will try to debug it on my own 😉
The text was updated successfully, but these errors were encountered:
Describe the bug
According to the example I posted below,
dacite
provides information that the returned object is aBase
instance, not aUser
. At least that's how it looks from apylint
perspective (mypy
doesn't report any errors). Technically, the code below still works, but there were no warnings/errors when version 1.7.0 was used.To Reproduce
Expected behavior
No
pylint
errors as it was in version 1.7.0.Environment
dacite
version: 1.8.1pylint
version: 2.17.4Additional context
We implemented such a "base" dataclass a long time ago. And maybe it is not the best piece of the code but it forces us to use the
from_dict()
function always the same way, no matter which class we talk about (consistency).In the near future, we plan to upgrade our code to Python 3.11, then, I will verify it once again. But if I find some free time for open-source coding in the meantime, I will try to debug it on my own 😉
The text was updated successfully, but these errors were encountered: