-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
CLN: Use new-style classes instead of old-style classes #20563
CLN: Use new-style classes instead of old-style classes #20563
Conversation
@@ -165,6 +165,14 @@ if [ "$LINT" ]; then | |||
RET=1 | |||
fi | |||
echo "Check for deprecated messages without sphinx directive DONE" | |||
|
|||
echo "Check for old-style classes" | |||
grep -R --include="*.py" -E "class\s\S*[^)]:" pandas scripts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a regex wizard, so an extra careful look here would be appreciated
maybe we should add some extra flake8 plugins would need to add to the requirements_dev and prob modify the ci slightly to install can u make a separate issue? |
There's a Python package called hacking that has flake8 extensions that seems to have a lint check for this:
|
Codecov Report
@@ Coverage Diff @@
## master #20563 +/- ##
=======================================
Coverage 91.84% 91.84%
=======================================
Files 153 153
Lines 49256 49256
=======================================
Hits 45241 45241
Misses 4015 4015
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. some renamings. ping on green.
pandas/io/sas/sas_constants.py
Outdated
@@ -102,7 +102,7 @@ | |||
61: "wcyrillic", 62: "wlatin1", 90: "ebcdic870"} | |||
|
|||
|
|||
class index: | |||
class index(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rename this class (capitalize, but needs a differnt name then)
pandas/tests/io/json/test_ujson.py
Outdated
@@ -800,7 +800,7 @@ def test_loadFile(self): | |||
np.array([1, 2, 3, 4]), ujson.load(f, numpy=True)) | |||
|
|||
def test_loadFileLikeObject(self): | |||
class filelike: | |||
class filelike(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rename this
pandas/tests/test_resample.py
Outdated
@@ -1082,7 +1082,7 @@ def test_resample_how_callables(self): | |||
def fn(x, a=1): | |||
return str(type(x)) | |||
|
|||
class fn_class: | |||
class fn_class(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rename this
16c8418
to
65ccafd
Compare
@jreback : green |
@jschendel Thanks! |
Noticed some lgtm.com alerts about the
@property
decorator not working in old-style classes inscripts/validate_docstrings.py
. I don't think this actually causes any undesired behavior in that script though.Figured this would be a good time to enforce new-style classes throughout the codebase:
(object)
.lint.sh
for old-style classes, sinceflake8
doesn't look to be catching it.flake8
instead?