Skip to content

Commit 54193d5

Browse files
authored
openpyxl: Class attributes set explicitly as another class' (#10549)
1 parent 6c7be1e commit 54193d5

File tree

17 files changed

+328
-273
lines changed

17 files changed

+328
-273
lines changed

stubs/openpyxl/openpyxl/cell/text.pyi

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ from _typeshed import Incomplete
22
from typing import ClassVar
33
from typing_extensions import Literal, TypeAlias
44

5-
from openpyxl.descriptors.base import Alias, Integer, NoneSet, Typed, _ConvertibleToInt
6-
from openpyxl.descriptors.nested import NestedString, NestedText
5+
from openpyxl.descriptors.base import Alias, Integer, NoneSet, Typed, _ConvertibleToBool, _ConvertibleToFloat, _ConvertibleToInt
6+
from openpyxl.descriptors.nested import NestedString, NestedText, _NestedNoneSetParam
77
from openpyxl.descriptors.serialisable import Serialisable
8-
from openpyxl.styles.fonts import Font
8+
from openpyxl.styles.colors import Color
9+
from openpyxl.styles.fonts import Font, _FontScheme, _FontU, _FontVertAlign
10+
11+
from ..xml._functions_overloads import _HasTagAndGet
912

1013
_PhoneticPropertiesType: TypeAlias = Literal["halfwidthKatakana", "fullwidthKatakana", "Hiragana", "noConversion"]
1114
_PhoneticPropertiesAlignment: TypeAlias = Literal["noControl", "left", "center", "distributed"]
@@ -35,38 +38,39 @@ class PhoneticText(Serialisable):
3538
class InlineFont(Font):
3639
tagname: ClassVar[str]
3740
rFont: NestedString[Literal[True]]
38-
charset: Incomplete
39-
family: Incomplete
40-
b: Incomplete
41-
i: Incomplete
42-
strike: Incomplete
43-
outline: Incomplete
44-
shadow: Incomplete
45-
condense: Incomplete
46-
extend: Incomplete
47-
color: Incomplete
48-
sz: Incomplete
49-
u: Incomplete
50-
vertAlign: Incomplete
51-
scheme: Incomplete
41+
# Same as parent
42+
# charset = Font.charset
43+
# family = Font.family
44+
# b = Font.b
45+
# i = Font.i
46+
# strike = Font.strike
47+
# outline = Font.outline
48+
# shadow = Font.shadow
49+
# condense = Font.condense
50+
# extend = Font.extend
51+
# color = Font.color
52+
# sz = Font.sz
53+
# u = Font.u
54+
# vertAlign = Font.vertAlign
55+
# scheme = Font.scheme
5256
__elements__: ClassVar[tuple[str, ...]]
5357
def __init__(
5458
self,
5559
rFont: object = None,
56-
charset: Incomplete | None = None,
57-
family: Incomplete | None = None,
58-
b: Incomplete | None = None,
59-
i: Incomplete | None = None,
60-
strike: Incomplete | None = None,
61-
outline: Incomplete | None = None,
62-
shadow: Incomplete | None = None,
63-
condense: Incomplete | None = None,
64-
extend: Incomplete | None = None,
65-
color: Incomplete | None = None,
66-
sz: Incomplete | None = None,
67-
u: Incomplete | None = None,
68-
vertAlign: Incomplete | None = None,
69-
scheme: Incomplete | None = None,
60+
charset: _HasTagAndGet[_ConvertibleToInt | None] | _ConvertibleToInt | None = None,
61+
family: _HasTagAndGet[_ConvertibleToFloat | None] | _ConvertibleToFloat | None = None,
62+
b: _HasTagAndGet[_ConvertibleToBool] | _ConvertibleToBool = None,
63+
i: _HasTagAndGet[_ConvertibleToBool] | _ConvertibleToBool = None,
64+
strike: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None,
65+
outline: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None,
66+
shadow: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None,
67+
condense: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None,
68+
extend: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None,
69+
color: Color | None = None,
70+
sz: _HasTagAndGet[_ConvertibleToFloat | None] | _ConvertibleToFloat | None = None,
71+
u: _NestedNoneSetParam[_FontU] = None,
72+
vertAlign: _NestedNoneSetParam[_FontVertAlign] = None,
73+
scheme: _NestedNoneSetParam[_FontScheme] = None,
7074
) -> None: ...
7175

7276
class RichText(Serialisable):

