Skip to content

Commit 3446575

Browse files
committed
fix: Fix docstrings for OptioanlAttribute
- chore: Replace raw default value with class member, where possible Signed-off-by: Avishrant Sharma <[email protected]>
1 parent 0c5ab81 commit 3446575

File tree

8 files changed

+37
-28
lines changed

8 files changed

+37
-28
lines changed

pptx-stubs/opc/oxml.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class CT_Relationship(BaseOxmlElement):
6969
def target_ref(self, value: str) -> None: ...
7070
@property
7171
def targetMode(self) -> str:
72-
"""ST_TargetMode type-converted value of ``TargetMode`` attribute, or |INTERNAL|. Assigning the default value causes the attribute to be removed from the element."""
72+
"""ST_TargetMode type-converted value of ``TargetMode`` attribute, or |RELATIONSHIP_TARGET_MODE.INTERNAL| if not present. Assigning the default value causes the attribute to be removed from the element."""
7373
...
7474

7575
@targetMode.setter

pptx-stubs/oxml/chart/axis.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ class CT_DateAx(BaseAxisElement):
290290
class CT_LblOffset(BaseOxmlElement):
291291
@property
292292
def val(self) -> int:
293-
"""ST_LblOffset type-converted value of ``val`` attribute, or |100|. Assigning the default value causes the attribute to be removed from the element."""
293+
"""ST_LblOffset type-converted value of ``val`` attribute, or |100| if not present. Assigning the default value causes the attribute to be removed from the element."""
294294
...
295295

296296
@val.setter
@@ -299,7 +299,7 @@ class CT_LblOffset(BaseOxmlElement):
299299
class CT_Orientation(BaseOxmlElement):
300300
@property
301301
def val(self) -> str:
302-
"""ST_Orientation type-converted value of ``val`` attribute, or |minMax|. Assigning the default value causes the attribute to be removed from the element."""
302+
"""ST_Orientation type-converted value of ``val`` attribute, or |ST_Orientation.MIN_MAX| if not present. Assigning the default value causes the attribute to be removed from the element."""
303303
...
304304

305305
@val.setter
@@ -350,7 +350,7 @@ class CT_Scaling(BaseOxmlElement):
350350
class CT_TickLblPos(BaseOxmlElement):
351351
@property
352352
def val(self) -> XL_TICK_LABEL_POSITION | None:
353-
"""XL_TICK_LABEL_POSITION type-converted value of ``val`` attribute, or |None|. Assigning the default value causes the attribute to be removed from the element."""
353+
"""XL_TICK_LABEL_POSITION type-converted value of ``val`` attribute, or |None| if not present. Assigning the default value causes the attribute to be removed from the element."""
354354
...
355355

356356
@val.setter
@@ -359,7 +359,7 @@ class CT_TickLblPos(BaseOxmlElement):
359359
class CT_TickMark(BaseOxmlElement):
360360
@property
361361
def val(self) -> XL_TICK_MARK:
362-
"""XL_TICK_MARK type-converted value of ``val`` attribute, or |XL_TICK_MARK.CROSS|. Assigning the default value causes the attribute to be removed from the element."""
362+
"""XL_TICK_MARK type-converted value of ``val`` attribute, or |XL_TICK_MARK.CROSS| if not present. Assigning the default value causes the attribute to be removed from the element."""
363363
...
364364

365365
@val.setter

pptx-stubs/oxml/chart/legend.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class CT_Legend(BaseOxmlElement):
5050
class CT_LegendPos(BaseOxmlElement):
5151
@property
5252
def val(self) -> XL_LEGEND_POSITION:
53-
"""XL_LEGEND_POSITION type-converted value of ``val`` attribute, or |XL_LEGEND_POSITION.RIGHT|. Assigning the default value causes the attribute to be removed from the element."""
53+
"""XL_LEGEND_POSITION type-converted value of ``val`` attribute, or |XL_LEGEND_POSITION.RIGHT| if not present. Assigning the default value causes the attribute to be removed from the element."""
5454
...
5555

