diff --git a/pandas/core/computation/engines.py b/pandas/core/computation/engines.py index 833bc3143b968..a3a05a9d75c6e 100644 --- a/pandas/core/computation/engines.py +++ b/pandas/core/computation/engines.py @@ -102,7 +102,6 @@ def _evaluate(self): ----- Must be implemented by subclasses. """ - pass class NumExprEngine(AbstractEngine): diff --git a/pandas/core/dtypes/dtypes.py b/pandas/core/dtypes/dtypes.py index 85b1a2a61012a..e57e11f1bd2bd 100644 --- a/pandas/core/dtypes/dtypes.py +++ b/pandas/core/dtypes/dtypes.py @@ -116,8 +116,6 @@ class CategoricalDtypeType(type): the type of CategoricalDtype, this metaclass determines subclass ability """ - pass - @register_extension_dtype class CategoricalDtype(PandasExtensionDtype, ExtensionDtype): diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index 27058cb54dddf..3b8380a88bb8b 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -3610,7 +3610,6 @@ def _union(self, other, sort) -> MultiIndex: RuntimeWarning, stacklevel=find_stack_level(), ) - pass return result def _is_comparable_dtype(self, dtype: DtypeObj) -> bool: diff --git a/pandas/core/interchange/dataframe_protocol.py b/pandas/core/interchange/dataframe_protocol.py index 3ab87d9a60399..4ec905eef8646 100644 --- a/pandas/core/interchange/dataframe_protocol.py +++ b/pandas/core/interchange/dataframe_protocol.py @@ -134,7 +134,6 @@ def bufsize(self) -> int: """ Buffer size in bytes. """ - pass @property @abstractmethod @@ -142,7 +141,6 @@ def ptr(self) -> int: """ Pointer to start of the buffer as an integer. """ - pass @abstractmethod def __dlpack__(self): @@ -166,7 +164,6 @@ def __dlpack_device__(self) -> tuple[DlpackDeviceType, int | None]: Uses device type codes matching DLPack. Note: must be implemented even if ``__dlpack__`` is not. """ - pass class Column(ABC): @@ -222,7 +219,6 @@ def size(self) -> int: Corresponds to DataFrame.num_rows() if column is a single chunk; equal to size of this current chunk otherwise. """ - pass @property @abstractmethod @@ -234,7 +230,6 @@ def offset(self) -> int: equal size M (only the last chunk may be shorter), ``offset = n * M``, ``n = 0 .. N-1``. """ - pass @property @abstractmethod @@ -266,7 +261,6 @@ def dtype(self) -> tuple[DtypeKind, int, str, str]: - Data types not included: complex, Arrow-style null, binary, decimal, and nested (list, struct, map, union) dtypes. """ - pass @property @abstractmethod @@ -289,7 +283,6 @@ def describe_categorical(self) -> CategoricalDescription: TBD: are there any other in-memory representations that are needed? """ - pass @property @abstractmethod @@ -302,7 +295,6 @@ def describe_null(self) -> tuple[ColumnNullType, Any]: mask or a byte mask, the value (0 or 1) indicating a missing value. None otherwise. """ - pass @property @abstractmethod @@ -312,7 +304,6 @@ def null_count(self) -> int | None: Note: Arrow uses -1 to indicate "unknown", but None seems cleaner. """ - pass @property @abstractmethod @@ -320,14 +311,12 @@ def metadata(self) -> dict[str, Any]: """ The metadata for the column. See `DataFrame.metadata` for more details. """ - pass @abstractmethod def num_chunks(self) -> int: """ Return the number of chunks the column consists of. """ - pass @abstractmethod def get_chunks(self, n_chunks: int | None = None) -> Iterable[Column]: @@ -336,7 +325,6 @@ def get_chunks(self, n_chunks: int | None = None) -> Iterable[Column]: See `DataFrame.get_chunks` for details on ``n_chunks``. """ - pass @abstractmethod def get_buffers(self) -> ColumnBuffers: @@ -360,7 +348,6 @@ def get_buffers(self) -> ColumnBuffers: if the data buffer does not have an associated offsets buffer. """ - pass # def get_children(self) -> Iterable[Column]: @@ -391,7 +378,6 @@ class DataFrame(ABC): @abstractmethod def __dataframe__(self, nan_as_null: bool = False, allow_copy: bool = True): """Construct a new interchange object, potentially changing the parameters.""" - pass @property @abstractmethod @@ -405,14 +391,12 @@ def metadata(self) -> dict[str, Any]: entries, please add name the keys with the name of the library followed by a period and the desired name, e.g, ``pandas.indexcol``. """ - pass @abstractmethod def num_columns(self) -> int: """ Return the number of columns in the DataFrame. """ - pass @abstractmethod def num_rows(self) -> int | None: @@ -422,56 +406,48 @@ def num_rows(self) -> int | None: """ Return the number of rows in the DataFrame, if available. """ - pass @abstractmethod def num_chunks(self) -> int: """ Return the number of chunks the DataFrame consists of. """ - pass @abstractmethod def column_names(self) -> Iterable[str]: """ Return an iterator yielding the column names. """ - pass @abstractmethod def get_column(self, i: int) -> Column: """ Return the column at the indicated position. """ - pass @abstractmethod def get_column_by_name(self, name: str) -> Column: """ Return the column whose name is the indicated name. """ - pass @abstractmethod def get_columns(self) -> Iterable[Column]: """ Return an iterator yielding the columns. """ - pass @abstractmethod def select_columns(self, indices: Sequence[int]) -> DataFrame: """ Create a new DataFrame by selecting a subset of columns by index. """ - pass @abstractmethod def select_columns_by_name(self, names: Sequence[str]) -> DataFrame: """ Create a new DataFrame by selecting a subset of columns by name. """ - pass @abstractmethod def get_chunks(self, n_chunks: int | None = None) -> Iterable[DataFrame]: @@ -483,4 +459,3 @@ def get_chunks(self, n_chunks: int | None = None) -> Iterable[DataFrame]: ``self.num_chunks()``, meaning the producer must subdivide each chunk before yielding it. """ - pass diff --git a/pandas/io/excel/_base.py b/pandas/io/excel/_base.py index bc3abfb94f31c..0b284fd4e9750 100644 --- a/pandas/io/excel/_base.py +++ b/pandas/io/excel/_base.py @@ -1142,7 +1142,6 @@ def engine(self) -> str: @abc.abstractmethod def sheets(self) -> dict[str, Any]: """Mapping of sheet names to sheet objects.""" - pass @property @abc.abstractmethod @@ -1152,7 +1151,6 @@ def book(self): This attribute can be used to access engine-specific features. """ - pass @book.setter @abc.abstractmethod @@ -1160,7 +1158,6 @@ def book(self, other) -> None: """ Set book instance. Class type will depend on the engine used. """ - pass def write_cells( self, @@ -1212,7 +1209,6 @@ def _write_cells( freeze_panes: int tuple of length 2 contains the bottom-most row and right-most column to freeze """ - pass def save(self) -> None: """ @@ -1228,7 +1224,6 @@ def _save(self) -> None: """ Save workbook to disk. """ - pass def __init__( self, diff --git a/pandas/io/json/_json.py b/pandas/io/json/_json.py index 67c81db8d3a8f..c6ee535c1bb0b 100644 --- a/pandas/io/json/_json.py +++ b/pandas/io/json/_json.py @@ -249,7 +249,6 @@ def write(self) -> str: @abstractmethod def obj_to_write(self) -> NDFrame | Mapping[IndexLabel, Any]: """Object to write in JSON format.""" - pass class SeriesWriter(Writer): diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 483c385fa32fc..1f2bb4c5d21b4 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -2593,8 +2593,6 @@ def get_atom_timedelta64(cls, shape): class GenericDataIndexableCol(DataIndexableCol): """represent a generic pytables data column""" - pass - class Fixed: """ @@ -2701,11 +2699,9 @@ def attrs(self): def set_attrs(self) -> None: """set our object attributes""" - pass def get_attrs(self) -> None: """get our object attributes""" - pass @property def storable(self): @@ -2728,7 +2724,6 @@ def validate(self, other) -> Literal[True] | None: def validate_version(self, where=None) -> None: """are we trying to operate on an old version?""" - pass def infer_axes(self) -> bool: """ diff --git a/pandas/io/stata.py b/pandas/io/stata.py index 60c710d1930ed..5860aa4ae7c3e 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -2417,7 +2417,6 @@ def _replace_nans(self, data: DataFrame) -> DataFrame: def _update_strl_names(self) -> None: """No-op, forward compatibility""" - pass def _validate_variable_name(self, name: str) -> str: """ @@ -2701,19 +2700,15 @@ def _close(self) -> None: def _write_map(self) -> None: """No-op, future compatibility""" - pass def _write_file_close_tag(self) -> None: """No-op, future compatibility""" - pass def _write_characteristics(self) -> None: """No-op, future compatibility""" - pass def _write_strls(self) -> None: """No-op, future compatibility""" - pass def _write_expansion_fields(self) -> None: """Write 5 zeros for expansion fields""" @@ -3438,7 +3433,6 @@ def _write_strls(self) -> None: def _write_expansion_fields(self) -> None: """No-op in dta 117+""" - pass def _write_value_labels(self) -> None: self._update_map("value_labels") diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py index 9bcb51a7b032a..95d1d7db1ab9a 100644 --- a/pandas/plotting/_matplotlib/core.py +++ b/pandas/plotting/_matplotlib/core.py @@ -668,7 +668,6 @@ def _post_plot_logic_common(self, ax, data): def _post_plot_logic(self, ax, data) -> None: """Post process for each axes. Overridden in child classes""" - pass def _adorn_subplots(self): """Common post process unrelated to data""" diff --git a/pandas/tests/base/test_constructors.py b/pandas/tests/base/test_constructors.py index c8b923031b9e8..5f654ca3a996b 100644 --- a/pandas/tests/base/test_constructors.py +++ b/pandas/tests/base/test_constructors.py @@ -56,7 +56,6 @@ def _get_foo(self): def bar(self, *args, **kwargs): """a test bar method""" - pass class Delegate(PandasDelegate, PandasObject): def __init__(self, obj) -> None: diff --git a/pandas/tests/indexes/interval/test_constructors.py b/pandas/tests/indexes/interval/test_constructors.py index 315578a5dbf50..f8c6042c5007d 100644 --- a/pandas/tests/indexes/interval/test_constructors.py +++ b/pandas/tests/indexes/interval/test_constructors.py @@ -377,7 +377,6 @@ def test_generic_errors(self, constructor): override the base class implementation since errors are handled differently; checks unnecessary since caught at the Interval level """ - pass def test_constructor_string(self): # GH23013 diff --git a/pandas/tests/io/json/test_ujson.py b/pandas/tests/io/json/test_ujson.py index 28545b7ab2cc6..109c6dbb469c9 100644 --- a/pandas/tests/io/json/test_ujson.py +++ b/pandas/tests/io/json/test_ujson.py @@ -423,11 +423,9 @@ def test_encode_recursion_max(self): class O2: member = 0 - pass class O1: member = 0 - pass decoded_input = O1() decoded_input.member = O2() diff --git a/pandas/tests/io/parser/test_parse_dates.py b/pandas/tests/io/parser/test_parse_dates.py index 40b08e6d68016..890819d42841e 100644 --- a/pandas/tests/io/parser/test_parse_dates.py +++ b/pandas/tests/io/parser/test_parse_dates.py @@ -1673,7 +1673,6 @@ def _helper_hypothesis_delimited_date(call, date_string, **kwargs): result = call(date_string, **kwargs) except ValueError as er: msg = str(er) - pass return msg, result diff --git a/pandas/tests/util/test_deprecate.py b/pandas/tests/util/test_deprecate.py index ee4f7e3f34f2e..92f422b8269f5 100644 --- a/pandas/tests/util/test_deprecate.py +++ b/pandas/tests/util/test_deprecate.py @@ -34,7 +34,6 @@ def new_func_with_deprecation(): This is the extended summary. The deprecate directive goes before this. """ - pass def test_deprecate_ok(): diff --git a/pyproject.toml b/pyproject.toml index aecb4cc82cbbc..4f1e072de7e8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -177,7 +177,6 @@ disable = [ "try-except-raise", "undefined-loop-variable", "unnecessary-lambda", - "unnecessary-pass", "unspecified-encoding", "unused-argument", "unused-import", diff --git a/scripts/tests/test_validate_docstrings.py b/scripts/tests/test_validate_docstrings.py index dcfef648e8f1c..35bc477d5b3d5 100644 --- a/scripts/tests/test_validate_docstrings.py +++ b/scripts/tests/test_validate_docstrings.py @@ -23,7 +23,6 @@ def prefix_pandas(self): pandas.Series.rename : Alter Series index labels or name. DataFrame.head : The first `n` rows of the caller object. """ - pass def redundant_import(self, foo=None, bar=None): """ @@ -45,7 +44,6 @@ def redundant_import(self, foo=None, bar=None): >>> df.all(bool_only=True) Series([], dtype: bool) """ - pass def unused_import(self): """ @@ -54,7 +52,6 @@ def unused_import(self): >>> import pandas as pdf >>> df = pd.DataFrame(np.ones((3, 3)), columns=('a', 'b', 'c')) """ - pass def missing_whitespace_around_arithmetic_operator(self): """ @@ -63,7 +60,6 @@ def missing_whitespace_around_arithmetic_operator(self): >>> 2+5 7 """ - pass def indentation_is_not_a_multiple_of_four(self): """ @@ -72,7 +68,6 @@ def indentation_is_not_a_multiple_of_four(self): >>> if 2 + 5: ... pass """ - pass def missing_whitespace_after_comma(self): """ @@ -80,13 +75,11 @@ def missing_whitespace_after_comma(self): -------- >>> df = pd.DataFrame(np.ones((3,3)),columns=('a','b', 'c')) """ - pass def write_array_like_with_hyphen_not_underscore(self): """ In docstrings, use array-like over array_like """ - pass def leftover_files(self): """ @@ -95,7 +88,6 @@ def leftover_files(self): >>> import pathlib >>> pathlib.Path("foo.txt").touch() """ - pass class TestValidator: