Skip to content

Commit a791127

Browse files
natmokvalnoatamir
authored andcommitted
issue 48855 enable pylint unnecessary-pass (pandas-dev#49418)
issue 48855 enable unnecessary-pass
1 parent 76ce853 commit a791127

File tree

16 files changed

+0
-62
lines changed

16 files changed

+0
-62
lines changed

pandas/core/computation/engines.py

-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ def _evaluate(self):
102102
-----
103103
Must be implemented by subclasses.
104104
"""
105-
pass
106105

107106

108107
class NumExprEngine(AbstractEngine):

pandas/core/dtypes/dtypes.py

-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ class CategoricalDtypeType(type):
116116
the type of CategoricalDtype, this metaclass determines subclass ability
117117
"""
118118

119-
pass
120-
121119

122120
@register_extension_dtype
123121
class CategoricalDtype(PandasExtensionDtype, ExtensionDtype):

pandas/core/indexes/multi.py

-1
Original file line numberDiff line numberDiff line change
@@ -3610,7 +3610,6 @@ def _union(self, other, sort) -> MultiIndex:
36103610
RuntimeWarning,
36113611
stacklevel=find_stack_level(),
36123612
)
3613-
pass
36143613
return result
36153614

36163615
def _is_comparable_dtype(self, dtype: DtypeObj) -> bool:

pandas/core/interchange/dataframe_protocol.py

-25
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,13 @@ def bufsize(self) -> int:
134134
"""
135135
Buffer size in bytes.
136136
"""
137-
pass
138137

139138
@property
140139
@abstractmethod
141140
def ptr(self) -> int:
142141
"""
143142
Pointer to start of the buffer as an integer.
144143
"""
145-
pass
146144

147145
@abstractmethod
148146
def __dlpack__(self):
@@ -166,7 +164,6 @@ def __dlpack_device__(self) -> tuple[DlpackDeviceType, int | None]:
166164
Uses device type codes matching DLPack.
167165
Note: must be implemented even if ``__dlpack__`` is not.
168166
"""
169-
pass
170167

171168

172169
class Column(ABC):
@@ -222,7 +219,6 @@ def size(self) -> int:
222219
Corresponds to DataFrame.num_rows() if column is a single chunk;
223220
equal to size of this current chunk otherwise.
224221
"""
225-
pass
226222

227223
@property
228224
@abstractmethod
@@ -234,7 +230,6 @@ def offset(self) -> int:
234230
equal size M (only the last chunk may be shorter),
235231
``offset = n * M``, ``n = 0 .. N-1``.
236232
"""
237-
pass
238233

239234
@property
240235
@abstractmethod
@@ -266,7 +261,6 @@ def dtype(self) -> tuple[DtypeKind, int, str, str]:
266261
- Data types not included: complex, Arrow-style null, binary, decimal,
267262
and nested (list, struct, map, union) dtypes.
268263
"""
269-
pass
270264

271265
@property
272266
@abstractmethod
@@ -289,7 +283,6 @@ def describe_categorical(self) -> CategoricalDescription:
289283
290284
TBD: are there any other in-memory representations that are needed?
291285
"""
292-
pass
293286

294287
@property
295288
@abstractmethod
@@ -302,7 +295,6 @@ def describe_null(self) -> tuple[ColumnNullType, Any]:
302295
mask or a byte mask, the value (0 or 1) indicating a missing value. None
303296
otherwise.
304297
"""
305-
pass
306298

307299
@property
308300
@abstractmethod
@@ -312,22 +304,19 @@ def null_count(self) -> int | None:
312304
313305
Note: Arrow uses -1 to indicate "unknown", but None seems cleaner.
314306
"""
315-
pass
316307

317308
@property
318309
@abstractmethod
319310
def metadata(self) -> dict[str, Any]:
320311
"""
321312
The metadata for the column. See `DataFrame.metadata` for more details.
322313
"""
323-
pass
324314

325315
@abstractmethod
326316
def num_chunks(self) -> int:
327317
"""
328318
Return the number of chunks the column consists of.
329319
"""
330-
pass
331320

332321
@abstractmethod
333322
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]:
336325
337326
See `DataFrame.get_chunks` for details on ``n_chunks``.
338327
"""
339-
pass
340328

