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
I am receiving an intellisense error on an inherited pydantic dataclass. I was able to replicate this on two operating systems, one in VSCode, the other in pycharm.
You can replicate the intellisense error with this snippet:
fromabcimportABC, abstractmethodfrompydanticimportBaseModel, dataclassesfromtypingimportList# python --version -> Python 3.10.2# pydantic=1.9.0# Running on MacOS Monterey 12.3.1@dataclasses.dataclass(frozen=True, eq=True)classPersonABC(ABC):
name: str@abstractmethoddefprint_bio(self):
pass@dataclasses.dataclass(frozen=True, eq=True)classJeff(PersonABC):
age: intdefprint_bio(self):
print(f"{self.name}: {self.age}") # In VScode, self.name is not registered as a known variable:# `Cannot access member "name" for type "Jeff"# Member "name" is unknownPylancereportGeneralTypeIssues`classFamily(BaseModel):
person: List[PersonABC]
jeff=Jeff(name="Jeff Gruenbaum", age=93)
print(Family(person=[jeff]))
The error takes place in the implemented print_bio function. The full error is in the comments above.
The text was updated successfully, but these errors were encountered:
I am receiving an intellisense error on an inherited pydantic dataclass. I was able to replicate this on two operating systems, one in VSCode, the other in pycharm.
You can replicate the intellisense error with this snippet:
The error takes place in the implemented print_bio function. The full error is in the comments above.
The text was updated successfully, but these errors were encountered: