From f8471a1e099c30545f2b182341137efc8150ec9b Mon Sep 17 00:00:00 2001 From: Ilan Schnell Date: Thu, 10 Jun 2021 11:19:32 -0500 Subject: [PATCH] update work on .pyi files --- bitarray/__init__.pyi | 21 +++++++++++---------- bitarray/util.pyi | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bitarray/__init__.pyi b/bitarray/__init__.pyi index c18fcdc8..ad2baad1 100644 --- a/bitarray/__init__.pyi +++ b/bitarray/__init__.pyi @@ -1,5 +1,6 @@ -from typing import (Any, BinaryIO, Iterable, MutableSequence, Optional, - Union, overload) +from collections.abc import Iterable, Iterator + +from typing import Any, BinaryIO, Union, overload from typing_extensions import Literal @@ -13,8 +14,8 @@ class decodetree: def todict(self) -> Codedict: ... -class bitarray(MutableSequence[Bool]): - def __init__(self, initializer: Union[int, str, Iterable, None]=0, +class bitarray: + def __init__(self, initializer: Union[int, str, Iterable[Bool], None]=0, endian: str=..., /) -> None: ... def all(self) -> bool: ... def any(self) -> bool: ... @@ -38,14 +39,14 @@ class bitarray(MutableSequence[Bool]): def insert(self, i: int, value: Bool, /) -> None: ... def invert(self, i: int=...) -> None: ... def iterdecode(self, - code: Union[Codedict, decodetree], /) -> Iterable[int]: ... - def itersearch(self, a: Union[bitarray, Bool], /) -> Iterable[int]: ... + code: Union[Codedict, decodetree], /) -> Iterator: ... + def itersearch(self, a: Union[bitarray, Bool], /) -> Iterator[int]: ... def pack(self, b: bytes, /) -> None: ... def pop(self, i: int=..., /) -> Bool: ... def remove(self, value: Bool, /) -> None: ... def reverse(self) -> None: ... def search(self, a: Union[bitarray, Bool], - limit: Optional[int] = ...) -> list[int]: ... + limit: int = ...) -> list[int]: ... def setall(self, value: Bool, /) -> None: ... def sort(self, reverse: int) -> None: ... def to01(self) -> str: ... @@ -55,19 +56,19 @@ class bitarray(MutableSequence[Bool]): def unpack(self, zero: bytes=..., one: bytes=...) -> bytes: ... def __len__(self) -> int: ... + def __iter__(self) -> Iterator[Bool]: ... @overload def __getitem__(self, i: int) -> Bool: ... @overload def __getitem__(self, s: slice) -> bitarray: ... - @overload # type: ignore[override] + @overload def __setitem__(self, i: Union[int, slice], o: Bool) -> None: ... @overload def __setitem__(self, s: slice, o: bitarray) -> None: ... def __delitem__(self, i: Union[int, slice]) -> None: ... def __add__(self, other: bitarray) -> bitarray: ... - def __iadd__(self, other: bitarray) -> bitarray: # type: ignore[override] - ... + def __iadd__(self, other: bitarray) -> bitarray: ... def __mul__(self, n: int) -> bitarray: ... def __imul__(self, n: int) -> bitarray: ... def __rmul__(self, n: int) -> bitarray: ... diff --git a/bitarray/util.pyi b/bitarray/util.pyi index a92c5b6d..99355e46 100644 --- a/bitarray/util.pyi +++ b/bitarray/util.pyi @@ -1,4 +1,4 @@ -from typing import BinaryIO, Literal, Optional, Union, Any, AnyStr +from typing import Any, AnyStr, BinaryIO, Literal, Optional, Union from bitarray import bitarray