Skip to content
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: remove unneeded inheritance from base object #26128

Merged
merged 2 commits into from
Apr 18, 2019

Conversation

topper-123
Copy link
Contributor

@topper-123 topper-123 commented Apr 17, 2019

Bit of a tedious whopper to review (sorry), but this PR removes all instances of inheriting from the base object from the code base, as dropping Python2 support means that this particular idiom is no longer needed.

Additionally, as part of the above, I've removed the check in code_checks.sh that classes must inherit, as that is no longer a requirement after dropping Python2. I don't think a different check is possible to do now, but I can change instead of delete the check if anyone thinks that would make sense.

@codecov
Copy link

codecov bot commented Apr 18, 2019

Codecov Report

Merging #26128 into master will decrease coverage by 0.01%.
The diff coverage is 98.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26128      +/-   ##
==========================================
- Coverage   91.99%   91.98%   -0.02%     
==========================================
  Files         175      175              
  Lines       52387    52384       -3     
==========================================
- Hits        48192    48184       -8     
- Misses       4195     4200       +5
Flag Coverage Δ
#multiple 90.53% <98.64%> (-0.01%) ⬇️
#single 40.74% <94.59%> (-0.14%) ⬇️
Impacted Files Coverage Δ
pandas/core/groupby/ops.py 94.23% <ø> (ø) ⬆️
pandas/util/_depr_module.py 0% <0%> (ø) ⬆️
pandas/util/_decorators.py 91.34% <100%> (ø) ⬆️
pandas/io/packers.py 88.08% <100%> (ø) ⬆️
pandas/core/reshape/reshape.py 99.56% <100%> (ø) ⬆️
pandas/core/dtypes/base.py 100% <100%> (ø) ⬆️
pandas/io/formats/format.py 97.91% <100%> (ø) ⬆️
pandas/core/algorithms.py 94.78% <100%> (ø) ⬆️
pandas/core/accessor.py 98.79% <100%> (ø) ⬆️
pandas/io/sas/sas7bdat.py 91.15% <100%> (ø) ⬆️
... and 42 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 06843a8...0c56f26. Read the comment docs.

@codecov
Copy link

codecov bot commented Apr 18, 2019

Codecov Report

Merging #26128 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26128      +/-   ##
==========================================
- Coverage   91.99%   91.98%   -0.01%     
==========================================
  Files         175      175              
  Lines       52385    52382       -3     
==========================================
- Hits        48190    48184       -6     
- Misses       4195     4198       +3
Flag Coverage Δ
#multiple 90.54% <100%> (-0.01%) ⬇️
#single 40.73% <95.45%> (-0.15%) ⬇️
Impacted Files Coverage Δ
pandas/core/groupby/ops.py 94.23% <ø> (ø) ⬆️
pandas/io/packers.py 88.08% <100%> (ø) ⬆️
pandas/core/reshape/reshape.py 99.56% <100%> (ø) ⬆️
pandas/core/dtypes/base.py 100% <100%> (ø) ⬆️
pandas/io/formats/format.py 97.91% <100%> (ø) ⬆️
pandas/core/algorithms.py 94.78% <100%> (ø) ⬆️
pandas/core/reshape/concat.py 97.2% <100%> (ø) ⬆️
pandas/core/accessor.py 98.79% <100%> (ø) ⬆️
pandas/io/sas/sas7bdat.py 91.15% <100%> (ø) ⬆️
pandas/io/formats/csvs.py 98.2% <100%> (ø) ⬆️
... and 38 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c0f8cf...3dc58d6. Read the comment docs.

@topper-123 topper-123 force-pushed the remove_inheritance_from_object branch from 0c56f26 to 0ec6fc2 Compare April 18, 2019 00:52
@gfyoung gfyoung added 2/3 Compat Clean Testing pandas testing functions or related to the test suite labels Apr 18, 2019
Copy link
Member

@gfyoung gfyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@jreback jreback added this to the 0.25.0 milestone Apr 18, 2019
@@ -140,10 +140,6 @@ 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 old-style classes' ; echo $MSG
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you removing this?

Copy link
Contributor Author

@topper-123 topper-123 Apr 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In python2 ´´class MyClass:´´ created an different class type (old style) than ´´class MyClass(object):`` (new style). Pandas required that all classes be new style for py2/py3 compatability. This distinction can be lifted now we only use python3, so the check isn`t needed any more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe so but we still don’t want them
i would revert the check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve added a check for the reverted case.

@topper-123 topper-123 force-pushed the remove_inheritance_from_object branch from 0ec6fc2 to 0c8bd24 Compare April 18, 2019 19:08
@jreback
Copy link
Contributor

jreback commented Apr 18, 2019

cripts/validate_docstrings.py(226,): error :  Found unwanted pattern: class Docstring(object)
scripts/tests/test_validate_docstrings.py(13,): error :  Found unwanted pattern: class GoodDocStrings(object)
scripts/tests/test_validate_docstrings.py(256,): error :  Found unwanted pattern: class BadGenericDocStrings(object)
scripts/tests/test_validate_docstrings.py(448,): error :  Found unwanted pattern: class BadSummaries(object)
scripts/tests/test_validate_docstrings.py(487,): error :  Found unwanted pattern: class BadParameters(object)
scripts/tests/test_validate_docstrings.py(614,): error :  Found unwanted pattern: class BadReturns(object)
scripts/tests/test_validate_docstrings.py(697,): error :  Found unwanted pattern: class BadSeeAlso(object)
scripts/tests/test_validate_docstrings.py(735,): error :  Found unwanted pattern: class BadExamples(object)
scripts/tests/test_validate_docstrings.py(773,): error :  Found unwanted pattern: class TestValidator(object)
scripts/tests/test_validate_docstrings.py(954,): error :  Found unwanted pattern: class TestApiItems(object)

@topper-123 topper-123 force-pushed the remove_inheritance_from_object branch from 0c8bd24 to 3dc58d6 Compare April 18, 2019 19:47
@jreback jreback merged commit c18c8be into pandas-dev:master Apr 18, 2019
@jreback
Copy link
Contributor

jreback commented Apr 18, 2019

thanks @topper-123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants