Skip to content

Commit db34d95

Browse files
committed
chore: Remove redundant docstrings from chart submodule
- chore: Add generic typehints in `_BaseWorkbookWriter` Signed-off-by: Avishrant Sharma <[email protected]>
1 parent 55f7510 commit db34d95

File tree

12 files changed

+207
-1789
lines changed

12 files changed

+207
-1789
lines changed

pptx-stubs/chart/axis.pyi

Lines changed: 28 additions & 249 deletions
Original file line numberDiff line numberDiff line change
@@ -9,332 +9,111 @@ from pptx.text.text import Font, TextFrame
99
from pptx.util import lazyproperty
1010

1111
class _BaseAxis:
12-
"""Base class for chart axis objects. All axis objects share these properties."""
1312
def __init__(self, xAx: BaseAxisElement) -> None: ...
1413
@property
15-
def axis_title(self) -> AxisTitle:
16-
"""An |AxisTitle| object providing access to title properties.
17-
18-
Calling this property is destructive in the sense that it adds an
19-
axis title element (`c:title`) to the axis XML if one is not already
20-
present. Use :attr:`has_title` to test for presence of axis title
21-
non-destructively.
22-
"""
23-
...
24-
14+
def axis_title(self) -> AxisTitle: ...
2515
@lazyproperty
26-
def format(self) -> ChartFormat:
27-
"""
28-
The |ChartFormat| object providing access to the shape formatting
29-
properties of this axis, such as its line color and fill.
30-
"""
31-
...
32-
16+
def format(self) -> ChartFormat: ...
3317
@property
34-
def has_major_gridlines(self) -> bool:
35-
"""
36-
Read/write boolean value specifying whether this axis has gridlines
37-
at its major tick mark locations. Assigning |True| to this property
38-
causes major gridlines to be displayed. Assigning |False| causes them
39-
to be removed.
40-
"""
41-
...
42-
18+
def has_major_gridlines(self) -> bool: ...
4319
@has_major_gridlines.setter
4420
def has_major_gridlines(self, value: bool) -> None: ...
4521
@property
46-
def has_minor_gridlines(self) -> bool:
47-
"""
48-
Read/write boolean value specifying whether this axis has gridlines
49-
at its minor tick mark locations. Assigning |True| to this property
50-
causes minor gridlines to be displayed. Assigning |False| causes them
51-
to be removed.
52-
"""
53-
...
54-
22+
def has_minor_gridlines(self) -> bool: ...
5523
@has_minor_gridlines.setter
5624
def has_minor_gridlines(self, value: bool) -> None: ...
5725
@property
58-
def has_title(self) -> bool:
59-
"""Read/write boolean specifying whether this axis has a title.
60-
61-
|True| if this axis has a title, |False| otherwise. Assigning |True|
62-
causes an axis title to be added if not already present. Assigning
63-
|False| causes any existing title to be deleted.
64-
"""
65-
...
66-
26+
def has_title(self) -> bool: ...
6727
@has_title.setter
6828
def has_title(self, value: bool) -> None: ...
6929
@lazyproperty
70-
def major_gridlines(self) -> MajorGridlines:
71-
"""
72-
The |MajorGridlines| object representing the major gridlines for
73-
this axis.
74-
"""
75-
...
76-
30+
def major_gridlines(self) -> MajorGridlines: ...
7731
@property
78-
def major_tick_mark(self) -> XL_TICK_MARK:
79-
"""
80-
Read/write :ref:`XlTickMark` value specifying the type of major tick
81-
mark to display on this axis.
82-
"""
83-
...
84-
32+
def major_tick_mark(self) -> XL_TICK_MARK: ...
8533
@major_tick_mark.setter
8634
def major_tick_mark(self, value: XL_TICK_MARK) -> None: ...
8735
@property
88-
def maximum_scale(self: float | None):
89-
"""
90-
Read/write float value specifying the upper limit of the value range
91-
for this axis, the number at the top or right of the vertical or
92-
horizontal value scale, respectively. The value |None| indicates the
93-
upper limit should be determined automatically based on the range of
94-
data point values associated with the axis.
95-
"""
96-
...
97-
36+
def maximum_scale(self: float | None): ...
9837
@maximum_scale.setter
9938
def maximum_scale(self, value: float | None) -> None: ...
10039
@property
101-
def minimum_scale(self) -> float | None:
102-
"""
103-
Read/write float value specifying lower limit of value range, the
104-
number at the bottom or left of the value scale. |None| if no minimum
105-
scale has been set. The value |None| indicates the lower limit should
106-
be determined automatically based on the range of data point values
107-
associated with the axis.
108-
"""
109-
...
110-
40+
def minimum_scale(self) -> float | None: ...
11141
@minimum_scale.setter
11242
def minimum_scale(self, value: float | None) -> None: ...
11343
@property
114-
def minor_tick_mark(self) -> XL_TICK_MARK:
115-
"""
116-
Read/write :ref:`XlTickMark` value specifying the type of minor tick
117-
mark for this axis.
118-
"""
119-
...
120-
44+
def minor_tick_mark(self) -> XL_TICK_MARK: ...
12145
@minor_tick_mark.setter
12246
def minor_tick_mark(self, value: XL_TICK_MARK) -> None: ...
12347
@property
124-
def reverse_order(self):
125-
"""Read/write bool value specifying whether to reverse plotting order for axis.
126-
127-
For a category axis, this reverses the order in which the categories are
128-
displayed. This may be desired, for example, on a (horizontal) bar-chart where
129-
by default the first category appears at the bottom. Since we read from
130-
top-to-bottom, many viewers may find it most natural for the first category to
131-
appear on top.
132-
133-
For a value axis, it reverses the direction of increasing value from
134-
bottom-to-top to top-to-bottom.
135-
"""
136-
...
137-
48+
def reverse_order(self): ...
13849
@reverse_order.setter
13950
def reverse_order(self, value: bool) -> None: ...
14051
@lazyproperty
141-
def tick_labels(self) -> TickLabels:
142-
"""
143-
The |TickLabels| instance providing access to axis tick label
144-
formatting properties. Tick labels are the numbers appearing on
145-
a value axis or the category names appearing on a category axis.
146-
"""
147-
...
148-
52+
def tick_labels(self) -> TickLabels: ...
14953
@property
150-
def tick_label_position(self) -> XL_TICK_LABEL_POSITION:
151-
"""
152-
Read/write :ref:`XlTickLabelPosition` value specifying where the tick
153-
labels for this axis should appear.
154-
"""
155-
...
156-
54+
def tick_label_position(self) -> XL_TICK_LABEL_POSITION: ...
15755
@tick_label_position.setter
15856
def tick_label_position(self, value: XL_TICK_LABEL_POSITION | None) -> None: ...
15957
@property
160-
def visible(self) -> bool:
161-
"""
162-
Read/write. |True| if axis is visible, |False| otherwise.
163-
"""
164-
...
165-
58+
def visible(self) -> bool: ...
16659
@visible.setter
16760
def visible(self, value: bool) -> None: ...
16861

