Skip to content

Commit cc4c0b3

Browse files
CLN: D213: Multi-line docstring summary should start at the second line (#31893)
1 parent 53ece70 commit cc4c0b3

Some content is hidden

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

50 files changed

+258
-129
lines changed

pandas/_config/config.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282

8383

8484
class OptionError(AttributeError, KeyError):
85-
"""Exception for pandas.options, backwards compatible with KeyError
85+
"""
86+
Exception for pandas.options, backwards compatible with KeyError
8687
checks
8788
"""
8889

@@ -545,7 +546,8 @@ def deprecate_option(
545546

546547

547548
def _select_options(pat: str) -> List[str]:
548-
"""returns a list of keys matching `pat`
549+
"""
550+
returns a list of keys matching `pat`
549551
550552
if pat=="all", returns all registered options
551553
"""
@@ -708,7 +710,8 @@ def pp(name: str, ks: Iterable[str]) -> List[str]:
708710

709711
@contextmanager
710712
def config_prefix(prefix):
711-
"""contextmanager for multiple invocations of API with a common prefix
713+
"""
714+
contextmanager for multiple invocations of API with a common prefix
712715
713716
supported API functions: (register / get / set )__option
714717

pandas/_testing.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,8 @@ def repr_class(x):
743743

744744

745745
def assert_attr_equal(attr, left, right, obj="Attributes"):
746-
"""checks attributes are equal. Both objects must have attribute.
746+
"""
747+
checks attributes are equal. Both objects must have attribute.
747748
748749
Parameters
749750
----------
@@ -820,7 +821,8 @@ def assert_is_sorted(seq):
820821
def assert_categorical_equal(
821822
left, right, check_dtype=True, check_category_order=True, obj="Categorical"
822823
):
823-
"""Test that Categoricals are equivalent.
824+
"""
825+
Test that Categoricals are equivalent.
824826
825827
Parameters
826828
----------
@@ -860,7 +862,8 @@ def assert_categorical_equal(
860862

861863

862864
def assert_interval_array_equal(left, right, exact="equiv", obj="IntervalArray"):
863-
"""Test that two IntervalArrays are equivalent.
865+
"""
866+
Test that two IntervalArrays are equivalent.
864867
865868
Parameters
866869
----------
@@ -1009,7 +1012,8 @@ def _raise(left, right, err_msg):
10091012
def assert_extension_array_equal(
10101013
left, right, check_dtype=True, check_less_precise=False, check_exact=False
10111014
):
1012-
"""Check that left and right ExtensionArrays are equal.
1015+
"""
1016+
Check that left and right ExtensionArrays are equal.
10131017
10141018
Parameters
10151019
----------
@@ -1489,7 +1493,8 @@ def assert_sp_array_equal(
14891493
check_fill_value=True,
14901494
consolidate_block_indices=False,
14911495
):
1492-
"""Check that the left and right SparseArray are equal.
1496+
"""
1497+
Check that the left and right SparseArray are equal.
14931498
14941499
Parameters
14951500
----------
@@ -1724,7 +1729,8 @@ def _make_timeseries(start="2000-01-01", end="2000-12-31", freq="1D", seed=None)
17241729

17251730

17261731
def all_index_generator(k=10):
1727-
"""Generator which can be iterated over to get instances of all the various
1732+
"""
1733+
Generator which can be iterated over to get instances of all the various
17281734
index classes.
17291735
17301736
Parameters
@@ -1763,7 +1769,8 @@ def index_subclass_makers_generator():
17631769

17641770

17651771
def all_timeseries_index_generator(k=10):
1766-
"""Generator which can be iterated over to get instances of all the classes
1772+
"""
1773+
Generator which can be iterated over to get instances of all the classes
17671774
which represent time-series.
17681775
17691776
Parameters
@@ -1854,7 +1861,8 @@ def makePeriodFrame(nper=None):
18541861
def makeCustomIndex(
18551862
nentries, nlevels, prefix="#", names=False, ndupe_l=None, idx_type=None
18561863
):
1857-
"""Create an index/multindex with given dimensions, levels, names, etc'
1864+
"""
1865+
Create an index/multindex with given dimensions, levels, names, etc'
18581866
18591867
nentries - number of entries in index
18601868
nlevels - number of levels (> 1 produces multindex)
@@ -2144,7 +2152,8 @@ def makeMissingDataframe(density=0.9, random_state=None):
21442152

21452153

21462154
def optional_args(decorator):
2147-
"""allows a decorator to take optional positional and keyword arguments.
2155+
"""
2156+
allows a decorator to take optional positional and keyword arguments.
21482157
Assumes that taking a single, callable, positional argument means that
21492158
it is decorating a function, i.e. something like this::
21502159
@@ -2216,7 +2225,8 @@ def _get_default_network_errors():
22162225

22172226

22182227
def can_connect(url, error_classes=None):
2219-
"""Try to connect to the given url. True if succeeds, False if IOError
2228+
"""
2229+
Try to connect to the given url. True if succeeds, False if IOError
22202230
raised
22212231
22222232
Parameters
@@ -2584,7 +2594,8 @@ def use_numexpr(use, min_elements=None):
25842594

25852595

25862596
def test_parallel(num_threads=2, kwargs_list=None):
2587-
"""Decorator to run the same function multiple times in parallel.
2597+
"""
2598+
Decorator to run the same function multiple times in parallel.
25882599
25892600
Parameters
25902601
----------

pandas/compat/chainmap.py

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

66

77
class DeepChainMap(ChainMap[_KT, _VT]):
8-
"""Variant of ChainMap that allows direct updates to inner scopes.
8+
"""
9+
Variant of ChainMap that allows direct updates to inner scopes.
910
1011
Only works when all passed mapping are mutable.
1112
"""

pandas/core/aggregation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ def normalize_keyword_aggregation(kwargs: dict) -> Tuple[dict, List[str], List[i
9898
def _make_unique_kwarg_list(
9999
seq: Sequence[Tuple[Any, Any]]
100100
) -> Sequence[Tuple[Any, Any]]:
101-
"""Uniquify aggfunc name of the pairs in the order list
101+
"""
102+
Uniquify aggfunc name of the pairs in the order list
102103
103104
Examples:
104105
--------

pandas/core/arrays/base.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
"""An interface for extending pandas with custom arrays.
1+
"""
2+
An interface for extending pandas with custom arrays.
23
34
.. warning::
45
@@ -213,7 +214,8 @@ def _from_sequence(cls, scalars, dtype=None, copy=False):
213214

214215
@classmethod
215216
def _from_sequence_of_strings(cls, strings, dtype=None, copy=False):
216-
"""Construct a new ExtensionArray from a sequence of strings.
217+
"""
218+
Construct a new ExtensionArray from a sequence of strings.
217219
218220
.. versionadded:: 0.24.0
219221
@@ -961,7 +963,8 @@ def __repr__(self) -> str:
961963
return f"{class_name}{data}\nLength: {len(self)}, dtype: {self.dtype}"
962964

963965
def _formatter(self, boxed: bool = False) -> Callable[[Any], Optional[str]]:
964-
"""Formatting function for scalar values.
966+
"""
967+
Formatting function for scalar values.
965968
966969
This is used in the default '__repr__'. The returned formatting
967970
function receives instances of your scalar type.

pandas/core/arrays/categorical.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,8 @@ def __contains__(self, key) -> bool:
18911891
return contains(self, key, container=self._codes)
18921892

18931893
def _tidy_repr(self, max_vals=10, footer=True) -> str:
1894-
""" a short repr displaying only max_vals and an optional (but default
1894+
"""
1895+
a short repr displaying only max_vals and an optional (but default
18951896
footer)
18961897
"""
18971898
num = max_vals // 2

pandas/core/arrays/datetimelike.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def _simple_new(cls, values, **kwargs):
134134

135135
@property
136136
def _scalar_type(self) -> Type[DatetimeLikeScalar]:
137-
"""The scalar associated with this datelike
137+
"""
138+
The scalar associated with this datelike
138139
139140
* PeriodArray : Period
140141
* DatetimeArray : Timestamp

pandas/core/arrays/integer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,8 @@ def astype(self, dtype, copy: bool = True) -> ArrayLike:
477477

478478
@property
479479
def _ndarray_values(self) -> np.ndarray:
480-
"""Internal pandas method for lossy conversion to a NumPy ndarray.
480+
"""
481+
Internal pandas method for lossy conversion to a NumPy ndarray.
481482
482483
This method is not part of the pandas interface.
483484
@@ -492,7 +493,8 @@ def _values_for_factorize(self) -> Tuple[np.ndarray, float]:
492493
return self.to_numpy(na_value=np.nan), np.nan
493494

494495
def _values_for_argsort(self) -> np.ndarray:
495-
"""Return values for sorting.
496+
"""
497+
Return values for sorting.
496498
497499
Returns
498500
-------

pandas/core/arrays/interval.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ def from_tuples(cls, data, closed="right", copy=False, dtype=None):
460460
return cls.from_arrays(left, right, closed, copy=False, dtype=dtype)
461461

462462
def _validate(self):
463-
"""Verify that the IntervalArray is valid.
463+
"""
464+
Verify that the IntervalArray is valid.
464465
465466
Checks that
466467

pandas/core/arrays/sparse/scipy_sparse.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def _check_is_partition(parts, whole):
1717

1818

1919
def _to_ijv(ss, row_levels=(0,), column_levels=(1,), sort_labels=False):
20-
""" For arbitrary (MultiIndexed) sparse Series return
20+
"""
21+
For arbitrary (MultiIndexed) sparse Series return
2122
(v, i, j, ilabels, jlabels) where (v, (i, j)) is suitable for
2223
passing to scipy.sparse.coo constructor.
2324
"""
@@ -44,7 +45,8 @@ def get_indexers(levels):
4445
# labels_to_i[:] = np.arange(labels_to_i.shape[0])
4546

4647
def _get_label_to_i_dict(labels, sort_labels=False):
47-
""" Return dict of unique labels to number.
48+
"""
49+
Return dict of unique labels to number.
4850
Optionally sort by label.
4951
"""
5052
labels = Index(map(tuple, labels)).unique().tolist() # squish

0 commit comments

Comments
 (0)