Skip to content

Commit ee6b131

Browse files
topper-123jschendel
authored andcommitted
CLN: remove empty parenteses on class creation (#26323)
1 parent 17247ed commit ee6b131

20 files changed

+32
-32
lines changed

Diff for: ci/code_checks.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
148148
invgrep -R --include="*.py" --include="*.pyx" -E "(DEPRECATED|DEPRECATE|Deprecated)(:|,|\.)" pandas
149149
RET=$(($RET + $?)) ; echo $MSG "DONE"
150150

151-
MSG='Check for python2 new-style classes' ; echo $MSG
152-
invgrep -R --include="*.py" --include="*.pyx" -E "class\s\S*\(object\):" pandas scripts
151+
MSG='Check for python2 new-style classes and for for empty parenteses' ; echo $MSG
152+
invgrep -R --include="*.py" --include="*.pyx" -E "class\s\S*\((object)?\):" pandas scripts
153153
RET=$(($RET + $?)) ; echo $MSG "DONE"
154154

155155
MSG='Check for backticks incorrectly rendering because of missing spaces' ; echo $MSG

Diff for: pandas/tests/dtypes/test_inference.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ def test_mixed_dtypes_remain_object_array(self):
497497
class TestTypeInference:
498498

499499
# Dummy class used for testing with Python objects
500-
class Dummy():
500+
class Dummy:
501501
pass
502502

503503
def test_inferred_dtype_fixture(self, any_skipna_inferred_dtype):

Diff for: pandas/tests/frame/test_alter_axes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import pandas.util.testing as tm
1414

1515

16-
class TestDataFrameAlterAxes():
16+
class TestDataFrameAlterAxes:
1717

1818
def test_set_index_directly(self, float_string_frame):
1919
df = float_string_frame

Diff for: pandas/tests/frame/test_apply.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def int_frame_const_col():
2929
return df
3030

3131

32-
class TestDataFrameApply():
32+
class TestDataFrameApply:
3333

3434
def test_apply(self, float_frame):
3535
with np.errstate(all='ignore'):
@@ -829,7 +829,7 @@ def zip_frames(frames, axis=1):
829829
return pd.DataFrame(zipped)
830830

831831

832-
class TestDataFrameAggregate():
832+
class TestDataFrameAggregate:
833833

834834
def test_agg_transform(self, axis, float_frame):
835835
other_axis = 1 if axis in {0, 'index'} else 0

Diff for: pandas/tests/frame/test_asof.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def date_range_frame():
1717
return DataFrame({'A': np.arange(N), 'B': np.arange(N)}, index=rng)
1818

1919

20-
class TestFrameAsof():
20+
class TestFrameAsof:
2121

2222
def test_basic(self, date_range_frame):
2323
df = date_range_frame

Diff for: pandas/tests/frame/test_block_internals.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# structure
2020

2121

22-
class TestDataFrameBlockInternals():
22+
class TestDataFrameBlockInternals:
2323
def test_setitem_invalidates_datetime_index_freq(self):
2424
# GH#24096 altering a datetime64tz column inplace invalidates the
2525
# `freq` attribute on the underlying DatetimeIndex

Diff for: pandas/tests/frame/test_combine_concat.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pandas.util.testing import assert_frame_equal, assert_series_equal
1010

1111

12-
class TestDataFrameConcatCommon():
12+
class TestDataFrameConcatCommon:
1313

1414
def test_concat_multiple_frames_dtypes(self):
1515

@@ -530,7 +530,7 @@ def test_concat_astype_dup_col(self):
530530
tm.assert_frame_equal(result, expected)
531531

532532

533-
class TestDataFrameCombineFirst():
533+
class TestDataFrameCombineFirst:
534534

535535
def test_combine_first_mixed(self):
536536
a = Series(['a', 'b'], index=range(2))
@@ -865,7 +865,7 @@ def test_concat_datetime_datetime64_frame(self):
865865
pd.concat([df1, df2_obj])
866866

867867

868-
class TestDataFrameUpdate():
868+
class TestDataFrameUpdate:
869869

870870
def test_update_nan(self):
871871
# #15593 #15617

Diff for: pandas/tests/frame/test_constructors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ def __len__(self, n):
10011001

10021002
def test_constructor_iterable(self):
10031003
# GH 21987
1004-
class Iter():
1004+
class Iter:
10051005
def __iter__(self):
10061006
for i in range(10):
10071007
yield [1, 2, 3]

Diff for: pandas/tests/frame/test_missing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def _skip_if_no_pchip():
2121
pytest.skip('scipy.interpolate.pchip missing')
2222

2323

24-
class TestDataFrameMissingData():
24+
class TestDataFrameMissingData:
2525

2626
def test_dropEmptyRows(self, float_frame):
2727
N = len(float_frame.index)
@@ -643,7 +643,7 @@ def test_fill_value_when_combine_const(self):
643643
assert_frame_equal(res, exp)
644644

645645

646-
class TestDataFrameInterpolate():
646+
class TestDataFrameInterpolate:
647647

648648
def test_interp_basic(self):
649649
df = DataFrame({'A': [1, 2, np.nan, 4],

Diff for: pandas/tests/frame/test_mutate_columns.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# Column add, remove, delete.
1111

1212

13-
class TestDataFrameMutateColumns():
13+
class TestDataFrameMutateColumns:
1414

1515
def test_assign(self):
1616
df = DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})

Diff for: pandas/tests/groupby/test_grouping.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_getitem_numeric_column_names(self):
9393
# grouping
9494
# --------------------------------
9595

96-
class TestGrouping():
96+
class TestGrouping:
9797

9898
def test_grouper_index_types(self):
9999
# related GH5375
@@ -556,7 +556,7 @@ def test_list_grouper_with_nat(self):
556556
# get_group
557557
# --------------------------------
558558

559-
class TestGetGroup():
559+
class TestGetGroup:
560560
def test_get_group(self):
561561
# GH 5267
562562
# be datelike friendly
@@ -660,7 +660,7 @@ def test_gb_key_len_equal_axis_len(self):
660660
# groups & iteration
661661
# --------------------------------
662662

663-
class TestIteration():
663+
class TestIteration:
664664

665665
def test_groups(self, df):
666666
grouped = df.groupby(['A'])

Diff for: pandas/tests/io/parser/test_common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,7 @@ def test_invalid_file_buffer_mock(all_parsers):
18051805
parser = all_parsers
18061806
msg = "Invalid file path or buffer object type"
18071807

1808-
class Foo():
1808+
class Foo:
18091809
pass
18101810

18111811
with pytest.raises(ValueError, match=msg):

Diff for: pandas/tests/io/test_gcs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_read_csv_gcs(monkeypatch):
2121
df1 = DataFrame({'int': [1, 3], 'float': [2.0, np.nan], 'str': ['t', 's'],
2222
'dt': date_range('2018-06-18', periods=2)})
2323

24-
class MockGCSFileSystem():
24+
class MockGCSFileSystem:
2525
def open(*args):
2626
return StringIO(df1.to_csv(index=False))
2727

@@ -37,7 +37,7 @@ def test_to_csv_gcs(monkeypatch):
3737
'dt': date_range('2018-06-18', periods=2)})
3838
s = StringIO()
3939

