-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add missing super __init__ in subclasses #20436
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
Conversation
The ones created by `_make_norm_from_scale` all call it.
These probably worked fine due to using `set_canvas_size` before `get_results`, or something that would set the remaining attributes.
The `vertices` and `codes` properties are overridden, so cannot be set directly, but the arrays that back them can be modified. This seems unintentional, so disable writing on those as well.
@@ -385,11 +385,11 @@ def __init__(self, xy, s, size=None, prop=None, | |||
|
|||
self._cached_vertices = None | |||
s, ismath = Text(usetex=usetex)._preprocess_math(s) | |||
self._vertices, self._codes = text_to_path.get_text_path( | |||
prop, s, ismath=ismath) | |||
super().__init__( |
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.
perhaps rather use fast_from_codes_and_verts for speed?
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.
That's a class method / constructor, though?
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.
ah yes. Oh well, I guess this isn't a bottleneck...
@@ -189,6 +189,7 @@ class MathtextBackendPs(MathtextBackend): | |||
"_PSResult", "width height depth pswriter used_characters") | |||
|
|||
def __init__(self): | |||
super().__init__() |
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.
Are none of these really ever tested? Maybe beyond this PR, but they should be if they aren't...
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.
They're almost all unused, which I guess is why they're deprecated. For the ones that are used, I assume they all get .set_canvas_size
called first, which sets the things that were missed in the super __init__
.
PR Summary
These can cause issues for some static checks (I noticed them in LGTM), and mostly the code in the super
__init__
is duplicated in the subclass.PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).