openpyxl: type __iter__ dunders (#10883)

This commit is contained in:
Avasam
2023-10-16 12:31:39 -04:00
committed by GitHub
parent 838dd3a5ba
commit 9c0f4353ef
12 changed files with 26 additions and 19 deletions

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete, SupportsIter
from collections.abc import Iterator
from typing import Any, ClassVar, Protocol
from typing_extensions import Final, Self
@@ -34,7 +35,7 @@ class Serialisable(metaclass=MetaSerialisable):
@classmethod
def from_tree(cls, node: _SerialisableTreeElement) -> Self | None: ...
def to_tree(self, tagname: str | None = None, idx: Incomplete | None = None, namespace: str | None = None): ...
def __iter__(self): ...
def __iter__(self) -> Iterator[tuple[str, str]]: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __hash__(self) -> int: ...

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete, Unused
from collections.abc import Iterator
from typing import ClassVar
from typing_extensions import Literal
@@ -26,7 +27,7 @@ class ConditionalFormattingList:
def add(self, range_string, cfRule) -> None: ...
def __bool__(self) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self): ...
def __iter__(self) -> Iterator[ConditionalFormatting]: ...
def __getitem__(self, key): ...
def __delitem__(self, key) -> None: ...
def __setitem__(self, key, rule) -> None: ...

View File

@@ -54,7 +54,7 @@ _MappingPropertyType: TypeAlias = StringProperty | IntProperty | FloatProperty |
CLASS_MAPPING: Final[dict[type[_MappingPropertyType], str]]
XML_MAPPING: Final[dict[str, type[_MappingPropertyType]]]
class CustomPropertyList(Strict):
class CustomPropertyList(Strict, Generic[_T]):
props: Sequence
def __init__(self) -> None: ...
@classmethod
@@ -66,4 +66,4 @@ class CustomPropertyList(Strict):
def names(self) -> list[str]: ...
def __getitem__(self, name): ...
def __delitem__(self, name) -> None: ...
def __iter__(self) -> Iterator[Incomplete]: ...
def __iter__(self) -> Iterator[_TypedProperty[_T]]: ...

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Iterator
from typing import ClassVar
from typing_extensions import Literal, TypeAlias
@@ -44,4 +45,4 @@ class Alignment(Serialisable):
shrink_to_fit: Incomplete | None = None,
mergeCell: Incomplete | None = None,
) -> None: ...
def __iter__(self): ...
def __iter__(self) -> Iterator[tuple[str, str]]: ...

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Iterator
from typing import ClassVar
from typing_extensions import Final, Literal, TypeAlias
@@ -82,6 +83,6 @@ class Border(Serialisable):
start: Side | None = None,
end: Side | None = None,
) -> None: ...
def __iter__(self): ...
def __iter__(self) -> Iterator[tuple[str, str]]: ...
DEFAULT_BORDER: Final[Border]

View File

@@ -1,5 +1,5 @@
from _typeshed import Incomplete, Unused
from collections.abc import Generator
from collections.abc import Iterator
from re import Pattern
from typing import ClassVar, TypeVar, overload
from typing_extensions import Final, Literal, Self
@@ -58,7 +58,7 @@ class Color(Serialisable):
def value(self) -> str | int | bool: ...
@value.setter
def value(self, value: str | _ConvertibleToInt | _ConvertibleToBool) -> None: ...
def __iter__(self) -> Generator[tuple[str, str], None, None]: ...
def __iter__(self) -> Iterator[tuple[str, str]]: ...
@property
def index(self) -> str | int | bool: ...
@overload

View File

@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Iterable, Sequence as ABCSequence
from collections.abc import Iterable, Iterator, Sequence as ABCSequence
from typing import ClassVar
from typing_extensions import Final, Literal, TypeAlias
@@ -112,5 +112,5 @@ class GradientFill(Fill):
bottom: _ConvertibleToFloat = 0,
stop=(),
) -> None: ...
def __iter__(self): ...
def __iter__(self) -> Iterator[tuple[str, str]]: ...
def to_tree(self, tagname: str | None = None, namespace: str | None = None, idx: Incomplete | None = None): ... # type: ignore[override]

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete, Unused
from collections.abc import Iterator
from typing import ClassVar
from typing_extensions import Literal
@@ -37,7 +38,7 @@ class NamedStyle(Serialisable):
xfId: Unused = None,
) -> None: ...
def __setattr__(self, attr: str, value) -> None: ...
def __iter__(self): ...
def __iter__(self) -> Iterator[tuple[str, str]]: ...
@property
def xfId(self) -> int | None: ...
def bind(self, wb) -> None: ...

View File

@@ -1,6 +1,6 @@
from _typeshed import Incomplete
from collections import defaultdict
from collections.abc import Generator
from collections.abc import Generator, Iterator
from re import Pattern
from typing import ClassVar
from typing_extensions import Final, Literal
@@ -59,7 +59,7 @@ class DefinedName(Serialisable):
def is_reserved(self) -> str | None: ...
@property
def is_external(self) -> bool: ...
def __iter__(self): ...
def __iter__(self) -> Iterator[tuple[str, str]]: ...
class DefinedNameDict(dict[str, DefinedName]):
def add(self, value: DefinedName) -> None: ...

View File

@@ -1,7 +1,7 @@
from _typeshed import Incomplete, Unused
from collections.abc import Generator
from collections.abc import Generator, Iterator
from itertools import product
from typing import overload
from typing import Any, overload
from typing_extensions import Literal
from openpyxl.descriptors import Strict
@@ -62,7 +62,8 @@ class CellRange(Serialisable):
__and__ = intersection
def union(self, other): ...
__or__ = union
def __iter__(self): ...
# Iterates over class attributes. Value could be anything.
def __iter__(self) -> Iterator[tuple[str, Any]]: ...
def expand(self, right: int = 0, down: int = 0, left: int = 0, up: int = 0) -> None: ...
def shrink(self, right: int = 0, bottom: int = 0, left: int = 0, top: int = 0) -> None: ...
@property
@@ -87,5 +88,5 @@ class MultiCellRange(Strict):
def __ne__(self, other): ...
def __bool__(self) -> bool: ...
def remove(self, coord) -> None: ...
def __iter__(self): ...
def __iter__(self) -> Iterator[CellRange]: ...
def __copy__(self): ...

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete, Unused
from collections.abc import Iterator
from typing import ClassVar, overload
from typing_extensions import Final, Literal, Self, TypeAlias
@@ -127,7 +128,7 @@ class TableColumn(Serialisable):
xmlColumnPr: XMLColumnProps | None = None,
extLst: ExtensionList | None = None,
) -> None: ...
def __iter__(self): ...
def __iter__(self) -> Iterator[tuple[str, str]]: ...
@classmethod
def from_tree(cls, node: _ChildSerialisableTreeElement) -> Self: ...

View File

@@ -89,7 +89,7 @@ class Worksheet(_WorkbookChild):
@overload
def __getitem__(self, key: str) -> Any: ... # AnyOf[Cell, tuple[Cell, ...]]
def __setitem__(self, key: str, value: str) -> None: ...
def __iter__(self) -> Iterator[Cell]: ...
def __iter__(self) -> Iterator[tuple[Cell, ...]]: ...
def __delitem__(self, key: str) -> None: ...
@property
def min_row(self) -> int: ...