Skip to content

Commit 6e5b5a6

Browse files
committed
CLN: Use new-style classes instead of old-style classes
1 parent d7a4f5b commit 6e5b5a6

File tree

14 files changed

+26
-18
lines changed

14 files changed

+26
-18
lines changed

ci/lint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@ if [ "$LINT" ]; then
165165
RET=1
166166
fi
167167
echo "Check for deprecated messages without sphinx directive DONE"
168+
169+
echo "Check for old-style classes"
170+
grep -R --include="*.py" -E "class\s\S*[^)]:" pandas scripts
171+
172+
if [ $? = "0" ]; then
173+
RET=1
174+
fi
175+
echo "Check for old-style classes DONE"
168176

169177
else
170178
echo "NOT Linting"

pandas/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def get_keywords():
2525
return keywords
2626

2727

28-
class VersioneerConfig:
28+
class VersioneerConfig(object):
2929
pass
3030

3131

pandas/io/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ def __next__(self):
534534
row = next(self.reader)
535535
return [compat.text_type(s, "utf-8") for s in row]
536536

537-
class UnicodeWriter:
537+
class UnicodeWriter(object):
538538

539539
"""
540540
A CSV writer which will write rows to CSV file "f",

pandas/io/sas/sas_constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
61: "wcyrillic", 62: "wlatin1", 90: "ebcdic870"}
103103

104104

105-
class index:
105+
class index(object):
106106
rowSizeIndex = 0
107107
columnSizeIndex = 1
108108
subheaderCountsIndex = 2

pandas/tests/frame/test_analytics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ def wrapper(x):
12151215
getattr(mixed, name)(axis=0)
12161216
getattr(mixed, name)(axis=1)
12171217

1218-
class NonzeroFail:
1218+
class NonzeroFail(object):
12191219

12201220
def __nonzero__(self):
12211221
raise ValueError

pandas/tests/indexing/test_panel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def test_panel_getitem(self):
149149

150150
# with an object-like
151151
# GH 9140
152-
class TestObject:
152+
class TestObject(object):
153153

154154
def __str__(self):
155155
return "TestObject"

pandas/tests/io/formats/test_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,7 @@ def test_pprint_pathological_object(self):
16211621
If the test fails, it at least won't hang.
16221622
"""
16231623

1624-
class A:
1624+
class A(object):
16251625
def __getitem__(self, key):
16261626
return 3 # obviously simplified
16271627

pandas/tests/io/json/test_ujson.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,11 @@ def test_decodeFromUnicode(self):
460460
def test_encodeRecursionMax(self):
461461
# 8 is the max recursion depth
462462

463-
class O2:
463+
class O2(object):
464464
member = 0
465465
pass
466466

467-
class O1:
467+
class O1(object):
468468
member = 0
469469
pass
470470

@@ -772,7 +772,7 @@ def test_dumpToFile(self):
772772
assert "[1,2,3]" == f.getvalue()
773773

774774
def test_dumpToFileLikeObject(self):
775-
class filelike:
775+
class filelike(object):
776776

777777
def __init__(self):
778778
self.bytes = ''
@@ -800,7 +800,7 @@ def test_loadFile(self):
800800
np.array([1, 2, 3, 4]), ujson.load(f, numpy=True))
801801

802802
def test_loadFileLikeObject(self):
803-
class filelike:
803+
class filelike(object):
804804

805805
def read(self):
806806
try:
@@ -837,7 +837,7 @@ def test_encodeNumericOverflow(self):
837837

838838
def test_encodeNumericOverflowNested(self):
839839
for n in range(0, 100):
840-
class Nested:
840+
class Nested(object):
841841
x = 12839128391289382193812939
842842

843843
nested = Nested()
@@ -886,7 +886,7 @@ def test_decodeBigEscape(self):
886886
def test_toDict(self):
887887
d = {u("key"): 31337}
888888

889-
class DictTest:
889+
class DictTest(object):
890890

891891
def toDict(self):
892892
return d

pandas/tests/scalar/timedelta/test_timedelta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_ops_error_str(self):
3737
assert left != right
3838

3939
def test_ops_notimplemented(self):
40-
class Other:
40+
class Other(object):
4141
pass
4242

4343
other = Other()

pandas/tests/sparse/frame/test_frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def test_constructor_from_dense_series(self):
227227

228228
def test_constructor_from_unknown_type(self):
229229
# GH 19393
230-
class Unknown:
230+
class Unknown(object):
231231
pass
232232
with pytest.raises(TypeError,
233233
message='SparseDataFrame called with unknown type '

pandas/tests/test_errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def test_error_rename():
5454
pass
5555

5656

57-
class Foo:
57+
class Foo(object):
5858
@classmethod
5959
def classmethod(cls):
6060
raise AbstractMethodError(cls, methodtype='classmethod')

pandas/tests/test_resample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ def test_resample_how_callables(self):
10821082
def fn(x, a=1):
10831083
return str(type(x))
10841084

1085-
class fn_class:
1085+
class fn_class(object):
10861086

10871087
def __call__(self, x):
10881088
return str(type(x))

scripts/validate_docstrings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def _output_header(title, width=80, char='#'):
9494
full_line=full_line, title_line=title_line)
9595

9696

97-
class Docstring:
97+
class Docstring(object):
9898
def __init__(self, method_name, method_obj):
9999
self.method_name = method_name
100100
self.method_obj = method_obj

versioneer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@
352352
import sys
353353

354354

355-
class VersioneerConfig:
355+
class VersioneerConfig(object):
356356
pass
357357

358358

0 commit comments

Comments
 (0)