Skip to content

CLN: clean more uses of python2-style super() #26261

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 1 commit into from
May 1, 2019

Conversation

topper-123
Copy link
Contributor

@topper-123 topper-123 commented May 1, 2019

Simplifies the uses of super by converting to use python3 idioms. This is a followup to #26177, focusing on uses of super in class methods.

Also adds a check for python2-style uses of super in code_checks.sh.

@@ -6336,8 +6336,7 @@ def _aggregate(self, arg, axis=0, *args, **kwargs):
if axis == 1:
# NDFrame.aggregate returns a tuple, and we need to transpose
# only result
result, how = (super(DataFrame, self.T)
._aggregate(arg, *args, **kwargs))
result, how = self.T._aggregate(arg, *args, **kwargs)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is more readable IMO.

@@ -6348,7 +6347,7 @@ def _aggregate(self, arg, axis=0, *args, **kwargs):
def transform(self, func, axis=0, *args, **kwargs):
axis = self._get_axis_number(axis)
if axis == 1:
return super(DataFrame, self.T).transform(func, *args, **kwargs).T
return self.T.transform(func, *args, **kwargs).T
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is more readable IMO.

@codecov
Copy link

codecov bot commented May 1, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26261      +/-   ##
==========================================
- Coverage   91.97%   91.97%   -0.01%     
==========================================
  Files         175      175              
  Lines       52386    52386              
==========================================
- Hits        48184    48181       -3     
- Misses       4202     4205       +3
Flag Coverage Δ
#multiple 90.52% <100%> (ø) ⬆️
#single 40.72% <66.66%> (-0.16%) ⬇️
Impacted Files Coverage Δ
pandas/core/arrays/categorical.py 95.96% <ø> (ø) ⬆️
pandas/tseries/holiday.py 93.1% <100%> (ø) ⬆️
pandas/core/dtypes/dtypes.py 96.42% <100%> (ø) ⬆️
pandas/core/groupby/grouper.py 98.52% <100%> (ø) ⬆️
pandas/core/frame.py 96.9% <100%> (-0.12%) ⬇️
pandas/core/indexes/timedeltas.py 91.59% <100%> (ø) ⬆️
pandas/core/indexes/datetimes.py 96.85% <100%> (ø) ⬆️
pandas/core/arrays/sparse.py 92.3% <100%> (ø) ⬆️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
... and 1 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 80be9b5...b9ea320. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented May 1, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26261      +/-   ##
==========================================
- Coverage   91.97%   91.97%   -0.01%     
==========================================
  Files         175      175              
  Lines       52386    52386              
==========================================
- Hits        48184    48181       -3     
- Misses       4202     4205       +3
Flag Coverage Δ
#multiple 90.52% <100%> (ø) ⬆️
#single 40.72% <66.66%> (-0.16%) ⬇️
Impacted Files Coverage Δ
pandas/core/arrays/categorical.py 95.96% <ø> (ø) ⬆️
pandas/tseries/holiday.py 93.1% <100%> (ø) ⬆️
pandas/core/dtypes/dtypes.py 96.42% <100%> (ø) ⬆️
pandas/core/groupby/grouper.py 98.52% <100%> (ø) ⬆️
pandas/core/frame.py 96.9% <100%> (-0.12%) ⬇️
pandas/core/indexes/timedeltas.py 91.59% <100%> (ø) ⬆️
pandas/core/indexes/datetimes.py 96.85% <100%> (ø) ⬆️
pandas/core/arrays/sparse.py 92.3% <100%> (ø) ⬆️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
... and 1 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 80be9b5...b9ea320. Read the comment docs.

@jreback jreback added this to the 0.25.0 milestone May 1, 2019
@jreback jreback merged commit d3b9d9f into pandas-dev:master May 1, 2019
@jreback
Copy link
Contributor

jreback commented May 1, 2019

thanks @topper-123

@topper-123 topper-123 deleted the clean_super_II branch May 1, 2019 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants