Skip to content

CLN: remove empty parenteses on class creation #26323

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
merged 2 commits into from
May 9, 2019
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
4 changes: 2 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
invgrep -R --include="*.py" --include="*.pyx" -E "(DEPRECATED|DEPRECATE|Deprecated)(:|,|\.)" pandas
RET=$(($RET + $?)) ; echo $MSG "DONE"

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

MSG='Check for backticks incorrectly rendering because of missing spaces' ; echo $MSG
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/dtypes/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def test_mixed_dtypes_remain_object_array(self):
class TestTypeInference:

# Dummy class used for testing with Python objects
class Dummy():
class Dummy:
pass

def test_inferred_dtype_fixture(self, any_skipna_inferred_dtype):
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/test_alter_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import pandas.util.testing as tm


class TestDataFrameAlterAxes():
class TestDataFrameAlterAxes:

def test_set_index_directly(self, float_string_frame):
df = float_string_frame
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/frame/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def int_frame_const_col():
return df


class TestDataFrameApply():
class TestDataFrameApply:

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


class TestDataFrameAggregate():
class TestDataFrameAggregate:

def test_agg_transform(self, axis, float_frame):
other_axis = 1 if axis in {0, 'index'} else 0
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/test_asof.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def date_range_frame():
return DataFrame({'A': np.arange(N), 'B': np.arange(N)}, index=rng)


class TestFrameAsof():
class TestFrameAsof:

def test_basic(self, date_range_frame):
df = date_range_frame
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/test_block_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# structure


class TestDataFrameBlockInternals():
class TestDataFrameBlockInternals:
def test_setitem_invalidates_datetime_index_freq(self):
# GH#24096 altering a datetime64tz column inplace invalidates the
# `freq` attribute on the underlying DatetimeIndex
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/frame/test_combine_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pandas.util.testing import assert_frame_equal, assert_series_equal


class TestDataFrameConcatCommon():
class TestDataFrameConcatCommon:

def test_concat_multiple_frames_dtypes(self):

Expand Down Expand Up @@ -530,7 +530,7 @@ def test_concat_astype_dup_col(self):
tm.assert_frame_equal(result, expected)


class TestDataFrameCombineFirst():
class TestDataFrameCombineFirst:

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


class TestDataFrameUpdate():
class TestDataFrameUpdate:

def test_update_nan(self):
# #15593 #15617
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ def __len__(self, n):

def test_constructor_iterable(self):
# GH 21987
class Iter():
class Iter:
def __iter__(self):
for i in range(10):
yield [1, 2, 3]
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/frame/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _skip_if_no_pchip():
pytest.skip('scipy.interpolate.pchip missing')


class TestDataFrameMissingData():
class TestDataFrameMissingData:

def test_dropEmptyRows(self, float_frame):
N = len(float_frame.index)
Expand Down Expand Up @@ -643,7 +643,7 @@ def test_fill_value_when_combine_const(self):
assert_frame_equal(res, exp)


class TestDataFrameInterpolate():
class TestDataFrameInterpolate:

def test_interp_basic(self):
df = DataFrame({'A': [1, 2, np.nan, 4],
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/test_mutate_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Column add, remove, delete.


class TestDataFrameMutateColumns():
class TestDataFrameMutateColumns:

def test_assign(self):
df = DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/groupby/test_grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_getitem_numeric_column_names(self):
# grouping
# --------------------------------

class TestGrouping():
class TestGrouping:

def test_grouper_index_types(self):
# related GH5375
Expand Down Expand Up @@ -556,7 +556,7 @@ def test_list_grouper_with_nat(self):
# get_group
# --------------------------------

class TestGetGroup():
class TestGetGroup:
def test_get_group(self):
# GH 5267
# be datelike friendly
Expand Down Expand Up @@ -660,7 +660,7 @@ def test_gb_key_len_equal_axis_len(self):
# groups & iteration
# --------------------------------

class TestIteration():
class TestIteration:

def test_groups(self, df):
grouped = df.groupby(['A'])
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/parser/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,7 @@ def test_invalid_file_buffer_mock(all_parsers):
parser = all_parsers
msg = "Invalid file path or buffer object type"

class Foo():
class Foo:
pass

with pytest.raises(ValueError, match=msg):
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/io/test_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_read_csv_gcs(monkeypatch):
df1 = DataFrame({'int': [1, 3], 'float': [2.0, np.nan], 'str': ['t', 's'],
'dt': date_range('2018-06-18', periods=2)})

class MockGCSFileSystem():
class MockGCSFileSystem:
def open(*args):
return StringIO(df1.to_csv(index=False))

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

class MockGCSFileSystem():
class MockGCSFileSystem:
def open(*args):
return s

Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/series/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pandas.util.testing import assert_frame_equal, assert_series_equal


class TestSeriesApply():
class TestSeriesApply:

def test_apply(self, datetime_series):
with np.errstate(all='ignore'):
Expand Down Expand Up @@ -170,7 +170,7 @@ def test_apply_categorical_with_nan_values(self, series):
tm.assert_series_equal(result, expected)


class TestSeriesAggregate():
class TestSeriesAggregate:

def test_transform(self, string_series):
# transforming functions
Expand Down Expand Up @@ -416,7 +416,7 @@ def test_agg_cython_table_raises(self, series, func, expected):
series.agg(func)


class TestSeriesMap():
class TestSeriesMap:

def test_map(self, datetime_series):
index, data = tm.getMixedTypeDict()
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/series/test_asof.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pandas.util.testing as tm


class TestSeriesAsof():
class TestSeriesAsof:

def test_basic(self):

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/series/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def test_constructor_series(self):

def test_constructor_iterable(self):
# GH 21987
class Iter():
class Iter:
def __iter__(self):
for i in range(10):
yield i
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/series/test_datetime_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from pandas.util.testing import assert_series_equal


class TestSeriesDatetimeValues():
class TestSeriesDatetimeValues:

def test_dt_namespace_accessor(self):

Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/series/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pandas.io.common import _get_handle


class TestSeriesToCSV():
class TestSeriesToCSV:

def read_csv(self, path, **kwargs):
params = dict(squeeze=True, index_col=0,
Expand Down Expand Up @@ -191,7 +191,7 @@ def test_to_csv_compression(self, s, encoding, compression):
encoding=encoding))


class TestSeriesIO():
class TestSeriesIO:

def test_to_frame(self, datetime_series):
datetime_series.name = None
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/series/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _simple_ts(start, end, freq='D'):
return Series(np.random.randn(len(rng)), index=rng)


class TestSeriesMissingData():
class TestSeriesMissingData:

def test_remove_na_deprecation(self):
# see gh-16971
Expand Down Expand Up @@ -875,7 +875,7 @@ def interp_methods_ind(request):
return method, kwargs


class TestSeriesInterpolateData():
class TestSeriesInterpolateData:
def test_interpolate(self, datetime_series, string_series):
ts = Series(np.arange(len(datetime_series), dtype=float),
datetime_series.index)
Expand Down
2 changes: 1 addition & 1 deletion pandas/util/_test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
The decorators can be applied to classes:

@td.skip_if_some_reason
class Foo():
class Foo:
...

Or individual functions:
Expand Down