mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 08:47:39 +08:00
openpyxl: Various minor improvements / previous PR fixes (#10896)
This commit is contained in:
@@ -2,10 +2,11 @@ from _typeshed import ReadableBuffer
|
||||
from datetime import datetime
|
||||
from re import Pattern
|
||||
from typing import overload
|
||||
from typing_extensions import Final
|
||||
from typing_extensions import Final, Literal
|
||||
|
||||
from openpyxl.cell import _CellValue, _TimeTypes
|
||||
from openpyxl.comments.comments import Comment
|
||||
from openpyxl.compat.numbers import NUMERIC_TYPES as NUMERIC_TYPES # cell numeric types
|
||||
from openpyxl.styles.cell_style import StyleArray
|
||||
from openpyxl.styles.styleable import StyleableObject
|
||||
from openpyxl.worksheet.hyperlink import Hyperlink
|
||||
@@ -31,8 +32,8 @@ TYPE_FORMULA_CACHE_STRING: Final = "str"
|
||||
|
||||
VALID_TYPES: Final[tuple[str, ...]]
|
||||
|
||||
def get_type(t: type, value: object) -> str | None: ...
|
||||
def get_time_format(t: datetime) -> str: ...
|
||||
def get_type(t: type, value: object) -> Literal["n", "s", "d", "f", None]: ...
|
||||
def get_time_format(t: _TimeTypes) -> str: ...
|
||||
|
||||
class Cell(StyleableObject):
|
||||
row: int
|
||||
|
||||
@@ -7,7 +7,7 @@ from openpyxl.chart.text import RichText
|
||||
from openpyxl.descriptors.base import Alias, Typed, _ConvertibleToBool, _ConvertibleToInt
|
||||
from openpyxl.descriptors.excel import ExtensionList
|
||||
from openpyxl.descriptors.nested import NestedBool, NestedInteger, NestedNoneSet, NestedString, _NestedNoneSetParam
|
||||
from openpyxl.descriptors.serialisable import Serialisable as Serialisable
|
||||
from openpyxl.descriptors.serialisable import Serialisable
|
||||
|
||||
from ..xml._functions_overloads import _HasTagAndGet
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from typing import ClassVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
from openpyxl.descriptors.base import Bool, String, Typed, _ConvertibleToBool
|
||||
from openpyxl.descriptors.serialisable import Serialisable as Serialisable
|
||||
from openpyxl.descriptors.serialisable import Serialisable
|
||||
from openpyxl.styles.colors import Color
|
||||
|
||||
class ChartsheetProperties(Serialisable):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from _typeshed import Incomplete, Unused
|
||||
from collections.abc import Generator, Iterable
|
||||
from typing import Any, Protocol
|
||||
from typing_extensions import Self, TypeVar
|
||||
from typing import Any, Protocol, TypeVar
|
||||
from typing_extensions import Self
|
||||
|
||||
from openpyxl.descriptors import Strict
|
||||
from openpyxl.descriptors.serialisable import Serialisable, _SerialisableTreeElement
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Iterator
|
||||
from typing import ClassVar
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
from typing_extensions import Final, Literal, TypeAlias
|
||||
|
||||
from openpyxl.descriptors.base import Alias, Bool, Min, MinMax, NoneSet, _ConvertibleToBool, _ConvertibleToFloat
|
||||
from openpyxl.descriptors.serialisable import Serialisable
|
||||
@@ -11,8 +11,8 @@ _HorizontalAlignmentsType: TypeAlias = Literal[
|
||||
]
|
||||
_VerticalAlignmentsType: TypeAlias = Literal["top", "center", "bottom", "justify", "distributed"]
|
||||
|
||||
horizontal_alignments: tuple[_HorizontalAlignmentsType, ...]
|
||||
vertical_aligments: tuple[_VerticalAlignmentsType, ...]
|
||||
horizontal_alignments: Final[tuple[_HorizontalAlignmentsType, ...]]
|
||||
vertical_aligments: Final[tuple[_VerticalAlignmentsType, ...]]
|
||||
|
||||
class Alignment(Serialisable):
|
||||
tagname: ClassVar[str]
|
||||
|
||||
@@ -3,7 +3,7 @@ from collections.abc import Iterable, Iterator, Sequence as ABCSequence
|
||||
from typing import ClassVar
|
||||
from typing_extensions import Final, Literal, TypeAlias
|
||||
|
||||
from openpyxl.descriptors import Sequence
|
||||
from openpyxl.descriptors import Sequence, Strict
|
||||
from openpyxl.descriptors.base import Alias, Float, MinMax, NoneSet, Set, _ConvertibleToFloat
|
||||
from openpyxl.descriptors.serialisable import Serialisable
|
||||
from openpyxl.styles.colors import Color, ColorDescriptor
|
||||
@@ -32,7 +32,6 @@ FILL_PATTERN_MEDIUMGRAY: Final = "mediumGray"
|
||||
|
||||
_GradientFillType: TypeAlias = Literal["linear", "path"]
|
||||
_FillsType: TypeAlias = Literal[
|
||||
"none",
|
||||
"solid",
|
||||
"darkDown",
|
||||
"darkGray",
|
||||
@@ -52,7 +51,7 @@ _FillsType: TypeAlias = Literal[
|
||||
"lightVertical",
|
||||
"mediumGray",
|
||||
]
|
||||
fills: tuple[_FillsType, ...]
|
||||
fills: Final[tuple[_FillsType, ...]]
|
||||
|
||||
class Fill(Serialisable):
|
||||
tagname: ClassVar[str]
|
||||
@@ -90,7 +89,7 @@ class Stop(Serialisable):
|
||||
|
||||
class StopList(Sequence):
|
||||
expected_type: type[Incomplete]
|
||||
def __set__(self, obj, values) -> None: ...
|
||||
def __set__(self, obj: Serialisable | Strict, values) -> None: ...
|
||||
|
||||
class GradientFill(Fill):
|
||||
tagname: ClassVar[str]
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
from openpyxl.descriptors.base import Bool, _ConvertibleToBool
|
||||
from openpyxl.descriptors.serialisable import Serialisable
|
||||
|
||||
class Protection(Serialisable):
|
||||
tagname: ClassVar[str]
|
||||
locked: Incomplete
|
||||
hidden: Incomplete
|
||||
def __init__(self, locked: bool = True, hidden: bool = False) -> None: ...
|
||||
locked: Bool[Literal[False]]
|
||||
hidden: Bool[Literal[False]]
|
||||
def __init__(self, locked: _ConvertibleToBool = True, hidden: _ConvertibleToBool = False) -> None: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Container, Generator
|
||||
from datetime import datetime
|
||||
from typing_extensions import Final
|
||||
|
||||
from openpyxl.cell.rich_text import CellRichText
|
||||
@@ -45,7 +45,7 @@ def parse_richtext_string(element: _ChildSerialisableTreeElement) -> CellRichTex
|
||||
class WorkSheetParser:
|
||||
min_row: Incomplete | None
|
||||
min_col: Incomplete | None
|
||||
epoch: datetime.datetime
|
||||
epoch: datetime
|
||||
source: Incomplete
|
||||
shared_strings: Incomplete
|
||||
data_only: bool
|
||||
@@ -73,7 +73,7 @@ class WorkSheetParser:
|
||||
src,
|
||||
shared_strings,
|
||||
data_only: bool = False,
|
||||
epoch: datetime.datetime = ...,
|
||||
epoch: datetime = ...,
|
||||
date_formats: Container[Incomplete] = ...,
|
||||
timedelta_formats: Container[Incomplete] = ...,
|
||||
rich_text: bool = False,
|
||||
|
||||
Reference in New Issue
Block a user