stubs/openpyxl/openpyxl/chart/area_chart.pyi

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ class _AreaChartBase(ChartBase):
3232

3333
class AreaChart(_AreaChartBase):
3434
tagname: ClassVar[str]
35-
grouping: Incomplete
36-
varyColors: Incomplete
37-
ser: Incomplete
38-
dLbls: Incomplete
39-
dropLines: Incomplete
35+
# Same as parent
36+
# grouping = _AreaChartBase.grouping
37+
# varyColors = _AreaChartBase.varyColors
38+
# ser = _AreaChartBase.ser
39+
# dLbls = _AreaChartBase.dLbls
40+
# dropLines = _AreaChartBase.dropLines
4041
x_axis: Typed[TextAxis, Literal[False]]
4142
y_axis: Typed[NumericAxis, Literal[False]]
4243
extLst: Typed[ExtensionList, Literal[True]]
@@ -45,11 +46,12 @@ class AreaChart(_AreaChartBase):
4546

4647
class AreaChart3D(AreaChart):
4748
tagname: ClassVar[str]
48-
grouping: Incomplete
49-
varyColors: Incomplete
50-
ser: Incomplete
51-
dLbls: Incomplete
52-
dropLines: Incomplete
49+
# Same as parent and grandparent
50+
# grouping = _AreaChartBase.grouping
51+
# varyColors = _AreaChartBase.varyColors
52+
# ser = _AreaChartBase.ser
53+
# dLbls = _AreaChartBase.dLbls
54+
# dropLines = _AreaChartBase.dropLines
5355
gapDepth: Incomplete
5456
x_axis: Typed[TextAxis, Literal[False]]
5557
y_axis: Typed[NumericAxis, Literal[False]]

stubs/openpyxl/openpyxl/chart/axis.pyi

Lines changed: 68 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -165,22 +165,23 @@ class DisplayUnitsLabelList(Serialisable):
165165

166166
class NumericAxis(_BaseAxis):
167167
tagname: ClassVar[str]
168-
axId: Incomplete
169-
scaling: Incomplete
170-
delete: Incomplete
171-
axPos: Incomplete
172-
majorGridlines: Incomplete
173-
minorGridlines: Incomplete
174-
title: Incomplete
175-
numFmt: Incomplete
176-
majorTickMark: Incomplete
177-
minorTickMark: Incomplete
178-
tickLblPos: Incomplete
179-
spPr: Incomplete
180-
txPr: Incomplete
181-
crossAx: Incomplete
182-
crosses: Incomplete
183-
crossesAt: Incomplete
168+
# Same as parent
169+
# axId = _BaseAxis.axId
170+
# scaling = _BaseAxis.scaling
171+
# delete = _BaseAxis.delete
172+
# axPos = _BaseAxis.axPos
173+
# majorGridlines = _BaseAxis.majorGridlines
174+
# minorGridlines = _BaseAxis.minorGridlines
175+
# title = _BaseAxis.title
176+
# numFmt = _BaseAxis.numFmt
177+
# majorTickMark = _BaseAxis.majorTickMark
178+
# minorTickMark = _BaseAxis.minorTickMark
179+
# tickLblPos = _BaseAxis.tickLblPos
180+
# spPr = _BaseAxis.spPr
181+
# txPr = _BaseAxis.txPr
182+
# crossAx = _BaseAxis.crossAx
183+
# crosses = _BaseAxis.crosses
184+
# crossesAt = _BaseAxis.crossesAt
184185
crossBetween: NestedNoneSet[_NumericAxisCrossBetween]
185186
majorUnit: NestedFloat[Literal[True]]
186187
minorUnit: NestedFloat[Literal[True]]
@@ -201,22 +202,23 @@ class NumericAxis(_BaseAxis):
201202

