I'm using pylance on VScode for type checking my Python code. It is having trouble with the frozen argument of dataclasses:
from dataclasses import dataclass
@dataclass(frozen=True)
class DataStoreConfig():
store_id: str
bucket_name: str
prefix: str
Pylance complains with this error: "frozen" is not definedPylance (reportUndefinedVariable)
When I navigate to dataclasses.pyi
, this is what I see for dataclass:
@overload
def dataclass(_cls: Type[_T]) -> Type[_T]: ...
@overload
def dataclass(_cls: None) -> Callable[[Type[_T]], Type[_T]]: ...
@overload
def dataclass(
*, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ...
) -> Callable[[Type[_T]], Type[_T]]: ...
So it seems like it is not picking the right overloaded method. Anyway to guide it?