Skip to content

Commit

Permalink
Complete openpyxl metaclasses (#10736)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Sep 23, 2023
1 parent 71d81f8 commit 381fc57
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 21 deletions.
16 changes: 12 additions & 4 deletions stubs/openpyxl/openpyxl/compat/singleton.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
from typing import Any, overload

class Singleton(type):
def __init__(self, *args, **kw) -> None: ...
def __call__(self, *args, **kw): ...
@overload
def __init__(self, __o: object) -> None: ...
@overload
def __init__(self, __name: str, __bases: tuple[type, ...], __dict: dict[str, Any], **kwds: Any) -> None: ...
def __call__(self, *args: Any, **kwds: Any) -> Any: ...

class Cached(type):
def __init__(self, *args, **kw) -> None: ...
def __call__(self, *args): ...
@overload
def __init__(self, __o: object) -> None: ...
@overload
def __init__(self, __name: str, __bases: tuple[type, ...], __dict: dict[str, Any], **kwds: Any) -> None: ...
def __call__(self, *args: Any) -> Any: ...
6 changes: 4 additions & 2 deletions stubs/openpyxl/openpyxl/descriptors/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from _typeshed import Incomplete, Self

from .base import *
from .sequence import Sequence as Sequence

class MetaStrict(type):
def __new__(cls, clsname, bases, methods): ...
def __new__(cls: type[Self], clsname: str, bases: tuple[type, ...], methods: dict[str, Descriptor[Incomplete]]) -> Self: ...

class MetaSerialisable(type):
def __new__(cls, clsname, bases, methods): ...
def __new__(cls: type[Self], clsname: str, bases: tuple[type, ...], methods: dict[str, Descriptor[Incomplete]]) -> Self: ...

class Strict(metaclass=MetaStrict): ...
4 changes: 3 additions & 1 deletion stubs/openpyxl/openpyxl/descriptors/slots.pyi
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from _typeshed import Incomplete, Self

class AutoSlotProperties(type):
def __new__(mcl, classname, bases, dictionary): ...
def __new__(mcl: type[Self], classname: str, bases: tuple[type, ...], dictionary: dict[str, Incomplete]) -> Self: ...
29 changes: 15 additions & 14 deletions stubs/openpyxl/openpyxl/styles/cell_style.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from _typeshed import Incomplete, Unused
from array import array
from collections.abc import Iterable
from typing import ClassVar
from typing_extensions import Literal
from typing_extensions import Literal, Self

from openpyxl.descriptors import Strict
from openpyxl.descriptors.base import Bool, Integer, Typed, _ConvertibleToBool, _ConvertibleToInt
Expand All @@ -16,21 +17,21 @@ class ArrayDescriptor:
def __get__(self, instance: Serialisable | Strict, cls: Unused): ...
def __set__(self, instance: Serialisable | Strict, value) -> None: ...

class StyleArray(array[Incomplete]):
class StyleArray(array[int]):
tagname: ClassVar[str]
fontId: Incomplete
fillId: Incomplete
borderId: Incomplete
numFmtId: Incomplete
protectionId: Incomplete
alignmentId: Incomplete
pivotButton: Incomplete
quotePrefix: Incomplete
xfId: Incomplete
def __new__(cls, args=[0, 0, 0, 0, 0, 0, 0, 0, 0]): ...
fontId: ArrayDescriptor
fillId: ArrayDescriptor
borderId: ArrayDescriptor
numFmtId: ArrayDescriptor
protectionId: ArrayDescriptor
alignmentId: ArrayDescriptor
pivotButton: ArrayDescriptor
quotePrefix: ArrayDescriptor
xfId: ArrayDescriptor
def __new__(cls, args: bytes | bytearray | Iterable[int] = [0, 0, 0, 0, 0, 0, 0, 0, 0]) -> Self: ...
def __hash__(self) -> int: ...
def __copy__(self): ...
def __deepcopy__(self, memo): ...
def __copy__(self) -> StyleArray: ...
def __deepcopy__(self, memo: Unused) -> StyleArray: ...

class CellStyle(Serialisable):
tagname: ClassVar[str]
Expand Down

0 comments on commit 381fc57

Please sign in to comment.