Use type(model.value).__init__ in ModelCreator param check#3264
Merged
Use type(model.value).__init__ in ModelCreator param check#3264
Conversation
|
Performance benchmarks:
|
Member
|
If I recall correctly, there were a bunch of other places where |
8475873 to
4028ee2
Compare
quaquel
approved these changes
Feb 9, 2026
Member
|
please update the PR description and then I can merge this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR performs a focused cleanup in
solara_viz.pyby replacing__class__usages withtype(...), including theModelCreatorparameter-validation fix.Bug / Issue
@quaquel’s feedback in #3178 first requested separating the
__class__ -> type(...)change, and then suggested including the other__class__usages in solara-viz as a proper cleanup.Implementation
Updated
solara_viz.pyin the following places:model.value.__class__.__name__ -> type(model.value).__name__ (AppBar title)model.value.__class__.__init__ -> type(model.value).__init__ (_check_model_params call)model.value)model.value.__class__(**model_parameters.value) -> type(model.value)(**model_parameters.value)model.value.__class__(simulator=simulator, **model_parameters.value) -> type(model.value)(simulator=simulator, **model_parameters.value)renderer.__class__(model=model, backend=renderer.backend) -> type(renderer)(model=model, backend=renderer.backend)No behavioral logic changes beyond the class-reference cleanup.
Testing
Ran targeted visualization tests:
test_solara_viz.py