16962
class AxisTitle(ElementProxy):
170-
"""Provides properties for manipulating axis title."""
17163
def __init__(self, title: CT_Title) -> None: ...
17264
@lazyproperty
173-
def format(self) -> ChartFormat:
174-
"""|ChartFormat| object providing access to shape formatting.
175-
176-
Return the |ChartFormat| object providing shape formatting properties
177-
for this axis title, such as its line color and fill.
178-
"""
179-
...
180-
65+
def format(self) -> ChartFormat: ...
18166
@property
182-
def has_text_frame(self) -> bool:
183-
"""Read/write Boolean specifying presence of a text frame.
184-
185-
Return |True| if this axis title has a text frame, and |False|
186-
otherwise. Assigning |True| causes a text frame to be added if not
187-
already present. Assigning |False| causes any existing text frame to
188-
be removed along with any text contained in the text frame.
189-
"""
190-
...
191-
67+
def has_text_frame(self) -> bool: ...
19268
@has_text_frame.setter
19369
def has_text_frame(self, value: bool) -> None: ...
19470
@property
195-
def text_frame(self) -> TextFrame:
196-
"""|TextFrame| instance for this axis title.
197-
198-
Return a |TextFrame| instance allowing read/write access to the text
199-
of this axis title and its text formatting properties. Accessing this
200-
property is destructive as it adds a new text frame if not already
201-
present.
202-
"""
203-
...
71+
def text_frame(self) -> TextFrame: ...
20472

20573
class CategoryAxis(_BaseAxis):
206-
"""A category axis of a chart."""
20774
@property
208-
def category_type(self) -> Literal[XL_CATEGORY_TYPE.CATEGORY_SCALE]:
209-
"""
210-
A member of :ref:`XlCategoryType` specifying the scale type of this
211-
axis. Unconditionally ``CATEGORY_SCALE`` for a |CategoryAxis| object.
212-
"""
213-
...
75+
def category_type(self) -> Literal[XL_CATEGORY_TYPE.CATEGORY_SCALE]: ...
21476

21577
class DateAxis(_BaseAxis):
216-
"""A category axis with dates as its category labels.
217-
218-
This axis-type has some special display behaviors such as making length of equal
219-
periods equal and normalizing month start dates despite unequal month lengths.
220-
"""
22178
@property
222-
def category_type(self) -> Literal[XL_CATEGORY_TYPE.TIME_SCALE]:
223-
"""
224-
A member of :ref:`XlCategoryType` specifying the scale type of this
225-
axis. Unconditionally ``TIME_SCALE`` for a |DateAxis| object.
226-
"""
227-
...
79+
def category_type(self) -> Literal[XL_CATEGORY_TYPE.TIME_SCALE]: ...
22880

22981
class MajorGridlines(ElementProxy):
230-
"""Provides access to the properties of the major gridlines appearing on an axis."""
23182
def __init__(self, xAx: BaseAxisElement) -> None: ...
23283
@lazyproperty
233-
def format(self) -> ChartFormat:
234-
"""
235-
The |ChartFormat| object providing access to the shape formatting
236-
properties of this data point, such as line and fill.
237-
"""
238-
...
84+
def format(self) -> ChartFormat: ...
23985

24086
class TickLabels:
241-
"""A service class providing access to formatting of axis tick mark labels."""
24287
def __init__(self, xAx_elm: BaseAxisElement) -> None: ...
24388
@lazyproperty
244-
def font(self) -> Font:
245-
"""
246-
The |Font| object that provides access to the text properties for
247-
these tick labels, such as bold, italic, etc.
248-
"""
249-
...
250-
89+
def font(self) -> Font: ...
25190
@property
252-
def number_format(self) -> str:
253-
"""
254-
Read/write string (e.g. "$#,##0.00") specifying the format for the
255-
numbers on this axis. The syntax for these strings is the same as it
256-
appears in the PowerPoint or Excel UI. Returns 'General' if no number
257-
format has been set. Note that this format string has no effect on
258-
rendered tick labels when :meth:`number_format_is_linked` is |True|.
259-
Assigning a format string to this property automatically sets
260-
:meth:`number_format_is_linked` to |False|.
261-
"""
262-
...
263-
91+
def number_format(self) -> str: ...
26492
@number_format.setter
26593
def number_format(self, value: str) -> None: ...
26694
@property
267-
def number_format_is_linked(self) -> bool:
268-
"""
269-
Read/write boolean specifying whether number formatting should be
270-
taken from the source spreadsheet rather than the value of
271-
:meth:`number_format`.
272-
"""
273-
...
274-
95+
def number_format_is_linked(self) -> bool: ...
27596
@number_format_is_linked.setter
27697
def number_format_is_linked(self, value: bool) -> None: ...
27798
@property
278-
def offset(self) -> int:
279-
"""
280-
Read/write int value in range 0-1000 specifying the spacing between
281-
the tick mark labels and the axis as a percentange of the default
282-
value. 100 if no label offset setting is present.
283-
"""
284-
...
285-
99+
def offset(self) -> int: ...
286100
@offset.setter
287101
def offset(self, value: int) -> None: ...
288102

289103
class ValueAxis(_BaseAxis):
290-
"""An axis having continuous (as opposed to discrete) values.
291-
292-
The vertical axis is generally a value axis, however both axes of an XY-type chart
293-
are value axes.
294-
"""
295104
@property
296-
def crosses(self) -> XL_AXIS_CROSSES:
297-
"""
298-
Member of :ref:`XlAxisCrosses` enumeration specifying the point on
299-
this axis where the other axis crosses, such as auto/zero, minimum,
300-
or maximum. Returns `XL_AXIS_CROSSES.CUSTOM` when a specific numeric
301-
crossing point (e.g. 1.5) is defined.
302-
"""
303-
...
304-
105+
def crosses(self) -> XL_AXIS_CROSSES: ...
305106
@crosses.setter
306107
def crosses(self, value: XL_AXIS_CROSSES) -> None: ...
307108
@property
308-
def crosses_at(self) -> float | None:
309-
"""
310-
Numeric value on this axis at which the perpendicular axis crosses.
311-
Returns |None| if no crossing value is set.
312-
"""
313-
...
314-
109+
def crosses_at(self) -> float | None: ...
315110
@crosses_at.setter
316111
def crosses_at(self, value: float | None) -> None: ...
317112
@property
318-
def major_unit(self) -> float | None:
319-
"""
320-
The float number of units between major tick marks on this value
321-
axis. |None| corresponds to the 'Auto' setting in the UI, and
322-
specifies the value should be calculated by PowerPoint based on the
323-
underlying chart data.
324-
"""
325-
...
326-
113+
def major_unit(self) -> float | None: ...
327114
@major_unit.setter
328115
def major_unit(self, value: float | None) -> None: ...
329116
@property
330-
def minor_unit(self) -> float | None:
331-
"""
332-
The float number of units between minor tick marks on this value
333-
axis. |None| corresponds to the 'Auto' setting in the UI, and
334-
specifies the value should be calculated by PowerPoint based on the
335-
underlying chart data.
336-
"""
337-
...
338-
117+
def minor_unit(self) -> float | None: ...
339118
@minor_unit.setter
340119
def minor_unit(self, value: float | None) -> None: ...

0 commit comments

Comments
 (0)