Skip to content

CLN: D209 Multi-line docstring closing quotes should be on a separate line #31891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pandas/_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2150,7 +2150,8 @@ def optional_args(decorator):
@my_decorator
def function(): pass

Calls decorator with decorator(f, *args, **kwargs)"""
Calls decorator with decorator(f, *args, **kwargs)
"""

@wraps(decorator)
def wrapper(*args, **kwargs):
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/arrays/sparse/scipy_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def _check_is_partition(parts, whole):
def _to_ijv(ss, row_levels=(0,), column_levels=(1,), sort_labels=False):
""" For arbitrary (MultiIndexed) sparse Series return
(v, i, j, ilabels, jlabels) where (v, (i, j)) is suitable for
passing to scipy.sparse.coo constructor. """
passing to scipy.sparse.coo constructor.
"""
# index and column levels must be a partition of the index
_check_is_partition([row_levels, column_levels], range(ss.index.nlevels))

Expand Down
6 changes: 4 additions & 2 deletions pandas/core/computation/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ def is_valid(self) -> bool:
@property
def is_in_table(self) -> bool:
""" return True if this is a valid column name for generation (e.g. an
actual column in the table) """
actual column in the table)
"""
return self.queryables.get(self.lhs) is not None

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

def convert_value(self, v) -> "TermValue":
""" convert the expression that is in the term to something that is
accepted by pytables """
accepted by pytables
"""

def stringify(value):
if self.encoding is not None:
Expand Down
3 changes: 2 additions & 1 deletion pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,8 @@ def _value_with_fmt(self, val):
@classmethod
def check_extension(cls, ext):
"""checks that path's extension against the Writer's supported
extensions. If it isn't supported, raises UnsupportedFiletypeError."""
extensions. If it isn't supported, raises UnsupportedFiletypeError.
"""
if ext.startswith("."):
ext = ext[1:]
if not any(ext in extension for extension in cls.supported_extensions):
Expand Down
15 changes: 10 additions & 5 deletions pandas/io/stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2129,7 +2129,8 @@ def _write_bytes(self, value: bytes) -> None:

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

is_cat = [is_categorical_dtype(data[col]) for col in data]
self._is_col_cat = is_cat
Expand Down Expand Up @@ -2171,7 +2172,8 @@ def _prepare_categoricals(self, data: DataFrame) -> DataFrame:
def _replace_nans(self, data: DataFrame) -> DataFrame:
# return data
"""Checks floating point data columns for nans, and replaces these with
the generic Stata for missing value (.)"""
the generic Stata for missing value (.)
"""
for c in data:
dtype = data[c].dtype
if dtype in (np.float32, np.float64):
Expand Down Expand Up @@ -3037,7 +3039,8 @@ def _write_header(
def _write_map(self) -> None:
"""Called twice during file write. The first populates the values in
the map with 0s. The second call writes the final map locations when
all blocks have been written."""
all blocks have been written.
"""
assert self._file is not None
if not self._map:
self._map = dict(
Expand Down Expand Up @@ -3185,7 +3188,8 @@ def _write_file_close_tag(self) -> None:

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

def _convert_strls(self, data: DataFrame) -> DataFrame:
"""Convert columns to StrLs if either very large or in the
convert_strl variable"""
convert_strl variable
"""
convert_cols = [
col
for i, col in enumerate(data)
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/groupby/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

def cartesian_product_for_groupers(result, args, names):
""" Reindex to a cartesian production for the groupers,
preserving the nature (Categorical) of each grouper """
preserving the nature (Categorical) of each grouper
"""

def f(a):
if isinstance(a, (CategoricalIndex, Categorical)):
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/indexing/multiindex/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def multiindex_dataframe_random_data():
@pytest.fixture
def multiindex_year_month_day_dataframe_random_data():
"""DataFrame with 3 level MultiIndex (year, month, day) covering
first 100 business days from 2000-01-01 with random data"""
first 100 business days from 2000-01-01 with random data
"""
tdf = tm.makeTimeDataFrame(100)
ymd = tdf.groupby([lambda x: x.year, lambda x: x.month, lambda x: x.day]).sum()
# use Int64Index, to make sure things work
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/indexing/test_floats.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,8 @@ def test_slice_integer(self):

def test_integer_positional_indexing(self):
""" make sure that we are raising on positional indexing
w.r.t. an integer index """
w.r.t. an integer index
"""

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

Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/io/pytables/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def ensure_clean_path(path):

def _maybe_remove(store, key):
"""For tests using tables, try removing the table to be sure there is
no content from previous tests using the same table name."""
no content from previous tests using the same table name.
"""
try:
store.remove(key)
except (ValueError, KeyError):
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/io/test_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def test_with_missing_lzma():

def test_with_missing_lzma_runtime():
"""Tests if RuntimeError is hit when calling lzma without
having the module available."""
having the module available.
"""
code = textwrap.dedent(
"""
import sys
Expand Down
24 changes: 16 additions & 8 deletions pandas/tests/resample/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,59 +99,67 @@ def _index_name():
@pytest.fixture
def index(_index_factory, _index_start, _index_end, _index_freq, _index_name):
"""Fixture for parametrization of date_range, period_range and
timedelta_range indexes"""
timedelta_range indexes
"""
return _index_factory(_index_start, _index_end, freq=_index_freq, name=_index_name)


@pytest.fixture
def _static_values(index):
"""Fixture for parametrization of values used in parametrization of
Series and DataFrames with date_range, period_range and
timedelta_range indexes"""
timedelta_range indexes
"""
return np.arange(len(index))


@pytest.fixture
def _series_name():
"""Fixture for parametrization of Series name for Series used with
date_range, period_range and timedelta_range indexes"""
date_range, period_range and timedelta_range indexes
"""
return None


@pytest.fixture
def series(index, _series_name, _static_values):
"""Fixture for parametrization of Series with date_range, period_range and
timedelta_range indexes"""
timedelta_range indexes
"""
return Series(_static_values, index=index, name=_series_name)


@pytest.fixture
def empty_series(series):
"""Fixture for parametrization of empty Series with date_range,
period_range and timedelta_range indexes"""
period_range and timedelta_range indexes
"""
return series[:0]


@pytest.fixture
def frame(index, _series_name, _static_values):
"""Fixture for parametrization of DataFrame with date_range, period_range
and timedelta_range indexes"""
and timedelta_range indexes
"""
# _series_name is intentionally unused
return DataFrame({"value": _static_values}, index=index)


@pytest.fixture
def empty_frame(series):
"""Fixture for parametrization of empty DataFrame with date_range,
period_range and timedelta_range indexes"""
period_range and timedelta_range indexes
"""
index = series.index[:0]
return DataFrame(index=index)


@pytest.fixture(params=[Series, DataFrame])
def series_and_frame(request, series, frame):
"""Fixture for parametrization of Series and DataFrame with date_range,
period_range and timedelta_range indexes"""
period_range and timedelta_range indexes
"""
if request.param == Series:
return series
if request.param == DataFrame:
Expand Down
6 changes: 4 additions & 2 deletions pandas/tests/reshape/merge/test_merge_index_as_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def df2():
@pytest.fixture(params=[[], ["outer"], ["outer", "inner"]])
def left_df(request, df1):
""" Construct left test DataFrame with specified levels
(any of 'outer', 'inner', and 'v1')"""
(any of 'outer', 'inner', and 'v1')
"""
levels = request.param
if levels:
df1 = df1.set_index(levels)
Expand All @@ -41,7 +42,8 @@ def left_df(request, df1):
@pytest.fixture(params=[[], ["outer"], ["outer", "inner"]])
def right_df(request, df2):
""" Construct right test DataFrame with specified levels
(any of 'outer', 'inner', and 'v2')"""
(any of 'outer', 'inner', and 'v2')
"""
levels = request.param

if levels:
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/test_register_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
@contextlib.contextmanager
def ensure_removed(obj, attr):
"""Ensure that an attribute added to 'obj' during the test is
removed when we're done"""
removed when we're done
"""
try:
yield
finally:
Expand Down