40-
class MockGCSFileSystem():
40+
class MockGCSFileSystem:
4141
def open(*args):
4242
return s
4343

Diff for: pandas/tests/series/test_apply.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pandas.util.testing import assert_frame_equal, assert_series_equal
1212

1313

14-
class TestSeriesApply():
14+
class TestSeriesApply:
1515

1616
def test_apply(self, datetime_series):
1717
with np.errstate(all='ignore'):
@@ -170,7 +170,7 @@ def test_apply_categorical_with_nan_values(self, series):
170170
tm.assert_series_equal(result, expected)
171171

172172

173-
class TestSeriesAggregate():
173+
class TestSeriesAggregate:
174174

175175
def test_transform(self, string_series):
176176
# transforming functions
@@ -416,7 +416,7 @@ def test_agg_cython_table_raises(self, series, func, expected):
416416
series.agg(func)
417417

418418

419-
class TestSeriesMap():
419+
class TestSeriesMap:
420420

421421
def test_map(self, datetime_series):
422422
index, data = tm.getMixedTypeDict()

Diff for: pandas/tests/series/test_asof.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pandas.util.testing as tm
66

77

8-
class TestSeriesAsof():
8+
class TestSeriesAsof:
99

1010
def test_basic(self):
1111

Diff for: pandas/tests/series/test_constructors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def test_constructor_series(self):
192192

193193
def test_constructor_iterable(self):
194194
# GH 21987
195-
class Iter():
195+
class Iter:
196196
def __iter__(self):
197197
for i in range(10):
198198
yield i

Diff for: pandas/tests/series/test_datetime_values.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from pandas.util.testing import assert_series_equal
2222

2323

24-
class TestSeriesDatetimeValues():
24+
class TestSeriesDatetimeValues:
2525

2626
def test_dt_namespace_accessor(self):
2727

Diff for: pandas/tests/series/test_io.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pandas.io.common import _get_handle
1515

1616

17-
class TestSeriesToCSV():
17+
class TestSeriesToCSV:
1818

1919
def read_csv(self, path, **kwargs):
2020
params = dict(squeeze=True, index_col=0,
@@ -191,7 +191,7 @@ def test_to_csv_compression(self, s, encoding, compression):
191191
encoding=encoding))
192192

193193

194-
class TestSeriesIO():
194+
class TestSeriesIO:
195195

196196
def test_to_frame(self, datetime_series):
197197
datetime_series.name = None

Diff for: pandas/tests/series/test_missing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _simple_ts(start, end, freq='D'):
3939
return Series(np.random.randn(len(rng)), index=rng)
4040

4141

42-
class TestSeriesMissingData():
42+
class TestSeriesMissingData:
4343

4444
def test_remove_na_deprecation(self):
4545
# see gh-16971
@@ -875,7 +875,7 @@ def interp_methods_ind(request):
875875
return method, kwargs
876876

877877

878-
class TestSeriesInterpolateData():
878+
class TestSeriesInterpolateData:
879879
def test_interpolate(self, datetime_series, string_series):
880880
ts = Series(np.arange(len(datetime_series), dtype=float),
881881
datetime_series.index)

Diff for: pandas/util/_test_decorators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
The decorators can be applied to classes:
1313
1414
@td.skip_if_some_reason
15-
class Foo():
15+
class Foo:
1616
...
1717
1818
Or individual functions:

0 commit comments

Comments
 (0)