202203
class TextAxis(_BaseAxis):
203204
tagname: ClassVar[str]
204-
axId: Incomplete
205-
scaling: Incomplete
206-
delete: Incomplete
207-
axPos: Incomplete
208-
majorGridlines: Incomplete
209-
minorGridlines: Incomplete
210-
title: Incomplete
211-
numFmt: Incomplete
212-
majorTickMark: Incomplete
213-
minorTickMark: Incomplete
214-
tickLblPos: Incomplete
215-
spPr: Incomplete
216-
txPr: Incomplete
217-
crossAx: Incomplete
218-
crosses: Incomplete
219-
crossesAt: Incomplete
205+
# Same as parent
206+
# axId = _BaseAxis.axId
207+
# scaling = _BaseAxis.scaling
208+
# delete = _BaseAxis.delete
209+
# axPos = _BaseAxis.axPos
210+
# majorGridlines = _BaseAxis.majorGridlines
211+
# minorGridlines = _BaseAxis.minorGridlines
212+
# title = _BaseAxis.title
213+
# numFmt = _BaseAxis.numFmt
214+
# majorTickMark = _BaseAxis.majorTickMark
215+
# minorTickMark = _BaseAxis.minorTickMark
216+
# tickLblPos = _BaseAxis.tickLblPos
217+
# spPr = _BaseAxis.spPr
218+
# txPr = _BaseAxis.txPr
219+
# crossAx = _BaseAxis.crossAx
220+
# crosses = _BaseAxis.crosses
221+
# crossesAt = _BaseAxis.crossesAt
220222
auto: NestedBool[Literal[True]]
221223
lblAlgn: NestedNoneSet[_TextAxisLblAlgn]
222224
lblOffset: NestedMinMax[float, Literal[False]]
@@ -239,22 +241,23 @@ class TextAxis(_BaseAxis):
239241

240242
class DateAxis(TextAxis):
241243
tagname: ClassVar[str]
242-
axId: Incomplete
243-
scaling: Incomplete
244-
delete: Incomplete
245-
axPos: Incomplete
246-
majorGridlines: Incomplete
247-
minorGridlines: Incomplete
248-
title: Incomplete
249-
numFmt: Incomplete
250-
majorTickMark: Incomplete
251-
minorTickMark: Incomplete
252-
tickLblPos: Incomplete
253-
spPr: Incomplete
254-
txPr: Incomplete
255-
crossAx: Incomplete
256-
crosses: Incomplete
257-
crossesAt: Incomplete
244+
# Same as parent and grandparent
245+
# axId = _BaseAxis.axId
246+
# scaling = _BaseAxis.scaling
247+
# delete = _BaseAxis.delete
248+
# axPos = _BaseAxis.axPos
249+
# majorGridlines = _BaseAxis.majorGridlines
250+
# minorGridlines = _BaseAxis.minorGridlines
251+
# title = _BaseAxis.title
252+
# numFmt = _BaseAxis.numFmt
253+
# majorTickMark = _BaseAxis.majorTickMark
254+
# minorTickMark = _BaseAxis.minorTickMark
255+
# tickLblPos = _BaseAxis.tickLblPos
256+
# spPr = _BaseAxis.spPr
257+
# txPr = _BaseAxis.txPr
258+
# crossAx = _BaseAxis.crossAx
259+
# crosses = _BaseAxis.crosses
260+
# crossesAt = _BaseAxis.crossesAt
258261
auto: NestedBool[Literal[True]]
259262
lblOffset: NestedInteger[Literal[True]] # type: ignore[assignment]
260263
baseTimeUnit: NestedNoneSet[_DateAxisTimeUnit]
@@ -279,22 +282,23 @@ class DateAxis(TextAxis):
279282

280283
class SeriesAxis(_BaseAxis):
281284
tagname: ClassVar[str]
282-
axId: Incomplete
283-
scaling: Incomplete
284-
delete: Incomplete
285-
axPos: Incomplete
286-
majorGridlines: Incomplete
287-
minorGridlines: Incomplete
288-
title: Incomplete
289-
numFmt: Incomplete
290-
majorTickMark: Incomplete
291-
minorTickMark: Incomplete
292-
tickLblPos: Incomplete
293-
spPr: Incomplete
294-
txPr: Incomplete
295-
crossAx: Incomplete
296-
crosses: Incomplete
297-
crossesAt: Incomplete
285+
# Same as parent
286+
# axId = _BaseAxis.axId
287+
# scaling = _BaseAxis.scaling
288+
# delete = _BaseAxis.delete
289+
# axPos = _BaseAxis.axPos
290+
# majorGridlines = _BaseAxis.majorGridlines
291+
# minorGridlines = _BaseAxis.minorGridlines
292+
# title = _BaseAxis.title
293+
# numFmt = _BaseAxis.numFmt
294+
# majorTickMark = _BaseAxis.majorTickMark
295+
# minorTickMark = _BaseAxis.minorTickMark
296+
# tickLblPos = _BaseAxis.tickLblPos
297+
# spPr = _BaseAxis.spPr
298+
# txPr = _BaseAxis.txPr
299+
# crossAx = _BaseAxis.crossAx
300+
# crosses = _BaseAxis.crosses
301+
# crossesAt = _BaseAxis.crossesAt
298302
tickLblSkip: NestedInteger[Literal[True]]
299303
tickMarkSkip: NestedInteger[Literal[True]]
300304
extLst: Typed[ExtensionList, Literal[True]]

stubs/openpyxl/openpyxl/chart/bar_chart.pyi

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ class _BarChartBase(ChartBase):
3737

3838
class BarChart(_BarChartBase):
3939
tagname: ClassVar[str]
40-
barDir: Incomplete
41-
grouping: Incomplete
42-
varyColors: Incomplete
43-
ser: Incomplete
44-
dLbls: Incomplete
40+
# Same as parent
41+
# barDir = _BarChartBase.barDir
42+
# grouping = _BarChartBase.grouping
43+
# varyColors = _BarChartBase.varyColors
44+
# ser = _BarChartBase.ser
45+
# dLbls = _BarChartBase.dLbls
4546
gapWidth: Incomplete
4647
overlap: Incomplete
4748
serLines: Typed[ChartLines, Literal[True]]
@@ -61,15 +62,16 @@ class BarChart(_BarChartBase):
6162

6263
class BarChart3D(_BarChartBase, _3DBase):
6364
tagname: ClassVar[str]
64-
barDir: Incomplete
65-
grouping: Incomplete
66-
varyColors: Incomplete
67-
ser: Incomplete
68-
dLbls: Incomplete
69-
view3D: Incomplete
70-
floor: Incomplete
71-
sideWall: Incomplete
72-
backWall: Incomplete
65+
# Same as parents
66+
# barDir = _BarChartBase.barDir
67+
# grouping = _BarChartBase.grouping
68+
# varyColors = _BarChartBase.varyColors
69+
# ser = _BarChartBase.ser
70+
# dLbls = _BarChartBase.dLbls
71+
# view3D = _3DBase.view3D
72+
# floor = _3DBase.floor
73+
# sideWall = _3DBase.sideWall
74+
# backWall = _3DBase.backWall
7375
gapWidth: Incomplete
7476
gapDepth: Incomplete
7577
shape: NestedNoneSet[_BarChart3DShape]

stubs/openpyxl/openpyxl/chart/chartspace.pyi

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ from _typeshed import Incomplete, Unused
22
from typing import ClassVar, overload
33
from typing_extensions import Literal, TypeAlias
44

5+
from openpyxl.chart._3d import Surface, View3D
56
from openpyxl.chart.legend import Legend
67
from openpyxl.chart.pivot import PivotSource
78
from openpyxl.chart.plotarea import PlotArea
@@ -24,10 +25,13 @@ class ChartContainer(Serialisable):
2425
title: Typed[Title, Literal[True]]
2526
autoTitleDeleted: NestedBool[Literal[True]]
2627
pivotFmts: Incomplete
27-
view3D: Incomplete
28-
floor: Incomplete
29-
sideWall: Incomplete
30-
backWall: Incomplete
28+
29+
# Same as _3DBase
30+
view3D: Typed[View3D, Literal[True]]
31+
floor: Typed[Surface, Literal[True]]
32+
sideWall: Typed[Surface, Literal[True]]
33+
backWall: Typed[Surface, Literal[True]]
34+
3135
plotArea: Typed[PlotArea, Literal[False]]
3236
legend: Typed[Legend, Literal[True]]
3337
plotVisOnly: NestedBool[Literal[False]]
@@ -40,10 +44,10 @@ class ChartContainer(Serialisable):
4044
title: Title | None = None,
4145
autoTitleDeleted: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None,
4246
pivotFmts=(),
43-
view3D: Incomplete | None = None,
44-
floor: Incomplete | None = None,
45-
sideWall: Incomplete | None = None,
46-
backWall: Incomplete | None = None,
47+
view3D: View3D | None = None,
48+
floor: Surface | None = None,
49+
sideWall: Surface | None = None,
50+
backWall: Surface | None = None,
4751
plotArea: PlotArea | None = None,
4852
legend: Legend | None = None,
4953
plotVisOnly: _HasTagAndGet[_ConvertibleToBool] | _ConvertibleToBool = True,

0 commit comments

Comments
 (0)