Skip to content

Commit 318bd9a

Browse files
committed
style: Docstring text should be on the next line after opening """ and be followed immediately by the line with closing """.
1 parent 2a8dd19 commit 318bd9a

File tree

5 files changed

+49
-25
lines changed

5 files changed

+49
-25
lines changed

pandas/util/_depr_module.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99

1010
class _DeprecatedModule:
11-
""" Class for mocking deprecated modules.
11+
"""
12+
Class for mocking deprecated modules.
1213
1314
Parameters
1415
----------

pandas/util/_doctools.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class TablePlotter:
77
"""
88
Layout some DataFrames in vertical/horizontal layout for explanation.
9-
Used in merging.rst
9+
Used in merging.rst.
1010
"""
1111

1212
def __init__(self, cell_width=0.37, cell_height=0.25, font_size=7.5):
@@ -16,7 +16,7 @@ def __init__(self, cell_width=0.37, cell_height=0.25, font_size=7.5):
1616

1717
def _shape(self, df):
1818
"""
19-
Calculate table chape considering index levels.
19+
Calculate table shape considering index levels.
2020
"""
2121

2222
row, col = df.shape
@@ -96,7 +96,9 @@ def plot(self, left, right, labels=None, vertical=True):
9696
return fig
9797

9898
def _conv(self, data):
99-
"""Convert each input to appropriate for table outplot"""
99+
"""
100+
Convert each input to appropriate for table outplot.
101+
"""
100102
if isinstance(data, pd.Series):
101103
if data.name is None:
102104
data = data.to_frame(name="")

pandas/util/_exceptions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
@contextlib.contextmanager
55
def rewrite_exception(old_name, new_name):
6-
"""Rewrite the message of an exception."""
6+
"""
7+
Rewrite the message of an exception.
8+
"""
79
try:
810
yield
911
except Exception as e:

