Skip to content

Commit f1c5cb0

Browse files
D209 Multi-line docstring closing quotes should be on a separate line (#31891)
1 parent bec7378 commit f1c5cb0

File tree

13 files changed

+52
-26
lines changed

13 files changed

+52
-26
lines changed

pandas/_testing.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2150,7 +2150,8 @@ def optional_args(decorator):
21502150
@my_decorator
21512151
def function(): pass
21522152
2153-
Calls decorator with decorator(f, *args, **kwargs)"""
2153+
Calls decorator with decorator(f, *args, **kwargs)
2154+
"""
21542155

21552156
@wraps(decorator)
21562157
def wrapper(*args, **kwargs):

pandas/core/arrays/sparse/scipy_sparse.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def _check_is_partition(parts, whole):
1919
def _to_ijv(ss, row_levels=(0,), column_levels=(1,), sort_labels=False):
2020
""" For arbitrary (MultiIndexed) sparse Series return
2121
(v, i, j, ilabels, jlabels) where (v, (i, j)) is suitable for
22-
passing to scipy.sparse.coo constructor. """
22+
passing to scipy.sparse.coo constructor.
23+
"""
2324
# index and column levels must be a partition of the index
2425
_check_is_partition([row_levels, column_levels], range(ss.index.nlevels))
2526

pandas/core/computation/pytables.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def is_valid(self) -> bool:
151151
@property
152152
def is_in_table(self) -> bool:
153153
""" return True if this is a valid column name for generation (e.g. an
154-
actual column in the table) """
154+
actual column in the table)
155+
"""
155156
return self.queryables.get(self.lhs) is not None
156157

157158
@property
@@ -176,7 +177,8 @@ def generate(self, v) -> str:
176177

177178
def convert_value(self, v) -> "TermValue":
178179
""" convert the expression that is in the term to something that is
179-
accepted by pytables """
180+
accepted by pytables
181+
"""
180182

181183
def stringify(value):
182184
if self.encoding is not None:

pandas/io/excel/_base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,8 @@ def _value_with_fmt(self, val):
756756
@classmethod
757757
def check_extension(cls, ext):
758758
"""checks that path's extension against the Writer's supported
759-
extensions. If it isn't supported, raises UnsupportedFiletypeError."""
759+
extensions. If it isn't supported, raises UnsupportedFiletypeError.
760+
"""
760761
if ext.startswith("."):
761762
ext = ext[1:]
762763
if not any(ext in extension for extension in cls.supported_extensions):

pandas/io/stata.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -2129,7 +2129,8 @@ def _write_bytes(self, value: bytes) -> None:
21292129

21302130
def _prepare_categoricals(self, data: DataFrame) -> DataFrame:
21312131
"""Check for categorical columns, retain categorical information for
2132-
Stata file and convert categorical data to int"""
2132+
Stata file and convert categorical data to int
2133+
"""
21332134

21342135
is_cat = [is_categorical_dtype(data[col]) for col in data]
21352136
self._is_col_cat = is_cat
@@ -2171,7 +2172,8 @@ def _prepare_categoricals(self, data: DataFrame) -> DataFrame:
21712172
def _replace_nans(self, data: DataFrame) -> DataFrame:
21722173
# return data
21732174
"""Checks floating point data columns for nans, and replaces these with
2174-
the generic Stata for missing value (.)"""
2175+
the generic Stata for missing value (.)
2176+
"""
21752177
for c in data:
21762178
dtype = data[c].dtype
21772179
if dtype in (np.float32, np.float64):
@@ -3037,7 +3039,8 @@ def _write_header(
30373039
def _write_map(self) -> None:
30383040
"""Called twice during file write. The first populates the values in
30393041
the map with 0s. The second call writes the final map locations when
3040-
all blocks have been written."""
3042+
all blocks have been written.
3043+
"""
30413044
assert self._file is not None
30423045
if not self._map:
30433046
self._map = dict(
@@ -3185,7 +3188,8 @@ def _write_file_close_tag(self) -> None:
31853188

31863189
def _update_strl_names(self) -> None:
31873190
"""Update column names for conversion to strl if they might have been
3188-
changed to comply with Stata naming rules"""
3191+
changed to comply with Stata naming rules
3192+
"""
31893193
# Update convert_strl if names changed
31903194
for orig, new in self._converted_names.items():
31913195
if orig in self._convert_strl:
@@ -3194,7 +3198,8 @@ def _update_strl_names(self) -> None:
31943198

31953199
def _convert_strls(self, data: DataFrame) -> DataFrame:
31963200
"""Convert columns to StrLs if either very large or in the
3197-
convert_strl variable"""
3201+
convert_strl variable
3202+
"""
31983203
convert_cols = [
31993204
col
32003205
for i, col in enumerate(data)

pandas/tests/groupby/test_categorical.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
def cartesian_product_for_groupers(result, args, names):
2222
""" Reindex to a cartesian production for the groupers,
23-
preserving the nature (Categorical) of each grouper """
23+
preserving the nature (Categorical) of each grouper
24+
"""
2425

2526
def f(a):
2627
if isinstance(a, (CategoricalIndex, Categorical)):

pandas/tests/indexing/multiindex/conftest.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def multiindex_dataframe_random_data():
2121
@pytest.fixture
2222
def multiindex_year_month_day_dataframe_random_data():
2323
"""DataFrame with 3 level MultiIndex (year, month, day) covering
24-
first 100 business days from 2000-01-01 with random data"""
24+
first 100 business days from 2000-01-01 with random data
25+
"""
2526
tdf = tm.makeTimeDataFrame(100)
2627
ymd = tdf.groupby([lambda x: x.year, lambda x: x.month, lambda x: x.day]).sum()
2728
# use Int64Index, to make sure things work

pandas/tests/indexing/test_floats.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,8 @@ def test_slice_integer(self):
503503

504504
def test_integer_positional_indexing(self):
505505
""" make sure that we are raising on positional indexing
506-
w.r.t. an integer index """
506+
w.r.t. an integer index
507+
"""
507508

508509
s = Series(range(2, 6), index=range(2, 6))
509510

pandas/tests/io/pytables/common.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def ensure_clean_path(path):
7575

7676
def _maybe_remove(store, key):
7777
"""For tests using tables, try removing the table to be sure there is
78-
no content from previous tests using the same table name."""
78+
no content from previous tests using the same table name.
79+
"""
7980
try:
8081
store.remove(key)
8182
except (ValueError, KeyError):

pandas/tests/io/test_compression.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ def test_with_missing_lzma():
129129

130130
def test_with_missing_lzma_runtime():
131131
"""Tests if RuntimeError is hit when calling lzma without
132-
having the module available."""
132+
having the module available.
133+
"""
133134
code = textwrap.dedent(
134135
"""
135136
import sys

pandas/tests/resample/conftest.py

+16-8
Original file line numberDiff line numberDiff line change
@@ -99,59 +99,67 @@ def _index_name():
9999
@pytest.fixture
100100
def index(_index_factory, _index_start, _index_end, _index_freq, _index_name):
101101
"""Fixture for parametrization of date_range, period_range and
102-
timedelta_range indexes"""
102+
timedelta_range indexes
103+
"""
103104
return _index_factory(_index_start, _index_end, freq=_index_freq, name=_index_name)
104105

105106

106107
@pytest.fixture
107108
def _static_values(index):
108109
"""Fixture for parametrization of values used in parametrization of
109110
Series and DataFrames with date_range, period_range and
110-
timedelta_range indexes"""
111+
timedelta_range indexes
112+
"""
111113
return np.arange(len(index))
112114

113115

114116
@pytest.fixture
115117
def _series_name():
116118
"""Fixture for parametrization of Series name for Series used with
117-
date_range, period_range and timedelta_range indexes"""
119+
date_range, period_range and timedelta_range indexes
120+
"""
118121
return None
119122

120123

121124
@pytest.fixture
122125
def series(index, _series_name, _static_values):
123126
"""Fixture for parametrization of Series with date_range, period_range and
124-
timedelta_range indexes"""
127+
timedelta_range indexes
128+
"""
125129
return Series(_static_values, index=index, name=_series_name)
126130

127131

128132
@pytest.fixture
129133
def empty_series(series):
130134
"""Fixture for parametrization of empty Series with date_range,
131-
period_range and timedelta_range indexes"""
135+
period_range and timedelta_range indexes
136+
"""
132137
return series[:0]
133138

134139

135140
@pytest.fixture
136141
def frame(index, _series_name, _static_values):
137142
"""Fixture for parametrization of DataFrame with date_range, period_range
138-
and timedelta_range indexes"""
143+
and timedelta_range indexes
144+
"""
139145
# _series_name is intentionally unused
140146
return DataFrame({"value": _static_values}, index=index)
141147

142148

143149
@pytest.fixture
144150
def empty_frame(series):
145151
"""Fixture for parametrization of empty DataFrame with date_range,
146-
period_range and timedelta_range indexes"""
152+
period_range and timedelta_range indexes
153+
"""
147154
index = series.index[:0]
148155
return DataFrame(index=index)
149156

150157

151158
@pytest.fixture(params=[Series, DataFrame])
152159
def series_and_frame(request, series, frame):
153160
"""Fixture for parametrization of Series and DataFrame with date_range,
154-
period_range and timedelta_range indexes"""
161+
period_range and timedelta_range indexes
162+
"""
155163
if request.param == Series:
156164
return series
157165
if request.param == DataFrame:

pandas/tests/reshape/merge/test_merge_index_as_string.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def df2():
3030
@pytest.fixture(params=[[], ["outer"], ["outer", "inner"]])
3131
def left_df(request, df1):
3232
""" Construct left test DataFrame with specified levels
33-
(any of 'outer', 'inner', and 'v1')"""
33+
(any of 'outer', 'inner', and 'v1')
34+
"""
3435
levels = request.param
3536
if levels:
3637
df1 = df1.set_index(levels)
@@ -41,7 +42,8 @@ def left_df(request, df1):
4142
@pytest.fixture(params=[[], ["outer"], ["outer", "inner"]])
4243
def right_df(request, df2):
4344
""" Construct right test DataFrame with specified levels
44-
(any of 'outer', 'inner', and 'v2')"""
45+
(any of 'outer', 'inner', and 'v2')
46+
"""
4547
levels = request.param
4648

4749
if levels:

pandas/tests/test_register_accessor.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
@contextlib.contextmanager
1010
def ensure_removed(obj, attr):
1111
"""Ensure that an attribute added to 'obj' during the test is
12-
removed when we're done"""
12+
removed when we're done
13+
"""
1314
try:
1415
yield
1516
finally:

0 commit comments

Comments
 (0)