5656
@val.setter

pptx-stubs/oxml/chart/plot.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class CT_BarChart(BaseChartElement):
124124
class CT_BarDir(BaseOxmlElement):
125125
@property
126126
def val(self) -> str:
127-
"""ST_BarDir type-converted value of ``val`` attribute, or |col|. Assigning the default value causes the attribute to be removed from the element."""
127+
"""ST_BarDir type-converted value of ``val`` attribute, or |ST_BarDir.COL| if not present. Assigning the default value causes the attribute to be removed from the element."""
128128
...
129129

130130
@val.setter
@@ -166,7 +166,7 @@ class CT_BubbleChart(BaseChartElement):
166166
class CT_BubbleScale(BaseChartElement):
167167
@property
168168
def val(self) -> int:
169-
"""ST_BubbleScale type-converted value of ``val`` attribute, or |100|. Assigning the default value causes the attribute to be removed from the element."""
169+
"""ST_BubbleScale type-converted value of ``val`` attribute, or |100| if not present. Assigning the default value causes the attribute to be removed from the element."""
170170
...
171171

172172
@val.setter
@@ -199,7 +199,7 @@ class CT_DoughnutChart(BaseChartElement):
199199
class CT_GapAmount(BaseOxmlElement):
200200
@property
201201
def val(self) -> int:
202-
"""ST_GapAmount type-converted value of ``val`` attribute, or |150|. Assigning the default value causes the attribute to be removed from the element."""
202+
"""ST_GapAmount type-converted value of ``val`` attribute, or |150| if not present. Assigning the default value causes the attribute to be removed from the element."""
203203
...
204204

205205
@val.setter
@@ -250,7 +250,7 @@ class CT_LineChart(BaseChartElement):
250250
class CT_Overlap(BaseOxmlElement):
251251
@property
252252
def val(self) -> int:
253-
"""ST_Overlap type-converted value of ``val`` attribute, or |0|. Assigning the default value causes the attribute to be removed from the element."""
253+
"""ST_Overlap type-converted value of ``val`` attribute, or |0| if not present. Assigning the default value causes the attribute to be removed from the element."""
254254
...
255255

256256
@val.setter

pptx-stubs/oxml/chart/series.pyi

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from lxml.etree import _Element
12
from pptx.oxml.chart.datalabel import CT_DLbl, CT_DLbls
23
from pptx.oxml.chart.marker import CT_Marker
34
from pptx.oxml.chart.shared import CT_Boolean, CT_Boolean_Explicit, CT_Tx, CT_UnsignedInt
@@ -6,8 +7,12 @@ from pptx.oxml.xmlchemy import BaseOxmlElement
67

78
class CT_AxDataSource(BaseOxmlElement):
89
@property
9-
def multiLvlStrRef(self) -> BaseOxmlElement | None: ...
10-
def get_or_add_multiLvlStrRef(self) -> BaseOxmlElement: ...
10+
def multiLvlStrRef(self) -> _Element | None:
11+
"""``<c:multiLvlStrRef>`` child element or |None| if not present."""
12+
...
13+
def get_or_add_multiLvlStrRef(self) -> _Element:
14+
"""Return the ``<c:multiLvlStrRef>`` child element, newly added if not present."""
15+
...
1116
@property
1217
def lvls(self) -> list[CT_Lvl]: ...
1318

@@ -46,7 +51,10 @@ class CT_Lvl(BaseOxmlElement):
4651

4752
class CT_NumDataSource(BaseOxmlElement):
4853
@property
49-
def numRef(self) -> BaseOxmlElement: ...
54+
def numRef(self) -> _Element:
55+
"""Required ``<c:numRef>`` child element."""
56+
...
57+
5058
@property
5159
def ptCount_val(self) -> int: ...
5260
def pt_v(self, idx: int) -> float | None: ...
@@ -180,7 +188,7 @@ class CT_SeriesComposite(BaseOxmlElement):
180188