pandas/util/_validators.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ def validate_args_and_kwargs(fname, args, kwargs, max_fname_arg_count, compat_ar
229229

230230

231231
def validate_bool_kwarg(value, arg_name):
232-
""" Ensures that argument passed in arg_name is of type bool. """
232+
"""
233+
Ensures that argument passed in arg_name is of type bool.
234+
"""
233235
if not (is_bool(value) or value is None):
234236
raise ValueError(
235237
'For argument "{arg}" expected type bool, received '
@@ -239,7 +241,8 @@ def validate_bool_kwarg(value, arg_name):
239241

240242

241243
def validate_axis_style_args(data, args, kwargs, arg_name, method_name):
242-
"""Argument handler for mixed index, columns / axis functions
244+
"""
245+
Argument handler for mixed index, columns / axis functions
243246
244247
In an attempt to handle both `.method(index, columns)`, and
245248
`.method(arg, axis=.)`, we have to do some bad things to argument
@@ -335,7 +338,8 @@ def validate_axis_style_args(data, args, kwargs, arg_name, method_name):
335338

336339

337340
def validate_fillna_kwargs(value, method, validate_scalar_dict_value=True):
338-
"""Validate the keyword arguments to 'fillna'.
341+
"""
342+
Validate the keyword arguments to 'fillna'.
339343
340344
This checks that exactly one of 'value' and 'method' is specified.
341345
If 'method' is specified, this validates that it's a valid method.

pandas/util/testing.py

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ def close(fignum=None):
476476

477477
@contextmanager
478478
def ensure_clean(filename=None, return_filelike=False):
479-
"""Gets a temporary path and agrees to remove on close.
479+
"""
480+
Gets a temporary path and agrees to remove on close.
480481
481482
Parameters
482483
----------
@@ -566,7 +567,8 @@ def ensure_safe_environment_variables():
566567

567568

568569
def equalContents(arr1, arr2):
569-
"""Checks if the set of unique elements of arr1 and arr2 are equivalent.
570+
"""
571+
Checks if the set of unique elements of arr1 and arr2 are equivalent.
570572
"""
571573
return frozenset(arr1) == frozenset(arr2)
572574

@@ -581,7 +583,8 @@ def assert_index_equal(
581583
check_categorical: bool = True,
582584
obj: str = "Index",
583585
) -> None:
584-
"""Check that left and right Index are equal.
586+
"""
587+
Check that left and right Index are equal.
585588
586589
Parameters
587590
----------
@@ -603,7 +606,7 @@ def assert_index_equal(
603606
Whether to compare internal Categorical exactly.
604607
obj : str, default 'Index'
605608
Specify object name being compared, internally used to show appropriate
606-
assertion message
609+
assertion message.
607610
"""
608611
__tracebackhide__ = True
609612

@@ -707,7 +710,9 @@ def _get_ilevel_values(index, level):
707710

708711

709712
def assert_class_equal(left, right, exact=True, obj="Input"):
710-
"""checks classes are equal."""
713+
"""
714+
Checks classes are equal.
715+
"""
711716
__tracebackhide__ = True
712717

713718
def repr_class(x):
@@ -734,7 +739,8 @@ def repr_class(x):
734739

735740

736741
def assert_attr_equal(attr, left, right, obj="Attributes"):
737-
"""checks attributes are equal. Both objects must have attribute.
742+
"""
743+
Checks attributes are equal. Both objects must have attribute.
738744
739745
Parameters
740746
----------
@@ -801,7 +807,9 @@ def isiterable(obj):
801807

802808

803809
def assert_is_sorted(seq):
804-
"""Assert that the sequence is sorted."""
810+
"""
811+
Assert that the sequence is sorted.
812+
"""
805813
if isinstance(seq, (Index, Series)):
806814
seq = seq.values
807815
# sorting does not change precisions
@@ -811,7 +819,8 @@ def assert_is_sorted(seq):
811819
def assert_categorical_equal(
812820
left, right, check_dtype=True, check_category_order=True, obj="Categorical"
813821
):
814-
"""Test that Categoricals are equivalent.
822+
"""
823+
Test that Categoricals are equivalent.
815824
816825
Parameters
817826
----------
@@ -856,7 +865,8 @@ def assert_categorical_equal(
856865

857866

858867
def assert_interval_array_equal(left, right, exact="equiv", obj="IntervalArray"):
859-
"""Test that two IntervalArrays are equivalent.
868+
"""
869+
Test that two IntervalArrays are equivalent.
860870
861871
Parameters
862872
----------
@@ -919,11 +929,13 @@ def raise_assert_detail(obj, message, left, right, diff=None):
919929
elif is_categorical_dtype(right):
920930
right = repr(right)
921931

922-
msg = """{obj} are different
923-
924-
{message}
925-
[left]: {left}
926-
[right]: {right}""".format(
932+
msg = """
933+
{obj} are different
934+
935+
{message}
936+
[left]: {left}
937+
[right]: {right}
938+
""".format(
927939
obj=obj, message=message, left=left, right=right
928940
)
929941

@@ -942,7 +954,8 @@ def assert_numpy_array_equal(
942954
check_same=None,
943955
obj="numpy array",
944956
):
945-
""" Checks that 'np.ndarray' is equivalent
957+
"""
958+
Checks that 'np.ndarray' is equivalent
946959
947960
Parameters
948961
----------
@@ -1019,7 +1032,8 @@ def _raise(left, right, err_msg):
10191032
def assert_extension_array_equal(
10201033
left, right, check_dtype=True, check_less_precise=False, check_exact=False
10211034
):
1022-
"""Check that left and right ExtensionArrays are equal.
1035+
"""
1036+
Check that left and right ExtensionArrays are equal.
10231037
10241038
Parameters
10251039
----------
@@ -1082,7 +1096,8 @@ def assert_series_equal(
10821096
check_categorical=True,
10831097
obj="Series",
10841098
):
1085-
"""Check that left and right Series are equal.
1099+
"""
1100+
Check that left and right Series are equal.
10861101
10871102
Parameters
10881103
----------

0 commit comments

Comments
 (0)