Skip to content

Clarify __init__s which allow component as a pos. arg.#738

Merged
jwiggins merged 3 commits into
masterfrom
fix/bad-init-meths
Mar 24, 2021
Merged

Clarify __init__s which allow component as a pos. arg.#738
jwiggins merged 3 commits into
masterfrom
fix/bad-init-meths

Conversation

@jwiggins
Copy link
Copy Markdown
Member

@jwiggins jwiggins commented Mar 22, 2021

Fixes #736
Fixes #737
Fixes #739

@corranwebster I see that ViewportToolbar and ViewportZoomTool also have component=None in their __init__ method signatures.

Comment on lines +62 to +65
def __init__(self, component=None, **kw):
if component is not None:
self.component = component
super(AbstractOverlay, self).__init__(*args, **kw)
kw["component"] = component
super(AbstractOverlay, self).__init__(**kw)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I removed *args because the base class of this class, Component, doesn't accept positional args, and HasTraits will raise a TypeError if it gets any positional arguments.

Comment thread enable/base_tool.py
Copy link
Copy Markdown
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

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

LGTM

@jwiggins jwiggins merged commit 74fcc7e into master Mar 24, 2021
@jwiggins
Copy link
Copy Markdown
Member Author

Thanks for the feedback

@jwiggins jwiggins deleted the fix/bad-init-meths branch March 24, 2021 14:38
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.

Audit __init__ methods AbstractOverlay.__init__ is redundant Redundant code in BaseTool.__init__

3 participants