Skip to content

Commit 9ddde0f

Browse files
committed
Fixed formatting issues with nested enumerated docstrings in info_array descriptions
for all the cases in info_array which include value types of all cases of enumerated values.
1 parent 98fab98 commit 9ddde0f

File tree

832 files changed

+14495
-8318
lines changed

Some content is hidden

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

832 files changed

+14495
-8318
lines changed

_plotly_utils/basevalidators.py

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,8 @@ def description(self):
537537
enum_vals_str = "\n".join(
538538
textwrap.wrap(
539539
repr(enum_vals),
540-
initial_indent=" " * 12,
541-
subsequent_indent=" " * 12,
540+
initial_indent=" " * 8,
541+
subsequent_indent=" " * 8,
542542
break_on_hyphens=False,
543543
)
544544
)
@@ -554,8 +554,8 @@ def description(self):
554554
enum_regexs_str = "\n".join(
555555
textwrap.wrap(
556556
repr(enum_regexs),
557-
initial_indent=" " * 12,
558-
subsequent_indent=" " * 12,
557+
initial_indent=" " * 8,
558+
subsequent_indent=" " * 8,
559559
break_on_hyphens=False,
560560
break_long_words=False,
561561
)
@@ -572,7 +572,7 @@ def description(self):
572572
desc = (
573573
desc
574574
+ """\n
575-
- A tuple, list, or one-dimensional numpy array of the above"""
575+
- A tuple, list, or one-dimensional numpy array of the above"""
576576
)
577577

578578
return desc
@@ -727,23 +727,23 @@ def description(self):
727727
desc = (
728728
desc
729729
+ """\n
730-
- An int or float"""
730+
- An int or float"""
731731
)
732732

733733
else:
734734
desc = (
735735
desc
736-
+ """
737-
- An int or float in the interval [{min_val}, {max_val}]""".format(
736+
+ """\n
737+
- An int or float in the interval [{min_val}, {max_val}]""".format(
738738
min_val=self.min_val, max_val=self.max_val
739739
)
740740
)
741741

742742
if self.array_ok:
743743
desc = (
744744
desc
745-
+ """
746-
- A tuple, list, or one-dimensional numpy array of the above"""
745+
+ """\n
746+
- A tuple, list, or one-dimensional numpy array of the above"""
747747
)
748748

749749
return desc
@@ -1992,10 +1992,12 @@ def description(self):
19921992

19931993
for i, item_validator in enumerate(self.item_validators):
19941994
el_desc = item_validator.description().strip()
1995+
lines = el_desc.splitlines()
1996+
el_desc_indented = '\n'.join([lines[0]] + [' ' + line for line in lines[1:]])
19951997
desc = (
19961998
desc
19971999
+ """\n
1998-
({i}) {el_desc}""".format(i=i, el_desc=el_desc)
2000+
({i}) {el_desc_indented}""".format(i=i, el_desc_indented=el_desc_indented)
19992001
)
20002002

20012003
# ### Case 2 ###
@@ -2030,21 +2032,28 @@ def description(self):
20302032

20312033
el_desc = item_validator.description().strip()
20322034

2033-
desc += """
2034-
* a list of elements where:
2035-
{el_desc}
2036-
""".format(el_desc=el_desc)
2035+
# Adds an indentation of 4 spaces, especially when el_desc
2036+
# is a fully auto-generated docstring with nested lists.
2037+
lines = el_desc.splitlines()
2038+
el_desc_indented = '\n'.join([lines[0]] + [' ' + line for line in lines[1:]])
2039+
2040+
desc += """\n
2041+
* a list of elements where:\n
2042+
{el_desc_indented}
2043+
""".format(el_desc_indented=el_desc_indented)
20372044

20382045
if self.dimensions in ("1-2", 2):
20392046
item_validator.plotly_name = "{name}\\\\[i\\\\]\\\\[j\\\\]".format(
20402047
name=self.plotly_name
20412048
)
20422049

20432050
el_desc = item_validator.description().strip()
2051+
lines = el_desc.splitlines()
2052+
el_desc_indented = '\n'.join([lines[0]] + [' ' + line for line in lines[1:]])
20442053
desc += """\n
20452054
* a 2D list where:\n
2046-
{el_desc}
2047-
""".format(el_desc=el_desc)
2055+
{el_desc_indented}
2056+
""".format(el_desc_indented=el_desc_indented)
20482057

20492058
item_validator.plotly_name = orig_name
20502059

plotly/graph_objects/_bar.py

Lines changed: 58 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ def constraintext(self):
172172
larger than the bar itself.
173173
174174
The 'constraintext' property is an enumeration that may be specified as:
175-
- One of the following enumeration values:
176-
['inside', 'outside', 'both', 'none']
175+
176+
- One of the following enumeration values:
177+
178+
['inside', 'outside', 'both', 'none']
177179
178180
Returns
179181
-------
@@ -232,7 +234,7 @@ def dx(self):
232234
233235
The 'dx' property is a number and may be specified as:
234236
235-
- An int or float
237+
- An int or float
236238
237239
Returns
238240
-------
@@ -251,7 +253,7 @@ def dy(self):
251253
252254
The 'dy' property is a number and may be specified as:
253255
254-
- An int or float
256+
- An int or float
255257
256258
Returns
257259
-------
@@ -514,8 +516,10 @@ def insidetextanchor(self):
514516
`textposition` "inside" mode.
515517
516518
The 'insidetextanchor' property is an enumeration that may be specified as:
517-
- One of the following enumeration values:
518-
['end', 'middle', 'start']
519+
520+
- One of the following enumeration values:
521+
522+
['end', 'middle', 'start']
519523
520524
Returns
521525
-------
@@ -625,7 +629,7 @@ def legendrank(self):
625629
626630
The 'legendrank' property is a number and may be specified as:
627631
628-
- An int or float
632+
- An int or float
629633
630634
Returns
631635
-------
@@ -644,7 +648,8 @@ def legendwidth(self):
644648
trace.
645649
646650
The 'legendwidth' property is a number and may be specified as:
647-
- An int or float in the interval [0, inf]
651+
652+
- An int or float in the interval [0, inf]
648653
649654
Returns
650655
-------
@@ -748,8 +753,9 @@ def offset(self):
748753
749754
The 'offset' property is a number and may be specified as:
750755
751-
- An int or float
752-
- A tuple, list, or one-dimensional numpy array of the above
756+
- An int or float
757+
758+
- A tuple, list, or one-dimensional numpy array of the above
753759
754760
Returns
755761
-------
@@ -806,7 +812,8 @@ def opacity(self):
806812
Sets the opacity of the trace.
807813
808814
The 'opacity' property is a number and may be specified as:
809-
- An int or float in the interval [0, 1]
815+
816+
- An int or float in the interval [0, 1]
810817
811818
Returns
812819
-------
@@ -825,8 +832,10 @@ def orientation(self):
825832
the each bar spans along the vertical (horizontal).
826833
827834
The 'orientation' property is an enumeration that may be specified as:
828-
- One of the following enumeration values:
829-
['v', 'h']
835+
836+
- One of the following enumeration values:
837+
838+
['v', 'h']
830839
831840
Returns
832841
-------
@@ -1020,9 +1029,12 @@ def textposition(self):
10201029
text appears.
10211030
10221031
The 'textposition' property is an enumeration that may be specified as:
1023-
- One of the following enumeration values:
1024-
['inside', 'outside', 'auto', 'none']
1025-
- A tuple, list, or one-dimensional numpy array of the above
1032+
1033+
- One of the following enumeration values:
1034+
1035+
['inside', 'outside', 'auto', 'none']
1036+
1037+
- A tuple, list, or one-dimensional numpy array of the above
10261038
10271039
Returns
10281040
-------
@@ -1201,8 +1213,10 @@ def visible(self):
12011213
legend item (provided that the legend itself is visible).
12021214
12031215
The 'visible' property is an enumeration that may be specified as:
1204-
- One of the following enumeration values:
1205-
[True, False, 'legendonly']
1216+
1217+
- One of the following enumeration values:
1218+
1219+
[True, False, 'legendonly']
12061220
12071221
Returns
12081222
-------
@@ -1220,8 +1234,10 @@ def width(self):
12201234
Sets the bar width (in position axis units).
12211235
12221236
The 'width' property is a number and may be specified as:
1223-
- An int or float in the interval [0, inf]
1224-
- A tuple, list, or one-dimensional numpy array of the above
1237+
1238+
- An int or float in the interval [0, inf]
1239+
1240+
- A tuple, list, or one-dimensional numpy array of the above
12251241
12261242
Returns
12271243
-------
@@ -1317,11 +1333,13 @@ def xcalendar(self):
13171333
Sets the calendar system to use with `x` date data.
13181334
13191335
The 'xcalendar' property is an enumeration that may be specified as:
1320-
- One of the following enumeration values:
1321-
['chinese', 'coptic', 'discworld', 'ethiopian',
1322-
'gregorian', 'hebrew', 'islamic', 'jalali', 'julian',
1323-
'mayan', 'nanakshahi', 'nepali', 'persian', 'taiwan',
1324-
'thai', 'ummalqura']
1336+
1337+
- One of the following enumeration values:
1338+
1339+
['chinese', 'coptic', 'discworld', 'ethiopian', 'gregorian',
1340+
'hebrew', 'islamic', 'jalali', 'julian', 'mayan',
1341+
'nanakshahi', 'nepali', 'persian', 'taiwan', 'thai',
1342+
'ummalqura']
13251343
13261344
Returns
13271345
-------
@@ -1410,8 +1428,10 @@ def xperiodalignment(self):
14101428
alignment of data points on the x axis.
14111429
14121430
The 'xperiodalignment' property is an enumeration that may be specified as:
1413-
- One of the following enumeration values:
1414-
['start', 'middle', 'end']
1431+
1432+
- One of the following enumeration values:
1433+
1434+
['start', 'middle', 'end']
14151435
14161436
Returns
14171437
-------
@@ -1507,11 +1527,13 @@ def ycalendar(self):
15071527
Sets the calendar system to use with `y` date data.
15081528
15091529
The 'ycalendar' property is an enumeration that may be specified as:
1510-
- One of the following enumeration values:
1511-
['chinese', 'coptic', 'discworld', 'ethiopian',
1512-
'gregorian', 'hebrew', 'islamic', 'jalali', 'julian',
1513-
'mayan', 'nanakshahi', 'nepali', 'persian', 'taiwan',
1514-
'thai', 'ummalqura']
1530+
1531+
- One of the following enumeration values:
1532+
1533+
['chinese', 'coptic', 'discworld', 'ethiopian', 'gregorian',
1534+
'hebrew', 'islamic', 'jalali', 'julian', 'mayan',
1535+
'nanakshahi', 'nepali', 'persian', 'taiwan', 'thai',
1536+
'ummalqura']
15151537
15161538
Returns
15171539
-------
@@ -1600,8 +1622,10 @@ def yperiodalignment(self):
16001622
alignment of data points on the y axis.
16011623
16021624
The 'yperiodalignment' property is an enumeration that may be specified as:
1603-
- One of the following enumeration values:
1604-
['start', 'middle', 'end']
1625+
1626+
- One of the following enumeration values:
1627+
1628+
['start', 'middle', 'end']
16051629
16061630
Returns
16071631
-------

0 commit comments

Comments
 (0)