-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: Clean uses of super, part II #26230
Conversation
Hello @topper-123! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2019-04-28 07:40:11 UTC |
@@ -983,7 +983,7 @@ default 'raise' | |||
return create_timestamp_from_ts(value, dts, _tzinfo, self.freq) | |||
|
|||
def isoformat(self, sep='T'): | |||
base = super(_Timestamp, self).isoformat(sep=sep) | |||
base = super().isoformat(sep=sep) |
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.
This changes the first parameter in super to implivitly be TimeStamp
rather than _Timestamp
, which is ok in this case.
ecf5410
to
3ee7740
Compare
# We want PandasObject.__repr__, which dispatches to __unicode__ | ||
return super(ExtensionArray, self).__repr__() | ||
# We want to bypass ExtensionArray.__repr__. | ||
return str(self) |
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.
This ends up in both master and this PR to call self.__unicode__
. __unicode__
isn't needed anymore so should be cleaned up in a future PR.
@@ -6330,8 +6330,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, axis=0, **kwargs) |
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.
I think this is clearer to read than the super version.
3ee7740
to
ca14ff4
Compare
ca14ff4
to
e1c0eb4
Compare
@@ -6342,7 +6341,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, axis=0, **kwargs).T | |||
return super().transform(func, *args, **kwargs) |
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.
I think this is clearer to read than the super
version.
Continuation from #26177. In addition to the uses of
super
dealt with in #26177, there were some more advanced uses ofsuper
in the code base, e.g. in classmethods and usingsuper
to jump to a specific point in the MRO-chain.This PR specifically deals with:
super(..., self)
in pyx-filessuper(..., cls)
in the whole code basesuper
, se comments .