Skip to content

Commit

Permalink
openpyxl: Class attributes set explicitly as another class' (#10549)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Aug 15, 2023
1 parent 6c7be1e commit 54193d5
Show file tree
Hide file tree
Showing 17 changed files with 328 additions and 273 deletions.
66 changes: 35 additions & 31 deletions stubs/openpyxl/openpyxl/cell/text.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ from _typeshed import Incomplete
from typing import ClassVar
from typing_extensions import Literal, TypeAlias

from openpyxl.descriptors.base import Alias, Integer, NoneSet, Typed, _ConvertibleToInt
from openpyxl.descriptors.nested import NestedString, NestedText
from openpyxl.descriptors.base import Alias, Integer, NoneSet, Typed, _ConvertibleToBool, _ConvertibleToFloat, _ConvertibleToInt
from openpyxl.descriptors.nested import NestedString, NestedText, _NestedNoneSetParam
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.styles.fonts import Font
from openpyxl.styles.colors import Color
from openpyxl.styles.fonts import Font, _FontScheme, _FontU, _FontVertAlign

from ..xml._functions_overloads import _HasTagAndGet

_PhoneticPropertiesType: TypeAlias = Literal["halfwidthKatakana", "fullwidthKatakana", "Hiragana", "noConversion"]
_PhoneticPropertiesAlignment: TypeAlias = Literal["noControl", "left", "center", "distributed"]
Expand Down Expand Up @@ -35,38 +38,39 @@ class PhoneticText(Serialisable):
class InlineFont(Font):
tagname: ClassVar[str]
rFont: NestedString[Literal[True]]
charset: Incomplete
family: Incomplete
b: Incomplete
i: Incomplete
strike: Incomplete
outline: Incomplete
shadow: Incomplete
condense: Incomplete
extend: Incomplete
color: Incomplete
sz: Incomplete
u: Incomplete
vertAlign: Incomplete
scheme: Incomplete
# Same as parent
# charset = Font.charset
# family = Font.family
# b = Font.b
# i = Font.i
# strike = Font.strike
# outline = Font.outline
# shadow = Font.shadow
# condense = Font.condense
# extend = Font.extend
# color = Font.color
# sz = Font.sz
# u = Font.u
# vertAlign = Font.vertAlign
# scheme = Font.scheme
__elements__: ClassVar[tuple[str, ...]]
def __init__(
self,
rFont: object = None,
charset: Incomplete | None = None,
family: Incomplete | None = None,
b: Incomplete | None = None,
i: Incomplete | None = None,
strike: Incomplete | None = None,
outline: Incomplete | None = None,
shadow: Incomplete | None = None,
condense: Incomplete | None = None,
extend: Incomplete | None = None,
color: Incomplete | None = None,
sz: Incomplete | None = None,
u: Incomplete | None = None,
vertAlign: Incomplete | None = None,
scheme: Incomplete | None = None,
charset: _HasTagAndGet[_ConvertibleToInt | None] | _ConvertibleToInt | None = None,
family: _HasTagAndGet[_ConvertibleToFloat | None] | _ConvertibleToFloat | None = None,
b: _HasTagAndGet[_ConvertibleToBool] | _ConvertibleToBool = None,
i: _HasTagAndGet[_ConvertibleToBool] | _ConvertibleToBool = None,
strike: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None,
outline: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None,
shadow: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None,
condense: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None,
extend: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None,
color: Color | None = None,
sz: _HasTagAndGet[_ConvertibleToFloat | None] | _ConvertibleToFloat | None = None,
u: _NestedNoneSetParam[_FontU] = None,
vertAlign: _NestedNoneSetParam[_FontVertAlign] = None,
scheme: _NestedNoneSetParam[_FontScheme] = None,
) -> None: ...

class RichText(Serialisable):
Expand Down
22 changes: 12 additions & 10 deletions stubs/openpyxl/openpyxl/chart/area_chart.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ class _AreaChartBase(ChartBase):

class AreaChart(_AreaChartBase):
tagname: ClassVar[str]
grouping: Incomplete
varyColors: Incomplete
ser: Incomplete
dLbls: Incomplete
dropLines: Incomplete
# Same as parent
# grouping = _AreaChartBase.grouping
# varyColors = _AreaChartBase.varyColors
# ser = _AreaChartBase.ser
# dLbls = _AreaChartBase.dLbls
# dropLines = _AreaChartBase.dropLines
x_axis: Typed[TextAxis, Literal[False]]
y_axis: Typed[NumericAxis, Literal[False]]
extLst: Typed[ExtensionList, Literal[True]]
Expand All @@ -45,11 +46,12 @@ class AreaChart(_AreaChartBase):

class AreaChart3D(AreaChart):
tagname: ClassVar[str]
grouping: Incomplete
varyColors: Incomplete
ser: Incomplete
dLbls: Incomplete
dropLines: Incomplete
# Same as parent and grandparent
# grouping = _AreaChartBase.grouping
# varyColors = _AreaChartBase.varyColors
# ser = _AreaChartBase.ser
# dLbls = _AreaChartBase.dLbls
# dropLines = _AreaChartBase.dropLines
gapDepth: Incomplete
x_axis: Typed[TextAxis, Literal[False]]
y_axis: Typed[NumericAxis, Literal[False]]
Expand Down
132 changes: 68 additions & 64 deletions stubs/openpyxl/openpyxl/chart/axis.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,23 @@ class DisplayUnitsLabelList(Serialisable):

class NumericAxis(_BaseAxis):
tagname: ClassVar[str]
axId: Incomplete
scaling: Incomplete
delete: Incomplete
axPos: Incomplete
majorGridlines: Incomplete
minorGridlines: Incomplete
title: Incomplete
numFmt: Incomplete
majorTickMark: Incomplete
minorTickMark: Incomplete
tickLblPos: Incomplete
spPr: Incomplete
txPr: Incomplete
crossAx: Incomplete
crosses: Incomplete
crossesAt: Incomplete
# Same as parent
# axId = _BaseAxis.axId
# scaling = _BaseAxis.scaling
# delete = _BaseAxis.delete
# axPos = _BaseAxis.axPos
# majorGridlines = _BaseAxis.majorGridlines
# minorGridlines = _BaseAxis.minorGridlines
# title = _BaseAxis.title
# numFmt = _BaseAxis.numFmt
# majorTickMark = _BaseAxis.majorTickMark
# minorTickMark = _BaseAxis.minorTickMark
# tickLblPos = _BaseAxis.tickLblPos
# spPr = _BaseAxis.spPr
# txPr = _BaseAxis.txPr
# crossAx = _BaseAxis.crossAx
# crosses = _BaseAxis.crosses
# crossesAt = _BaseAxis.crossesAt
crossBetween: NestedNoneSet[_NumericAxisCrossBetween]
majorUnit: NestedFloat[Literal[True]]
minorUnit: NestedFloat[Literal[True]]
Expand All @@ -201,22 +202,23 @@ class NumericAxis(_BaseAxis):

class TextAxis(_BaseAxis):
tagname: ClassVar[str]
axId: Incomplete
scaling: Incomplete
delete: Incomplete
axPos: Incomplete
majorGridlines: Incomplete
minorGridlines: Incomplete
title: Incomplete
numFmt: Incomplete
majorTickMark: Incomplete
minorTickMark: Incomplete
tickLblPos: Incomplete
spPr: Incomplete
txPr: Incomplete
crossAx: Incomplete
crosses: Incomplete
crossesAt: Incomplete
# Same as parent
# axId = _BaseAxis.axId
# scaling = _BaseAxis.scaling
# delete = _BaseAxis.delete
# axPos = _BaseAxis.axPos
# majorGridlines = _BaseAxis.majorGridlines
# minorGridlines = _BaseAxis.minorGridlines
# title = _BaseAxis.title
# numFmt = _BaseAxis.numFmt
# majorTickMark = _BaseAxis.majorTickMark
# minorTickMark = _BaseAxis.minorTickMark
# tickLblPos = _BaseAxis.tickLblPos
# spPr = _BaseAxis.spPr
# txPr = _BaseAxis.txPr
# crossAx = _BaseAxis.crossAx
# crosses = _BaseAxis.crosses
# crossesAt = _BaseAxis.crossesAt
auto: NestedBool[Literal[True]]
lblAlgn: NestedNoneSet[_TextAxisLblAlgn]
lblOffset: NestedMinMax[float, Literal[False]]
Expand All @@ -239,22 +241,23 @@ class TextAxis(_BaseAxis):

class DateAxis(TextAxis):
tagname: ClassVar[str]
axId: Incomplete
scaling: Incomplete
delete: Incomplete
axPos: Incomplete
majorGridlines: Incomplete
minorGridlines: Incomplete
title: Incomplete
numFmt: Incomplete
majorTickMark: Incomplete
minorTickMark: Incomplete
tickLblPos: Incomplete
spPr: Incomplete
txPr: Incomplete
crossAx: Incomplete
crosses: Incomplete
crossesAt: Incomplete
# Same as parent and grandparent
# axId = _BaseAxis.axId
# scaling = _BaseAxis.scaling
# delete = _BaseAxis.delete
# axPos = _BaseAxis.axPos
# majorGridlines = _BaseAxis.majorGridlines
# minorGridlines = _BaseAxis.minorGridlines
# title = _BaseAxis.title
# numFmt = _BaseAxis.numFmt
# majorTickMark = _BaseAxis.majorTickMark
# minorTickMark = _BaseAxis.minorTickMark
# tickLblPos = _BaseAxis.tickLblPos
# spPr = _BaseAxis.spPr
# txPr = _BaseAxis.txPr
# crossAx = _BaseAxis.crossAx
# crosses = _BaseAxis.crosses
# crossesAt = _BaseAxis.crossesAt
auto: NestedBool[Literal[True]]
lblOffset: NestedInteger[Literal[True]] # type: ignore[assignment]
baseTimeUnit: NestedNoneSet[_DateAxisTimeUnit]
Expand All @@ -279,22 +282,23 @@ class DateAxis(TextAxis):

class SeriesAxis(_BaseAxis):
tagname: ClassVar[str]
axId: Incomplete
scaling: Incomplete
delete: Incomplete
axPos: Incomplete
majorGridlines: Incomplete
minorGridlines: Incomplete
title: Incomplete
numFmt: Incomplete
majorTickMark: Incomplete
minorTickMark: Incomplete
tickLblPos: Incomplete
spPr: Incomplete
txPr: Incomplete
crossAx: Incomplete
crosses: Incomplete
crossesAt: Incomplete
# Same as parent
# axId = _BaseAxis.axId
# scaling = _BaseAxis.scaling
# delete = _BaseAxis.delete
# axPos = _BaseAxis.axPos
# majorGridlines = _BaseAxis.majorGridlines
# minorGridlines = _BaseAxis.minorGridlines
# title = _BaseAxis.title
# numFmt = _BaseAxis.numFmt
# majorTickMark = _BaseAxis.majorTickMark
# minorTickMark = _BaseAxis.minorTickMark
# tickLblPos = _BaseAxis.tickLblPos
# spPr = _BaseAxis.spPr
# txPr = _BaseAxis.txPr
# crossAx = _BaseAxis.crossAx
# crosses = _BaseAxis.crosses
# crossesAt = _BaseAxis.crossesAt
tickLblSkip: NestedInteger[Literal[True]]
tickMarkSkip: NestedInteger[Literal[True]]
extLst: Typed[ExtensionList, Literal[True]]
Expand Down
30 changes: 16 additions & 14 deletions stubs/openpyxl/openpyxl/chart/bar_chart.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ class _BarChartBase(ChartBase):

class BarChart(_BarChartBase):
tagname: ClassVar[str]
barDir: Incomplete
grouping: Incomplete
varyColors: Incomplete
ser: Incomplete
dLbls: Incomplete
# Same as parent
# barDir = _BarChartBase.barDir
# grouping = _BarChartBase.grouping
# varyColors = _BarChartBase.varyColors
# ser = _BarChartBase.ser
# dLbls = _BarChartBase.dLbls
gapWidth: Incomplete
overlap: Incomplete
serLines: Typed[ChartLines, Literal[True]]
Expand All @@ -61,15 +62,16 @@ class BarChart(_BarChartBase):

class BarChart3D(_BarChartBase, _3DBase):
tagname: ClassVar[str]
barDir: Incomplete
grouping: Incomplete
varyColors: Incomplete
ser: Incomplete
dLbls: Incomplete
view3D: Incomplete
floor: Incomplete
sideWall: Incomplete
backWall: Incomplete
# Same as parents
# barDir = _BarChartBase.barDir
# grouping = _BarChartBase.grouping
# varyColors = _BarChartBase.varyColors
# ser = _BarChartBase.ser
# dLbls = _BarChartBase.dLbls
# view3D = _3DBase.view3D
# floor = _3DBase.floor
# sideWall = _3DBase.sideWall
# backWall = _3DBase.backWall
gapWidth: Incomplete
gapDepth: Incomplete
shape: NestedNoneSet[_BarChart3DShape]
Expand Down
20 changes: 12 additions & 8 deletions stubs/openpyxl/openpyxl/chart/chartspace.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ from _typeshed import Incomplete, Unused
from typing import ClassVar, overload
from typing_extensions import Literal, TypeAlias

from openpyxl.chart._3d import Surface, View3D
from openpyxl.chart.legend import Legend
from openpyxl.chart.pivot import PivotSource
from openpyxl.chart.plotarea import PlotArea
Expand All @@ -24,10 +25,13 @@ class ChartContainer(Serialisable):
title: Typed[Title, Literal[True]]
autoTitleDeleted: NestedBool[Literal[True]]
pivotFmts: Incomplete
view3D: Incomplete
floor: Incomplete
sideWall: Incomplete
backWall: Incomplete

# Same as _3DBase
view3D: Typed[View3D, Literal[True]]
floor: Typed[Surface, Literal[True]]
sideWall: Typed[Surface, Literal[True]]
backWall: Typed[Surface, Literal[True]]

plotArea: Typed[PlotArea, Literal[False]]
legend: Typed[Legend, Literal[True]]
plotVisOnly: NestedBool[Literal[False]]
Expand All @@ -40,10 +44,10 @@ class ChartContainer(Serialisable):
title: Title | None = None,
autoTitleDeleted: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None,
pivotFmts=(),
view3D: Incomplete | None = None,
floor: Incomplete | None = None,
sideWall: Incomplete | None = None,
backWall: Incomplete | None = None,
view3D: View3D | None = None,
floor: Surface | None = None,
sideWall: Surface | None = None,
backWall: Surface | None = None,
plotArea: PlotArea | None = None,
legend: Legend | None = None,
plotVisOnly: _HasTagAndGet[_ConvertibleToBool] | _ConvertibleToBool = True,
Expand Down
Loading

0 comments on commit 54193d5

Please sign in to comment.