Currently __init__ of the new frozendict type is annotated only as def __init__(self) -> None: ....
This causes type checkers to show the following error when trying to create a frozendict with any arguments:
Expected 0 positional arguments.
The entire __init__ and __new__ overloads section currently looks like this:
if sys.version_info >= (3, 15):
@disjoint_base
class frozendict(Mapping[_KT, _VT]):
@overload
def __new__(cls, /) -> frozendict[Any, Any]: ...
@overload
def __new__(cls: type[frozendict[str, _VT]], /, **kwargs: _VT) -> frozendict[str, _VT]: ...
@overload
def __new__(cls, map: SupportsKeysAndGetItem[_KT, _VT], /) -> frozendict[_KT, _VT]: ...
@overload
def __new__(
cls: type[frozendict[str, _VT]], map: SupportsKeysAndGetItem[str, _VT], /, **kwargs: _VT
) -> frozendict[str, _VT]: ...
@overload
def __new__(cls, iterable: Iterable[tuple[_KT, _VT]], /) -> frozendict[_KT, _VT]: ...
@overload
def __new__(
cls: type[frozendict[str, _VT]], iterable: Iterable[tuple[str, _VT]], /, **kwargs: _VT
) -> frozendict[str, _VT]: ...
def __init__(self) -> None: ...
Fix: __init__ should simply be removed entirely, similar to how it is implemented for frozenset and the __new__ overloads should just stay as they are.
Currently
__init__of the newfrozendicttype is annotated only asdef __init__(self) -> None: ....This causes type checkers to show the following error when trying to create a frozendict with any arguments:
Expected 0 positional arguments.The entire
__init__and__new__overloads section currently looks like this:Fix:
__init__should simply be removed entirely, similar to how it is implemented forfrozensetand the__new__overloads should just stay as they are.