Skip to content

Commit a9f0c04

Browse files
Add frozenset support. (#85)
This was in micro:bit MicroPython 1.0 and has been reinstated in 2.1.1. I've taken a newer version from typeshed with __new__ and a typing fix for the contructor typevar.
1 parent 7755665 commit a9f0c04

File tree

16 files changed

+232
-8
lines changed

16 files changed

+232
-8
lines changed

lang/en/typeshed/stdlib/abc.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ _FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
66

77
# These definitions have special processing in mypy
88
class ABCMeta(type):
9-
__abstractmethods__: set[str]
9+
__abstractmethods__: frozenset[str]
1010
def __init__(
1111
self, name: str, bases: Tuple[type, ...], namespace: dict[str, Any]
1212
) -> None: ...

lang/en/typeshed/stdlib/builtins.pyi

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,34 @@ class function:
634634
__qualname__: str
635635
__annotations__: dict[str, Any]
636636

637+
class frozenset(AbstractSet[_T_co], Generic[_T_co]):
638+
@overload
639+
def __new__(cls: type[Self]) -> Self: ...
640+
@overload
641+
def __new__(cls: type[Self], __iterable: Iterable[_T_co]) -> Self: ...
642+
def copy(self) -> FrozenSet[_T_co]: ...
643+
def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
644+
def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
645+
def isdisjoint(self, s: Iterable[_T_co]) -> bool: ...
646+
def issubset(self, s: Iterable[object]) -> bool: ...
647+
def issuperset(self, s: Iterable[object]) -> bool: ...
648+
def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
649+
def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
650+
def __len__(self) -> int: ...
651+
def __contains__(self, o: object) -> bool: ...
652+
def __iter__(self) -> Iterator[_T_co]: ...
653+
def __str__(self) -> str: ...
654+
def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
655+
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
656+
def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
657+
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
658+
def __le__(self, s: AbstractSet[object]) -> bool: ...
659+
def __lt__(self, s: AbstractSet[object]) -> bool: ...
660+
def __ge__(self, s: AbstractSet[object]) -> bool: ...
661+
def __gt__(self, s: AbstractSet[object]) -> bool: ...
662+
if sys.version_info >= (3, 9):
663+
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
664+
637665
class list(MutableSequence[_T], Generic[_T]):
638666
@overload
639667
def __init__(self) -> None: ...

lang/es-es/typeshed/stdlib/abc.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ _FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
66

77
# These definitions have special processing in mypy
88
class ABCMeta(type):
9-
__abstractmethods__: set[str]
9+
__abstractmethods__: frozenset[str]
1010
def __init__(
1111
self, name: str, bases: Tuple[type, ...], namespace: dict[str, Any]
1212
) -> None: ...

lang/es-es/typeshed/stdlib/builtins.pyi

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,34 @@ class function:
634634
__qualname__: str
635635
__annotations__: dict[str, Any]
636636

637+
class frozenset(AbstractSet[_T_co], Generic[_T_co]):
638+
@overload
639+
def __new__(cls: type[Self]) -> Self: ...
640+
@overload
641+
def __new__(cls: type[Self], __iterable: Iterable[_T_co]) -> Self: ...
642+
def copy(self) -> FrozenSet[_T_co]: ...
643+
def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
644+
def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
645+
def isdisjoint(self, s: Iterable[_T_co]) -> bool: ...
646+
def issubset(self, s: Iterable[object]) -> bool: ...
647+
def issuperset(self, s: Iterable[object]) -> bool: ...
648+
def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
649+
def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
650+
def __len__(self) -> int: ...
651+
def __contains__(self, o: object) -> bool: ...
652+
def __iter__(self) -> Iterator[_T_co]: ...
653+
def __str__(self) -> str: ...
654+
def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
655+
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
656+
def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
657+
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
658+
def __le__(self, s: AbstractSet[object]) -> bool: ...
659+
def __lt__(self, s: AbstractSet[object]) -> bool: ...
660+
def __ge__(self, s: AbstractSet[object]) -> bool: ...
661+
def __gt__(self, s: AbstractSet[object]) -> bool: ...
662+
if sys.version_info >= (3, 9):
663+
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
664+
637665
class list(MutableSequence[_T], Generic[_T]):
638666
@overload
639667
def __init__(self) -> None: ...

lang/fr/typeshed/stdlib/abc.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ _FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
66

77
# These definitions have special processing in mypy
88
class ABCMeta(type):
9-
__abstractmethods__: set[str]
9+
__abstractmethods__: frozenset[str]
1010
def __init__(
1111
self, name: str, bases: Tuple[type, ...], namespace: dict[str, Any]
1212
) -> None: ...

lang/fr/typeshed/stdlib/builtins.pyi

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,34 @@ class function:
634634
__qualname__: str
635635
__annotations__: dict[str, Any]
636636

637+
class frozenset(AbstractSet[_T_co], Generic[_T_co]):
638+
@overload
639+
def __new__(cls: type[Self]) -> Self: ...
640+
@overload
641+
def __new__(cls: type[Self], __iterable: Iterable[_T_co]) -> Self: ...
642+
def copy(self) -> FrozenSet[_T_co]: ...
643+
def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
644+
def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
645+
def isdisjoint(self, s: Iterable[_T_co]) -> bool: ...
646+
def issubset(self, s: Iterable[object]) -> bool: ...
647+
def issuperset(self, s: Iterable[object]) -> bool: ...
648+
def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
649+
def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
650+
def __len__(self) -> int: ...
651+
def __contains__(self, o: object) -> bool: ...
652+
def __iter__(self) -> Iterator[_T_co]: ...
653+
def __str__(self) -> str: ...
654+
def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
655+
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
656+
def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
657+
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
658+
def __le__(self, s: AbstractSet[object]) -> bool: ...
659+
def __lt__(self, s: AbstractSet[object]) -> bool: ...
660+
def __ge__(self, s: AbstractSet[object]) -> bool: ...
661+
def __gt__(self, s: AbstractSet[object]) -> bool: ...
662+
if sys.version_info >= (3, 9):
663+
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
664+
637665
class list(MutableSequence[_T], Generic[_T]):
638666
@overload
639667
def __init__(self) -> None: ...

lang/ja/typeshed/stdlib/abc.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ _FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
66

77
# These definitions have special processing in mypy
88
class ABCMeta(type):
9-
__abstractmethods__: set[str]
9+
__abstractmethods__: frozenset[str]
1010
def __init__(
1111
self, name: str, bases: Tuple[type, ...], namespace: dict[str, Any]
1212
) -> None: ...

lang/ja/typeshed/stdlib/builtins.pyi

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,34 @@ class function:
634634
__qualname__: str
635635
__annotations__: dict[str, Any]
636636

637+
class frozenset(AbstractSet[_T_co], Generic[_T_co]):
638+
@overload
639+
def __new__(cls: type[Self]) -> Self: ...
640+
@overload
641+
def __new__(cls: type[Self], __iterable: Iterable[_T_co]) -> Self: ...
642+
def copy(self) -> FrozenSet[_T_co]: ...
643+
def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
644+
def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
645+
def isdisjoint(self, s: Iterable[_T_co]) -> bool: ...
646+
def issubset(self, s: Iterable[object]) -> bool: ...
647+
def issuperset(self, s: Iterable[object]) -> bool: ...
648+
def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
649+
def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
650+
def __len__(self) -> int: ...
651+
def __contains__(self, o: object) -> bool: ...
652+
def __iter__(self) -> Iterator[_T_co]: ...
653+
def __str__(self) -> str: ...
654+
def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
655+
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
656+
def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
657+
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
658+
def __le__(self, s: AbstractSet[object]) -> bool: ...
659+
def __lt__(self, s: AbstractSet[object]) -> bool: ...
660+
def __ge__(self, s: AbstractSet[object]) -> bool: ...
661+
def __gt__(self, s: AbstractSet[object]) -> bool: ...
662+
if sys.version_info >= (3, 9):
663+
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
664+
637665
class list(MutableSequence[_T], Generic[_T]):
638666
@overload
639667
def __init__(self) -> None: ...

lang/ko/typeshed/stdlib/abc.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ _FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
66

77
# These definitions have special processing in mypy
88
class ABCMeta(type):
9-
__abstractmethods__: set[str]
9+
__abstractmethods__: frozenset[str]
1010
def __init__(
1111
self, name: str, bases: Tuple[type, ...], namespace: dict[str, Any]
1212
) -> None: ...

lang/ko/typeshed/stdlib/builtins.pyi

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,34 @@ class function:
634634
__qualname__: str
635635
__annotations__: dict[str, Any]
636636

637+
class frozenset(AbstractSet[_T_co], Generic[_T_co]):
638+
@overload
639+
def __new__(cls: type[Self]) -> Self: ...
640+
@overload
641+
def __new__(cls: type[Self], __iterable: Iterable[_T_co]) -> Self: ...
642+
def copy(self) -> FrozenSet[_T_co]: ...
643+
def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
644+
def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
645+
def isdisjoint(self, s: Iterable[_T_co]) -> bool: ...
646+
def issubset(self, s: Iterable[object]) -> bool: ...
647+
def issuperset(self, s: Iterable[object]) -> bool: ...
648+
def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
649+
def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
650+
def __len__(self) -> int: ...
651+
def __contains__(self, o: object) -> bool: ...
652+
def __iter__(self) -> Iterator[_T_co]: ...
653+
def __str__(self) -> str: ...
654+
def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
655+
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
656+
def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
657+
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
658+
def __le__(self, s: AbstractSet[object]) -> bool: ...
659+
def __lt__(self, s: AbstractSet[object]) -> bool: ...
660+
def __ge__(self, s: AbstractSet[object]) -> bool: ...
661+
def __gt__(self, s: AbstractSet[object]) -> bool: ...
662+
if sys.version_info >= (3, 9):
663+
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
664+
637665
class list(MutableSequence[_T], Generic[_T]):
638666
@overload
639667
def __init__(self) -> None: ...

lang/nl/typeshed/stdlib/abc.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ _FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
66

77
# These definitions have special processing in mypy
88
class ABCMeta(type):
9-
__abstractmethods__: set[str]
9+
__abstractmethods__: frozenset[str]
1010
def __init__(
1111
self, name: str, bases: Tuple[type, ...], namespace: dict[str, Any]
1212
) -> None: ...

lang/nl/typeshed/stdlib/builtins.pyi

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,34 @@ class function:
634634
__qualname__: str
635635
__annotations__: dict[str, Any]
636636

637+
class frozenset(AbstractSet[_T_co], Generic[_T_co]):
638+
@overload
639+
def __new__(cls: type[Self]) -> Self: ...
640+
@overload
641+
def __new__(cls: type[Self], __iterable: Iterable[_T_co]) -> Self: ...
642+
def copy(self) -> FrozenSet[_T_co]: ...
643+
def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
644+
def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
645+
def isdisjoint(self, s: Iterable[_T_co]) -> bool: ...
646+
def issubset(self, s: Iterable[object]) -> bool: ...
647+
def issuperset(self, s: Iterable[object]) -> bool: ...
648+
def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
649+
def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
650+
def __len__(self) -> int: ...
651+
def __contains__(self, o: object) -> bool: ...
652+
def __iter__(self) -> Iterator[_T_co]: ...
653+
def __str__(self) -> str: ...
654+
def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
655+
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
656+
def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
657+
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
658+
def __le__(self, s: AbstractSet[object]) -> bool: ...
659+
def __lt__(self, s: AbstractSet[object]) -> bool: ...
660+
def __ge__(self, s: AbstractSet[object]) -> bool: ...
661+
def __gt__(self, s: AbstractSet[object]) -> bool: ...
662+
if sys.version_info >= (3, 9):
663+
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
664+
637665
class list(MutableSequence[_T], Generic[_T]):
638666
@overload
639667
def __init__(self) -> None: ...

lang/zh-cn/typeshed/stdlib/abc.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ _FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
66

77
# These definitions have special processing in mypy
88
class ABCMeta(type):
9-
__abstractmethods__: set[str]
9+
__abstractmethods__: frozenset[str]
1010
def __init__(
1111
self, name: str, bases: Tuple[type, ...], namespace: dict[str, Any]
1212
) -> None: ...

lang/zh-cn/typeshed/stdlib/builtins.pyi

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,34 @@ class function:
634634
__qualname__: str
635635
__annotations__: dict[str, Any]
636636

637+
class frozenset(AbstractSet[_T_co], Generic[_T_co]):
638+
@overload
639+
def __new__(cls: type[Self]) -> Self: ...
640+
@overload
641+
def __new__(cls: type[Self], __iterable: Iterable[_T_co]) -> Self: ...
642+
def copy(self) -> FrozenSet[_T_co]: ...
643+
def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
644+
def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
645+
def isdisjoint(self, s: Iterable[_T_co]) -> bool: ...
646+
def issubset(self, s: Iterable[object]) -> bool: ...
647+
def issuperset(self, s: Iterable[object]) -> bool: ...
648+
def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
649+
def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
650+
def __len__(self) -> int: ...
651+
def __contains__(self, o: object) -> bool: ...
652+
def __iter__(self) -> Iterator[_T_co]: ...
653+
def __str__(self) -> str: ...
654+
def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
655+
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
656+
def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
657+
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
658+
def __le__(self, s: AbstractSet[object]) -> bool: ...
659+
def __lt__(self, s: AbstractSet[object]) -> bool: ...
660+
def __ge__(self, s: AbstractSet[object]) -> bool: ...
661+
def __gt__(self, s: AbstractSet[object]) -> bool: ...
662+
if sys.version_info >= (3, 9):
663+
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
664+
637665
class list(MutableSequence[_T], Generic[_T]):
638666
@overload
639667
def __init__(self) -> None: ...

lang/zh-tw/typeshed/stdlib/abc.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ _FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
66

77
# These definitions have special processing in mypy
88
class ABCMeta(type):
9-
__abstractmethods__: set[str]
9+
__abstractmethods__: frozenset[str]
1010
def __init__(
1111
self, name: str, bases: Tuple[type, ...], namespace: dict[str, Any]
1212
) -> None: ...

lang/zh-tw/typeshed/stdlib/builtins.pyi

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,34 @@ class function:
634634
__qualname__: str
635635
__annotations__: dict[str, Any]
636636

637+
class frozenset(AbstractSet[_T_co], Generic[_T_co]):
638+
@overload
639+
def __new__(cls: type[Self]) -> Self: ...
640+
@overload
641+
def __new__(cls: type[Self], __iterable: Iterable[_T_co]) -> Self: ...
642+
def copy(self) -> FrozenSet[_T_co]: ...
643+
def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
644+
def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
645+
def isdisjoint(self, s: Iterable[_T_co]) -> bool: ...
646+
def issubset(self, s: Iterable[object]) -> bool: ...
647+
def issuperset(self, s: Iterable[object]) -> bool: ...
648+
def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
649+
def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
650+
def __len__(self) -> int: ...
651+
def __contains__(self, o: object) -> bool: ...
652+
def __iter__(self) -> Iterator[_T_co]: ...
653+
def __str__(self) -> str: ...
654+
def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
655+
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
656+
def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
657+
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
658+
def __le__(self, s: AbstractSet[object]) -> bool: ...
659+
def __lt__(self, s: AbstractSet[object]) -> bool: ...
660+
def __ge__(self, s: AbstractSet[object]) -> bool: ...
661+
def __gt__(self, s: AbstractSet[object]) -> bool: ...
662+
if sys.version_info >= (3, 9):
663+
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
664+
637665
class list(MutableSequence[_T], Generic[_T]):
638666
@overload
639667
def __init__(self) -> None: ...

0 commit comments

Comments
 (0)