341329
@abstractmethod
342330
def get_buffers(self) -> ColumnBuffers:
@@ -360,7 +348,6 @@ def get_buffers(self) -> ColumnBuffers:
360348
if the data buffer does not have an associated offsets
361349
buffer.
362350
"""
363-
pass
364351

365352

366353
# def get_children(self) -> Iterable[Column]:
@@ -391,7 +378,6 @@ class DataFrame(ABC):
391378
@abstractmethod
392379
def __dataframe__(self, nan_as_null: bool = False, allow_copy: bool = True):
393380
"""Construct a new interchange object, potentially changing the parameters."""
394-
pass
395381

396382
@property
397383
@abstractmethod
@@ -405,14 +391,12 @@ def metadata(self) -> dict[str, Any]:
405391
entries, please add name the keys with the name of the library
406392
followed by a period and the desired name, e.g, ``pandas.indexcol``.
407393
"""
408-
pass
409394

410395
@abstractmethod
411396
def num_columns(self) -> int:
412397
"""
413398
Return the number of columns in the DataFrame.
414399
"""
415-
pass
416400

417401
@abstractmethod
418402
def num_rows(self) -> int | None:
@@ -422,56 +406,48 @@ def num_rows(self) -> int | None:
422406
"""
423407
Return the number of rows in the DataFrame, if available.
424408
"""
425-
pass
426409

427410
@abstractmethod
428411
def num_chunks(self) -> int:
429412
"""
430413
Return the number of chunks the DataFrame consists of.
431414
"""
432-
pass
433415

434416
@abstractmethod
435417
def column_names(self) -> Iterable[str]:
436418
"""
437419
Return an iterator yielding the column names.
438420
"""
439-
pass
440421

441422
@abstractmethod
442423
def get_column(self, i: int) -> Column:
443424
"""
444425
Return the column at the indicated position.
445426
"""
446-
pass
447427

448428
@abstractmethod
449429
def get_column_by_name(self, name: str) -> Column:
450430
"""
451431
Return the column whose name is the indicated name.
452432
"""
453-
pass
454433

455434
@abstractmethod
456435
def get_columns(self) -> Iterable[Column]:
457436
"""
458437
Return an iterator yielding the columns.
459438
"""
460-
pass
461439

462440
@abstractmethod
463441
def select_columns(self, indices: Sequence[int]) -> DataFrame:
464442
"""
465443
Create a new DataFrame by selecting a subset of columns by index.
466444
"""
467-
pass
468445

469446
@abstractmethod
470447
def select_columns_by_name(self, names: Sequence[str]) -> DataFrame:
471448
"""
472449
Create a new DataFrame by selecting a subset of columns by name.
473450
"""
474-
pass
475451

476452
@abstractmethod
477453
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]:
483459
``self.num_chunks()``, meaning the producer must subdivide each chunk
484460
before yielding it.
485461
"""
486-
pass

pandas/io/excel/_base.py

-5
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,6 @@ def engine(self) -> str:
11421142
@abc.abstractmethod
11431143
def sheets(self) -> dict[str, Any]:
11441144
"""Mapping of sheet names to sheet objects."""
1145-
pass
11461145

11471146
@property
11481147
@abc.abstractmethod
@@ -1152,15 +1151,13 @@ def book(self):
11521151
11531152
This attribute can be used to access engine-specific features.
11541153
"""
1155-
pass
11561154

11571155
@book.setter
11581156
@abc.abstractmethod
11591157
def book(self, other) -> None:
11601158
"""
11611159
Set book instance. Class type will depend on the engine used.
11621160
"""
1163-
pass
11641161