181189
class CT_StrVal_NumVal_Composite(BaseOxmlElement):
182190
@property
183-
def v(self) -> BaseOxmlElement:
191+
def v(self) -> _Element:
184192
"""Required ``<c:v>`` child element."""
185193
...
186194

pptx-stubs/oxml/chart/shared.pyi

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
from lxml.etree import _Element
12
from pptx.oxml.shapes.shared import CT_ShapeProperties
23
from pptx.oxml.text import CT_TextBody
34
from pptx.oxml.xmlchemy import BaseOxmlElement
45

56
class CT_Boolean(BaseOxmlElement):
67
@property
78
def val(self) -> bool:
8-
"""XsdBoolean type-converted value of ``val`` attribute, or |True|. Assigning the default value causes the attribute to be removed from the element."""
9+
"""XsdBoolean type-converted value of ``val`` attribute, or |True| if not present. Assigning the default value causes the attribute to be removed from the element."""
910
...
1011

1112
@val.setter
@@ -14,7 +15,7 @@ class CT_Boolean(BaseOxmlElement):
1415
class CT_Boolean_Explicit(BaseOxmlElement):
1516
@property
1617
def _val(self) -> bool:
17-
"""XsdBoolean type-converted value of ``val`` attribute, or |True|. Assigning the default value causes the attribute to be removed from the element."""
18+
"""XsdBoolean type-converted value of ``val`` attribute, or |True| if not present. Assigning the default value causes the attribute to be removed from the element."""
1819
...
1920

2021
@_val.setter
@@ -51,7 +52,7 @@ class CT_Layout(BaseOxmlElement):
5152
class CT_LayoutMode(BaseOxmlElement):
5253
@property
5354
def val(self) -> str:
54-
"""ST_LayoutMode type-converted value of ``val`` attribute, or |factor|. Assigning the default value causes the attribute to be removed from the element."""
55+
"""ST_LayoutMode type-converted value of ``val`` attribute, or |ST_LayoutMode.FACTOR| if not present. Assigning the default value causes the attribute to be removed from the element."""
5556
...
5657

5758
@val.setter
@@ -91,7 +92,7 @@ class CT_NumFmt(BaseOxmlElement):
9192
def formatCode(self, value: str) -> None: ...
9293
@property
9394
def sourceLinked(self) -> bool | None:
94-
"""XsdBoolean type-converted value of ``sourceLinked`` attribute, or |None|. Assigning the default value causes the attribute to be removed from the element."""
95+
"""XsdBoolean type-converted value of ``sourceLinked`` attribute, or |None| if not present. Assigning the default value causes the attribute to be removed from the element."""
9596
...
9697

9798
@sourceLinked.setter
@@ -124,11 +125,11 @@ class CT_Title(BaseOxmlElement):
124125

125126
class CT_Tx(BaseOxmlElement):
126127
@property
127-
def strRef(self) -> BaseOxmlElement | None:
128+
def strRef(self) -> _Element | None:
128129
"""``<c:strRef>`` child element or |None| if not present."""
129130
...
130131

131-
def get_or_add_strRef(self) -> BaseOxmlElement:
132+
def get_or_add_strRef(self) -> _Element:
132133
"""Return the ``<c:strRef>`` child element, newly added if not present."""
133134
...
134135

pptx-stubs/oxml/dml/fill.pyi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ from pptx.oxml.xmlchemy import BaseOxmlElement
1515
class CT_Blip(BaseOxmlElement):
1616
@property
1717
def rEmbed(self) -> str | None:
18-
"""ST_RelationshipId type-converted value of ``r:embed`` attribute, or |None|. Assigning the default value causes the attribute to be removed from the element."""
18+
"""ST_RelationshipId type-converted value of ``r:embed`` attribute, or |None| if not present. Assigning the default value causes the attribute to be removed from the element."""
1919
...
2020

2121
@rEmbed.setter
@@ -161,7 +161,7 @@ class CT_GroupFillProperties(BaseOxmlElement): ...
161161
class CT_LinearShadeProperties(BaseOxmlElement):
162162
@property
163163
def ang(self) -> float | None:
164-
"""ST_PositiveFixedAngle type-converted value of ``ang`` attribute, or |None|. Assigning the default value causes the attribute to be removed from the element."""
164+
"""ST_PositiveFixedAngle type-converted value of ``ang`` attribute, or |None| if not present. Assigning the default value causes the attribute to be removed from the element."""
165165
...
166166

167167
@ang.setter
@@ -190,7 +190,7 @@ class CT_PatternFillProperties(BaseOxmlElement):
190190

191191
@property
192192
def prst(self) -> MSO_PATTERN_TYPE | None:
193-
"""MSO_PATTERN_TYPE type-converted value of ``prst`` attribute, or |None|. Assigning the default value causes the attribute to be removed from the element."""
193+
"""MSO_PATTERN_TYPE type-converted value of ``prst`` attribute, or |None| if not present. Assigning the default value causes the attribute to be removed from the element."""
194194
...
195195

196196
@prst.setter
@@ -199,28 +199,28 @@ class CT_PatternFillProperties(BaseOxmlElement):
199199
class CT_RelativeRect(BaseOxmlElement):
200200
@property
201201
def l(self) -> float:
202-
"""ST_Percentage type-converted value of ``l`` attribute, or |0.0|. Assigning the default value causes the attribute to be removed from the element."""
202+
"""ST_Percentage type-converted value of ``l`` attribute, or |0.0| if not present. Assigning the default value causes the attribute to be removed from the element."""
203203
...
204204

205205
@l.setter
206206
def l(self, value: float) -> None: ...
207207
@property
208208
def t(self) -> float:
209-
"""ST_Percentage type-converted value of ``t`` attribute, or |0.0|. Assigning the default value causes the attribute to be removed from the element."""
209+
"""ST_Percentage type-converted value of ``t`` attribute, or |0.0| if not present. Assigning the default value causes the attribute to be removed from the element."""
210210
...
211211

212212
@t.setter
213213
def t(self, value: float) -> None: ...
214214
@property
215215
def r(self) -> float:
216-
"""ST_Percentage type-converted value of ``r`` attribute, or |0.0|. Assigning the default value causes the attribute to be removed from the element."""
216+
"""ST_Percentage type-converted value of ``r`` attribute, or |0.0| if not present. Assigning the default value causes the attribute to be removed from the element."""
217217
...
218218

219219
@r.setter
220220
def r(self, value: float) -> None: ...
221221
@property
222222
def b(self) -> float:
223-
"""ST_Percentage type-converted value of ``b`` attribute, or |0.0|. Assigning the default value causes the attribute to be removed from the element."""
223+
"""ST_Percentage type-converted value of ``b`` attribute, or |0.0| if not present. Assigning the default value causes the attribute to be removed from the element."""
224224
...
225225

226226
@b.setter

pptx-stubs/oxml/dml/line.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from pptx.oxml.xmlchemy import BaseOxmlElement
44
class CT_PresetLineDashProperties(BaseOxmlElement):
55
@property
66
def val(self) -> MSO_LINE_DASH_STYLE | None:
7-
"""MSO_LINE_DASH_STYLE type-converted value of ``val`` attribute, or |None|. Assigning the default value causes the attribute to be removed from the element."""
7+
"""MSO_LINE_DASH_STYLE type-converted value of ``val`` attribute, or |None| if not present. Assigning the default value causes the attribute to be removed from the element."""
88
...
99

1010
@val.setter

0 commit comments

Comments
 (0)