Skip to content

Commit 2d5dafa

Browse files
authored
openpyxl: Type MetaSerialisable dunders (#10170)
Typed `Serialisable.__attrs__`, `Serialisable.__nested__`, `Serialisable.__elements__`, and `Serialisable.__namespaced__` ClassVars.
1 parent f7d7bb5 commit 2d5dafa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+370
-300
lines changed

stubs/openpyxl/openpyxl/cell/text.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from _typeshed import Incomplete
2+
from typing import ClassVar
23
from typing_extensions import Literal, TypeAlias
34

45
from openpyxl.descriptors.base import Alias, Integer, NoneSet, Typed, _ConvertibleToInt
@@ -47,7 +48,7 @@ class InlineFont(Font):
4748
u: Incomplete
4849
vertAlign: Incomplete
4950
scheme: Incomplete
50-
__elements__: Incomplete
51+
__elements__: ClassVar[tuple[str, ...]]
5152
def __init__(
5253
self,
5354
rFont: Incomplete | None = None,
@@ -73,7 +74,7 @@ class RichText(Serialisable):
7374
font: Alias
7475
t: Incomplete
7576
text: Alias
76-
__elements__: Incomplete
77+
__elements__: ClassVar[tuple[str, ...]]
7778
def __init__(self, rPr: InlineFont | None = None, t: Incomplete | None = None) -> None: ...
7879

7980
class Text(Serialisable):
@@ -86,7 +87,7 @@ class Text(Serialisable):
8687
phonetic: Alias
8788
phoneticPr: Typed[_PhoneticProperties, Literal[True]]
8889
PhoneticProperties: Alias
89-
__elements__: Incomplete
90+
__elements__: ClassVar[tuple[str, ...]]
9091
def __init__(self, t: Incomplete | None = None, r=(), rPh=(), phoneticPr: _PhoneticProperties | None = None) -> None: ...
9192
@property
9293
def content(self): ...

stubs/openpyxl/openpyxl/chart/_3d.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from _typeshed import Incomplete, Unused
2+
from typing import ClassVar
23
from typing_extensions import Literal
34

45
from openpyxl.chart.picture import PictureOptions
@@ -20,7 +21,7 @@ class View3D(Serialisable):
2021
right_angle_axes: Alias
2122
perspective: Incomplete
2223
extLst: Typed[ExtensionList, Literal[True]]
23-
__elements__: Incomplete
24+
__elements__: ClassVar[tuple[str, ...]]
2425
def __init__(
2526
self,
2627
rotX: int = 15,
@@ -39,7 +40,7 @@ class Surface(Serialisable):
3940
graphicalProperties: Alias
4041
pictureOptions: Typed[PictureOptions, Literal[True]]
4142
extLst: Typed[ExtensionList, Literal[True]]
42-
__elements__: Incomplete
43+
__elements__: ClassVar[tuple[str, ...]]
4344
def __init__(
4445
self,
4546
thickness: Incomplete | None = None,

stubs/openpyxl/openpyxl/chart/_chart.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import Incomplete, Unused
22
from abc import abstractmethod
3+
from typing import ClassVar
34
from typing_extensions import Literal, TypeAlias
45

56
from openpyxl.chart.layout import Layout
@@ -32,7 +33,7 @@ class ChartBase(Serialisable):
3233
style: MinMax[float, Literal[True]]
3334
mime_type: str
3435
graphical_properties: Typed[GraphicalProperties, Literal[True]]
35-
__elements__: Incomplete
36+
__elements__: ClassVar[tuple[str, ...]]
3637
plot_area: Incomplete
3738
pivotSource: Incomplete
3839
pivotFormats: Incomplete

stubs/openpyxl/openpyxl/chart/area_chart.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import Incomplete, Unused
22
from abc import abstractmethod
3+
from typing import ClassVar
34
from typing_extensions import Literal
45

56
from openpyxl.chart.axis import ChartLines, NumericAxis, SeriesAxis, TextAxis
@@ -16,7 +17,7 @@ class _AreaChartBase(ChartBase):
1617
dLbls: Typed[DataLabelList, Literal[True]]
1718
dataLabels: Alias
1819
dropLines: Typed[ChartLines, Literal[True]]
19-
__elements__: Incomplete
20+
__elements__: ClassVar[tuple[str, ...]]
2021
def __init__(
2122
self,
2223
grouping: str = "standard",
@@ -39,7 +40,7 @@ class AreaChart(_AreaChartBase):
3940
x_axis: Typed[TextAxis, Literal[False]]
4041
y_axis: Typed[NumericAxis, Literal[False]]
4142
extLst: Typed[ExtensionList, Literal[True]]
42-
__elements__: Incomplete
43+
__elements__: ClassVar[tuple[str, ...]]
4344
def __init__(self, axId: Unused = None, extLst: Unused = None, **kw) -> None: ...
4445

4546
class AreaChart3D(AreaChart):
@@ -53,5 +54,5 @@ class AreaChart3D(AreaChart):
5354
x_axis: Typed[TextAxis, Literal[False]]
5455
y_axis: Typed[NumericAxis, Literal[False]]
5556
z_axis: Typed[SeriesAxis, Literal[True]]
56-
__elements__: Incomplete
57+
__elements__: ClassVar[tuple[str, ...]]
5758
def __init__(self, gapDepth: Incomplete | None = None, **kw) -> None: ...

stubs/openpyxl/openpyxl/chart/axis.pyi

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import Incomplete, Unused
22
from abc import abstractmethod
3+
from typing import ClassVar
34
from typing_extensions import Literal
45

56
from openpyxl.chart.layout import Layout
@@ -22,7 +23,7 @@ class Scaling(Serialisable):
2223
max: Incomplete
2324
min: Incomplete
2425
extLst: Typed[ExtensionList, Literal[True]]
25-
__elements__: Incomplete
26+
__elements__: ClassVar[tuple[str, ...]]
2627
def __init__(
2728
self,
2829
logBase: Incomplete | None = None,
@@ -52,7 +53,7 @@ class _BaseAxis(Serialisable):
5253
crossAx: Incomplete
5354
crosses: Incomplete
5455
crossesAt: Incomplete
55-
__elements__: Incomplete
56+
__elements__: ClassVar[tuple[str, ...]]
5657
def __init__(
5758
self,
5859
axId: Incomplete | None = None,
@@ -85,7 +86,7 @@ class DisplayUnitsLabel(Serialisable):
8586
graphicalProperties: Alias
8687
txPr: Typed[RichText, Literal[True]]
8788
textPropertes: Alias
88-
__elements__: Incomplete
89+
__elements__: ClassVar[tuple[str, ...]]
8990
def __init__(
9091
self,
9192
layout: Layout | None = None,
@@ -100,7 +101,7 @@ class DisplayUnitsLabelList(Serialisable):
100101
builtInUnit: Incomplete
101102
dispUnitsLbl: Typed[DisplayUnitsLabel, Literal[True]]
102103
extLst: Typed[ExtensionList, Literal[True]]
103-
__elements__: Incomplete
104+
__elements__: ClassVar[tuple[str, ...]]
104105
def __init__(
105106
self,
106107
custUnit: Incomplete | None = None,
@@ -132,7 +133,7 @@ class NumericAxis(_BaseAxis):
132133
minorUnit: Incomplete
133134
dispUnits: Typed[DisplayUnitsLabelList, Literal[True]]
134135
extLst: Typed[ExtensionList, Literal[True]]
135-
__elements__: Incomplete
136+
__elements__: ClassVar[tuple[str, ...]]
136137
def __init__(
137138
self,
138139
crossBetween: Incomplete | None = None,
@@ -170,7 +171,7 @@ class TextAxis(_BaseAxis):
170171
tickMarkSkip: Incomplete
171172
noMultiLvlLbl: Incomplete
172173
extLst: Typed[ExtensionList, Literal[True]]
173-
__elements__: Incomplete
174+
__elements__: ClassVar[tuple[str, ...]]
174175
def __init__(
175176
self,
176177
auto: Incomplete | None = None,
@@ -209,7 +210,7 @@ class DateAxis(TextAxis):
209210
minorUnit: Incomplete
210211
minorTimeUnit: Incomplete
211212
extLst: Typed[ExtensionList, Literal[True]]
212-
__elements__: Incomplete
213+
__elements__: ClassVar[tuple[str, ...]]
213214
def __init__(
214215
self,
215216
auto: Incomplete | None = None,
@@ -244,7 +245,7 @@ class SeriesAxis(_BaseAxis):
244245
tickLblSkip: Incomplete
245246
tickMarkSkip: Incomplete
246247
extLst: Typed[ExtensionList, Literal[True]]
247-
__elements__: Incomplete
248+
__elements__: ClassVar[tuple[str, ...]]
248249
def __init__(
249250
self, tickLblSkip: Incomplete | None = None, tickMarkSkip: Incomplete | None = None, extLst: Unused = None, **kw
250251
) -> None: ...

stubs/openpyxl/openpyxl/chart/bar_chart.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import Incomplete, Unused
22
from abc import abstractmethod
3+
from typing import ClassVar
34
from typing_extensions import Literal
45

56
from openpyxl.chart.axis import ChartLines, NumericAxis, SeriesAxis, TextAxis
@@ -18,7 +19,7 @@ class _BarChartBase(ChartBase):
1819
ser: Incomplete
1920
dLbls: Typed[DataLabelList, Literal[True]]
2021
dataLabels: Alias
21-
__elements__: Incomplete
22+
__elements__: ClassVar[tuple[str, ...]]
2223
def __init__(
2324
self,
2425
barDir: str = "col",
@@ -45,7 +46,7 @@ class BarChart(_BarChartBase):
4546
extLst: Typed[ExtensionList, Literal[True]]
4647
x_axis: Typed[TextAxis, Literal[False]]
4748
y_axis: Typed[NumericAxis, Literal[False]]
48-
__elements__: Incomplete
49+
__elements__: ClassVar[tuple[str, ...]]
4950
legend: Incomplete
5051
def __init__(
5152
self,
@@ -75,7 +76,7 @@ class BarChart3D(_BarChartBase, _3DBase):
7576
x_axis: Typed[TextAxis, Literal[False]]
7677
y_axis: Typed[NumericAxis, Literal[False]]
7778
z_axis: Typed[SeriesAxis, Literal[True]]
78-
__elements__: Incomplete
79+
__elements__: ClassVar[tuple[str, ...]]
7980
def __init__(
8081
self,
8182
gapWidth: int = 150,

stubs/openpyxl/openpyxl/chart/bubble_chart.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from _typeshed import Incomplete, Unused
2+
from typing import ClassVar
23
from typing_extensions import Literal
34

45
from openpyxl.chart.axis import NumericAxis
@@ -21,7 +22,7 @@ class BubbleChart(ChartBase):
2122
extLst: Typed[ExtensionList, Literal[True]]
2223
x_axis: Typed[NumericAxis, Literal[False]]
2324
y_axis: Typed[NumericAxis, Literal[False]]
24-
__elements__: Incomplete
25+
__elements__: ClassVar[tuple[str, ...]]
2526
def __init__(
2627
self,
2728
varyColors: Incomplete | None = None,

stubs/openpyxl/openpyxl/chart/chartspace.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from _typeshed import Incomplete, Unused
2-
from typing import overload
2+
from typing import ClassVar, overload
33
from typing_extensions import Literal
44

55
from openpyxl.chart.legend import Legend
@@ -29,7 +29,7 @@ class ChartContainer(Serialisable):
2929
dispBlanksAs: Incomplete
3030
showDLblsOverMax: Incomplete
3131
extLst: Typed[ExtensionList, Literal[True]]
32-
__elements__: Incomplete
32+
__elements__: ClassVar[tuple[str, ...]]
3333
def __init__(
3434
self,
3535
title: Title | None = None,
@@ -54,7 +54,7 @@ class Protection(Serialisable):
5454
formatting: Incomplete
5555
selection: Incomplete
5656
userInterface: Incomplete
57-
__elements__: Incomplete
57+
__elements__: ClassVar[tuple[str, ...]]
5858
def __init__(
5959
self,
6060
chartObject: Incomplete | None = None,
@@ -91,7 +91,7 @@ class ChartSpace(Serialisable):
9191
printSettings: Typed[PrintSettings, Literal[True]]
9292
userShapes: Incomplete
9393
extLst: Typed[ExtensionList, Literal[True]]
94-
__elements__: Incomplete
94+
__elements__: ClassVar[tuple[str, ...]]
9595
@overload
9696
def __init__(
9797
self,

stubs/openpyxl/openpyxl/chart/data_source.pyi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from _typeshed import Incomplete, Unused
2-
from typing import NoReturn, overload
2+
from typing import ClassVar, NoReturn, overload
33
from typing_extensions import Literal
44

55
from openpyxl.descriptors import Strict
@@ -29,7 +29,7 @@ class NumData(Serialisable):
2929
ptCount: Incomplete
3030
pt: Incomplete
3131
extLst: Typed[ExtensionList, Literal[True]]
32-
__elements__: Incomplete
32+
__elements__: ClassVar[tuple[str, ...]]
3333
def __init__(
3434
self, formatCode: Incomplete | None = None, ptCount: Incomplete | None = None, pt=(), extLst: Unused = None
3535
) -> None: ...
@@ -39,7 +39,7 @@ class NumRef(Serialisable):
3939
ref: Alias
4040
numCache: Typed[NumData, Literal[True]]
4141
extLst: Typed[ExtensionList, Literal[True]]
42-
__elements__: Incomplete
42+
__elements__: ClassVar[tuple[str, ...]]
4343
def __init__(self, f: Incomplete | None = None, numCache: NumData | None = None, extLst: Unused = None) -> None: ...
4444

4545
class StrVal(Serialisable):
@@ -53,15 +53,15 @@ class StrData(Serialisable):
5353
ptCount: Incomplete
5454
pt: Incomplete
5555
extLst: Typed[ExtensionList, Literal[True]]
56-
__elements__: Incomplete
56+
__elements__: ClassVar[tuple[str, ...]]
5757
def __init__(self, ptCount: Incomplete | None = None, pt=(), extLst: Unused = None) -> None: ...
5858

5959
class StrRef(Serialisable):
6060
tagname: str
6161
f: Incomplete
6262
strCache: Typed[StrData, Literal[True]]
6363
extLst: Typed[ExtensionList, Literal[True]]
64-
__elements__: Incomplete
64+
__elements__: ClassVar[tuple[str, ...]]
6565
def __init__(self, f: Incomplete | None = None, strCache: StrData | None = None, extLst: Unused = None) -> None: ...
6666

6767
class NumDataSource(Serialisable):
@@ -72,23 +72,23 @@ class NumDataSource(Serialisable):
7272
class Level(Serialisable):
7373
tagname: str
7474
pt: Incomplete
75-
__elements__: Incomplete
75+
__elements__: ClassVar[tuple[str, ...]]
7676
def __init__(self, pt=()) -> None: ...
7777

7878
class MultiLevelStrData(Serialisable):
7979
tagname: str
8080
ptCount: Integer[Literal[True]]
8181
lvl: Incomplete
8282
extLst: Typed[ExtensionList, Literal[True]]
83-
__elements__: Incomplete
83+
__elements__: ClassVar[tuple[str, ...]]
8484
def __init__(self, ptCount: _ConvertibleToInt | None = None, lvl=(), extLst: Unused = None) -> None: ...
8585

8686
class MultiLevelStrRef(Serialisable):
8787
tagname: str
8888
f: Incomplete
8989
multiLvlStrCache: Typed[MultiLevelStrData, Literal[True]]
9090
extLst: Typed[ExtensionList, Literal[True]]
91-
__elements__: Incomplete
91+
__elements__: ClassVar[tuple[str, ...]]
9292
def __init__(
9393
self, f: Incomplete | None = None, multiLvlStrCache: MultiLevelStrData | None = None, extLst: Unused = None
9494
) -> None: ...

stubs/openpyxl/openpyxl/chart/error_bar.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from _typeshed import Incomplete, Unused
2+
from typing import ClassVar
23
from typing_extensions import Literal
34

45
from openpyxl.chart.data_source import NumDataSource
@@ -22,7 +23,7 @@ class ErrorBars(Serialisable):
2223
spPr: Typed[GraphicalProperties, Literal[True]]
2324
graphicalProperties: Alias
2425
extLst: Typed[ExtensionList, Literal[True]]
25-
__elements__: Incomplete
26+
__elements__: ClassVar[tuple[str, ...]]
2627
def __init__(
2728
self,
2829
errDir: Incomplete | None = None,

stubs/openpyxl/openpyxl/chart/label.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import Incomplete, Unused
22
from abc import abstractmethod
3+
from typing import ClassVar
34
from typing_extensions import Literal
45

56
from openpyxl.chart.shapes import GraphicalProperties
@@ -25,7 +26,7 @@ class _DataLabelBase(Serialisable):
2526
showLeaderLines: Incomplete
2627
separator: Incomplete
2728
extLst: Typed[ExtensionList, Literal[True]]
28-
__elements__: Incomplete
29+
__elements__: ClassVar[tuple[str, ...]]
2930
def __init__(
3031
self,
3132
numFmt: Incomplete | None = None,
@@ -62,7 +63,7 @@ class DataLabel(_DataLabelBase):
6263
showLeaderLines: Incomplete
6364
separator: Incomplete
6465
extLst: Incomplete
65-
__elements__: Incomplete
66+
__elements__: ClassVar[tuple[str, ...]]
6667
def __init__(self, idx: int = 0, **kw) -> None: ...
6768

6869
class DataLabelList(_DataLabelBase):
@@ -82,5 +83,5 @@ class DataLabelList(_DataLabelBase):
8283
showLeaderLines: Incomplete
8384
separator: Incomplete
8485
extLst: Incomplete
85-
__elements__: Incomplete
86+
__elements__: ClassVar[tuple[str, ...]]
8687
def __init__(self, dLbl=(), delete: Incomplete | None = None, **kw) -> None: ...

0 commit comments

Comments
 (0)