Skip to content

Commit 63945c0

Browse files
authored
DOC: GL01 Numpydoc validation (#44567)
1 parent 7a9975f commit 63945c0

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

ci/code_checks.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ fi
9393
### DOCSTRINGS ###
9494
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
9595

96-
MSG='Validate docstrings (GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS01, SS02, SS03, SS04, SS05, PR03, PR04, PR05, PRO9, PR10, EX04, RT01, RT04, RT05, SA02, SA03)' ; echo $MSG
97-
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS02,SS03,SS04,SS05,PR03,PR04,PR05,PR09,PR10,EX04,RT01,RT04,RT05,SA02,SA03
96+
MSG='Validate docstrings (GL01, GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS01, SS02, SS03, SS04, SS05, PR03, PR04, PR05, PRO9, PR10, EX04, RT01, RT04, RT05, SA02, SA03)' ; echo $MSG
97+
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=GL01,GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS02,SS03,SS04,SS05,PR03,PR04,PR05,PR09,PR10,EX04,RT01,RT04,RT05,SA02,SA03
9898
RET=$(($RET + $?)) ; echo $MSG "DONE"
9999

100100
fi

pandas/core/window/doc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def create_section_header(header: str) -> str:
1111
return "\n".join((header, "-" * len(header))) + "\n"
1212

1313

14-
template_header = "Calculate the {window_method} {aggregation_description}.\n\n"
14+
template_header = "\nCalculate the {window_method} {aggregation_description}.\n\n"
1515

1616
template_returns = dedent(
1717
"""

pandas/io/formats/style_render.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,23 @@ class CSSDict(TypedDict):
5757
Subset = Union[slice, Sequence, Index]
5858

5959

60+
def _gl01_adjust(obj: Any) -> Any:
61+
"""Adjust docstrings for Numpydoc GLO1."""
62+
obj.__doc__ = "\n" + obj.__doc__
63+
return obj
64+
65+
6066
class StylerRenderer:
6167
"""
6268
Base class to process rendering a Styler with a specified jinja2 template.
6369
"""
6470

65-
loader = jinja2.PackageLoader("pandas", "io/formats/templates")
66-
env = jinja2.Environment(loader=loader, trim_blocks=True)
67-
template_html = env.get_template("html.tpl")
68-
template_html_table = env.get_template("html_table.tpl")
69-
template_html_style = env.get_template("html_style.tpl")
70-
template_latex = env.get_template("latex.tpl")
71+
loader = _gl01_adjust(jinja2.PackageLoader("pandas", "io/formats/templates"))
72+
env = _gl01_adjust(jinja2.Environment(loader=loader, trim_blocks=True))
73+
template_html = _gl01_adjust(env.get_template("html.tpl"))
74+
template_html_table = _gl01_adjust(env.get_template("html_table.tpl"))
75+
template_html_style = _gl01_adjust(env.get_template("html_style.tpl"))
76+
template_latex = _gl01_adjust(env.get_template("latex.tpl"))
7177

7278
def __init__(
7379
self,

0 commit comments

Comments
 (0)