11651162
def write_cells(
11661163
self,
@@ -1212,7 +1209,6 @@ def _write_cells(
12121209
freeze_panes: int tuple of length 2
12131210
contains the bottom-most row and right-most column to freeze
12141211
"""
1215-
pass
12161212

12171213
def save(self) -> None:
12181214
"""
@@ -1228,7 +1224,6 @@ def _save(self) -> None:
12281224
"""
12291225
Save workbook to disk.
12301226
"""
1231-
pass
12321227

12331228
def __init__(
12341229
self,

pandas/io/json/_json.py

-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ def write(self) -> str:
248248
@abstractmethod
249249
def obj_to_write(self) -> NDFrame | Mapping[IndexLabel, Any]:
250250
"""Object to write in JSON format."""
251-
pass
252251

253252

254253
class SeriesWriter(Writer):

pandas/io/pytables.py

-5
Original file line numberDiff line numberDiff line change
@@ -2593,8 +2593,6 @@ def get_atom_timedelta64(cls, shape):
25932593
class GenericDataIndexableCol(DataIndexableCol):
25942594
"""represent a generic pytables data column"""
25952595

2596-
pass
2597-
25982596

25992597
class Fixed:
26002598
"""
@@ -2701,11 +2699,9 @@ def attrs(self):
27012699

27022700
def set_attrs(self) -> None:
27032701
"""set our object attributes"""
2704-
pass
27052702

27062703
def get_attrs(self) -> None:
27072704
"""get our object attributes"""
2708-
pass
27092705

27102706
@property
27112707
def storable(self):
@@ -2728,7 +2724,6 @@ def validate(self, other) -> Literal[True] | None:
27282724

27292725
def validate_version(self, where=None) -> None:
27302726
"""are we trying to operate on an old version?"""
2731-
pass
27322727

27332728
def infer_axes(self) -> bool:
27342729
"""

pandas/io/stata.py

-6
Original file line numberDiff line numberDiff line change
@@ -2417,7 +2417,6 @@ def _replace_nans(self, data: DataFrame) -> DataFrame:
24172417

24182418
def _update_strl_names(self) -> None:
24192419
"""No-op, forward compatibility"""
2420-
pass
24212420

24222421
def _validate_variable_name(self, name: str) -> str:
24232422
"""
@@ -2701,19 +2700,15 @@ def _close(self) -> None:
27012700

27022701
def _write_map(self) -> None:
27032702
"""No-op, future compatibility"""
2704-
pass
27052703

27062704
def _write_file_close_tag(self) -> None:
27072705
"""No-op, future compatibility"""
2708-
pass
27092706

27102707
def _write_characteristics(self) -> None:
27112708
"""No-op, future compatibility"""
2712-
pass
27132709

27142710
def _write_strls(self) -> None:
27152711
"""No-op, future compatibility"""
2716-
pass
27172712

27182713
def _write_expansion_fields(self) -> None:
27192714
"""Write 5 zeros for expansion fields"""
@@ -3438,7 +3433,6 @@ def _write_strls(self) -> None:
34383433

34393434
def _write_expansion_fields(self) -> None:
34403435
"""No-op in dta 117+"""
3441-
pass
34423436

34433437
def _write_value_labels(self) -> None:
34443438
self._update_map("value_labels")

pandas/plotting/_matplotlib/core.py

-1
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,6 @@ def _post_plot_logic_common(self, ax, data):
668668

669669
def _post_plot_logic(self, ax, data) -> None:
670670
"""Post process for each axes. Overridden in child classes"""
671-
pass
672671

673672
def _adorn_subplots(self):
674673
"""Common post process unrelated to data"""

pandas/tests/base/test_constructors.py

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def _get_foo(self):
5656

5757
def bar(self, *args, **kwargs):
5858
"""a test bar method"""
59-
pass
6059

6160
class Delegate(PandasDelegate, PandasObject):
6261
def __init__(self, obj) -> None:

pandas/tests/indexes/interval/test_constructors.py

-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ def test_generic_errors(self, constructor):
377377
override the base class implementation since errors are handled
378378
differently; checks unnecessary since caught at the Interval level
379379
"""
380-
pass
381380

382381
def test_constructor_string(self):
383382
# GH23013

pandas/tests/io/json/test_ujson.py

-2
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,9 @@ def test_encode_recursion_max(self):
423423

424424
class O2:
425425
member = 0
426-
pass
427426

428427
class O1:
429428
member = 0
430-
pass
431429

432430
decoded_input = O1()
433431
decoded_input.member = O2()

pandas/tests/io/parser/test_parse_dates.py

-1
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,6 @@ def _helper_hypothesis_delimited_date(call, date_string, **kwargs):
16731673
result = call(date_string, **kwargs)
16741674
except ValueError as er:
16751675
msg = str(er)
1676-
pass
16771676
return msg, result
16781677

16791678

pandas/tests/util/test_deprecate.py

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def new_func_with_deprecation():
3434
3535
This is the extended summary. The deprecate directive goes before this.
3636
"""
37-
pass
3837

3938

4039
def test_deprecate_ok():

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ disable = [
177177
"try-except-raise",
178178
"undefined-loop-variable",
179179
"unnecessary-lambda",
180-
"unnecessary-pass",
181180
"unspecified-encoding",
182181
"unused-argument",
183182
"unused-import",

0 commit comments

Comments
 (0)