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

Param 2: don't call param.objects() before super().__init__ in the explorer #1146

Merged
merged 4 commits into from
Sep 20, 2023

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented Sep 20, 2023

The explorer accepts in its constructor kwargs that are dispatched to the various controls (which wouldn't work well if two controls share the same attribute name but that's another issue) when they are instantiated. As such it needs to prune the kwargs before calling super().__init__(**params). This was done by gathering all the controls classes calling .param.objects() and doing some filtering. Param 2 will raise an error (or a warning) when param.objects() is accessed before super().__init__ is called. In this PR I arrange the code to call param.objects() after super().__init__.

@hoxbro
Copy link
Member

hoxbro commented Sep 20, 2023

Tests are green, so I will merge this.

@hoxbro hoxbro merged commit 0c780ab into main Sep 20, 2023
@hoxbro hoxbro deleted the fix_kwargs_controls branch September 20, 2023 12:51
ahuang11 pushed a commit that referenced this pull request Sep 27, 2023
…explorer (#1146)

* call param.objects() after super().__init__

* add tests

* update the docs

* update error message
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