Skip to content

Commit b9b081d

Browse files
killerontherun1jreback
authored andcommitted
Docstring GL01 GL02 fixes (#26526)
1 parent 4850b28 commit b9b081d

File tree

14 files changed

+57
-33
lines changed

14 files changed

+57
-33
lines changed

pandas/core/accessor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def decorator(accessor):
196196
return decorator
197197

198198

199-
_doc = """\
199+
_doc = """
200200
Register a custom accessor on %(klass)s objects.
201201
202202
Parameters

pandas/core/arrays/categorical.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def contains(cat, key, container):
196196
return any(loc_ in container for loc_ in loc)
197197

198198

199-
_codes_doc = """\
199+
_codes_doc = """
200200
The category codes of this categorical.
201201
202202
Level codes are an array if integer which are the positions of the real

pandas/core/arrays/interval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ def __array__(self, dtype=None):
987987
result[i] = Interval(left[i], right[i], closed)
988988
return result
989989

990-
_interval_shared_docs['to_tuples'] = """\
990+
_interval_shared_docs['to_tuples'] = """
991991
Return an %(return_type)s of tuples of the form (left, right)
992992
993993
Parameters
@@ -1002,7 +1002,7 @@ def __array__(self, dtype=None):
10021002
-------
10031003
tuples: %(return_type)s
10041004
%(examples)s\
1005-
"""
1005+
"""
10061006

10071007
@Appender(_interval_shared_docs['to_tuples'] % dict(
10081008
return_type='ndarray',

pandas/core/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@ def _is_builtin_func(self, arg):
638638

639639

640640
class IndexOpsMixin:
641-
""" common ops mixin to support a unified interface / docs for Series /
642-
Index
641+
"""
642+
Common ops mixin to support a unified interface / docs for Series / Index
643643
"""
644644

645645
# ndarray compatibility
@@ -656,8 +656,8 @@ def transpose(self, *args, **kwargs):
656656
nv.validate_transpose(args, kwargs)
657657
return self
658658

659-
T = property(transpose, doc="Return the transpose, which is by "
660-
"definition self.")
659+
T = property(transpose, doc="""\nReturn the transpose, which is by
660+
definition self.\n""")
661661

662662
@property
663663
def _is_homogeneous_type(self):

pandas/core/computation/eval.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22

3-
"""Top level ``eval`` module.
3+
"""
4+
Top level ``eval`` module.
45
"""
56

67
import tokenize
@@ -15,7 +16,8 @@
1516

1617

1718
def _check_engine(engine):
18-
"""Make sure a valid engine is passed.
19+
"""
20+
Make sure a valid engine is passed.
1921
2022
Parameters
2123
----------
@@ -31,7 +33,6 @@ def _check_engine(engine):
3133
Returns
3234
-------
3335
string engine
34-
3536
"""
3637
from pandas.core.computation.check import _NUMEXPR_INSTALLED
3738

@@ -60,7 +61,8 @@ def _check_engine(engine):
6061

6162

6263
def _check_parser(parser):
63-
"""Make sure a valid parser is passed.
64+
"""
65+
Make sure a valid parser is passed.
6466
6567
Parameters
6668
----------
@@ -88,7 +90,8 @@ def _check_resolvers(resolvers):
8890

8991

9092
def _check_expression(expr):
91-
"""Make sure an expression is not an empty string
93+
"""
94+
Make sure an expression is not an empty string
9295
9396
Parameters
9497
----------
@@ -105,7 +108,8 @@ def _check_expression(expr):
105108

106109

107110
def _convert_expression(expr):
108-
"""Convert an object to an expression.
111+
"""
112+
Convert an object to an expression.
109113
110114
Thus function converts an object to an expression (a unicode string) and
111115
checks to make sure it isn't empty after conversion. This is used to
@@ -155,7 +159,8 @@ def _check_for_locals(expr, stack_level, parser):
155159
def eval(expr, parser='pandas', engine=None, truediv=True,
156160
local_dict=None, global_dict=None, resolvers=(), level=0,
157161
target=None, inplace=False):
158-
"""Evaluate a Python expression as a string using various backends.
162+
"""
163+
Evaluate a Python expression as a string using various backends.
159164
160165
The following arithmetic operations are supported: ``+``, ``-``, ``*``,
161166
``/``, ``**``, ``%``, ``//`` (python engine only) along with the following

pandas/core/dtypes/dtypes.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,12 +631,16 @@ def __init__(self, unit="ns", tz=None):
631631

632632
@property
633633
def unit(self):
634-
"""The precision of the datetime data."""
634+
"""
635+
The precision of the datetime data.
636+
"""
635637
return self._unit
636638

637639
@property
638640
def tz(self):
639-
"""The timezone."""
641+
"""
642+
The timezone.
643+
"""
640644
return self._tz
641645

642646
@classmethod
@@ -777,7 +781,9 @@ def __new__(cls, freq=None):
777781

778782
@property
779783
def freq(self):
780-
"""The frequency object of this PeriodDtype."""
784+
"""
785+
The frequency object of this PeriodDtype.
786+
"""
781787
return self._freq
782788

783789
@classmethod
@@ -944,7 +950,9 @@ def __new__(cls, subtype=None):
944950

945951
@property
946952
def subtype(self):
947-
"""The dtype of the Interval bounds."""
953+
"""
954+
The dtype of the Interval bounds.
955+
"""
948956
return self._subtype
949957

950958
@classmethod

pandas/core/dtypes/inference.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,8 @@ def is_named_tuple(obj):
427427

428428

429429
def is_hashable(obj):
430-
"""Return True if hash(obj) will succeed, False otherwise.
430+
"""
431+
Return True if hash(obj) will succeed, False otherwise.
431432
432433
Some types will pass a test against collections.abc.Hashable but fail when
433434
they are actually hashed with hash().

pandas/core/generic.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,7 +1838,8 @@ def __iter__(self):
18381838

18391839
# can we get a better explanation of this?
18401840
def keys(self):
1841-
"""Get the 'info axis' (see Indexing for more)
1841+
"""
1842+
Get the 'info axis' (see Indexing for more)
18421843
18431844
This is index for Series, columns for DataFrame.
18441845
@@ -1850,7 +1851,8 @@ def keys(self):
18501851
return self._info_axis
18511852

18521853
def iteritems(self):
1853-
"""Iterate over (label, values) on info axis
1854+
"""
1855+
Iterate over (label, values) on info axis
18541856
18551857
This is index for Series, columns for DataFrame and so on.
18561858
"""

pandas/core/groupby/groupby.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class providing the base-class of operations.
172172
{examples}
173173
""")
174174

175-
_pipe_template = """\
175+
_pipe_template = """
176176
Apply a function `func` with arguments to this %(klass)s object and return
177177
the function's result.
178178
@@ -223,7 +223,8 @@ class providing the base-class of operations.
223223
224224
Examples
225225
--------
226-
%(examples)s"""
226+
%(examples)s
227+
"""
227228

228229
_transform_template = """
229230
Call function producing a like-indexed %(klass)s on each group and

pandas/core/indexes/interval.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,8 @@ def _find_non_overlapping_monotonic_bounds(self, key):
769769
return start, stop
770770

771771
def get_loc(self, key, method=None):
772-
"""Get integer location, slice or boolean mask for requested label.
772+
"""
773+
Get integer location, slice or boolean mask for requested label.
773774
774775
Parameters
775776
----------

0 commit comments

Comments
 (0)