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.
This is a follow-up on #59 towards a less invasive framework.
@process
is now a thin wrapper aroundattr.s
. Applied on a classA
, it returns the class (almost) just as it was decorated withattr.s
. The more invasive modifications (custom properties, etc.) are now in a subclass ofA
that is created programmatically and accessible fromA.__xsimlab_cls__
(Model objects use the latter subclass instead ofA
directly).The great advantage is that it is now possible to use instances of process-decorated classes independently of any Model, which is IMO a better solution than the approach proposed in #50 for testing the logic implemented in those classes.
Variables declared with
intent='in'
orintent='inout'
are now included in__init__
generated by attr.An alternative approach would be to stick with one single class and customize its
__init__
to circumvent the limitation of read-only properties created for input variables (see, e.g., python-attrs/attrs#393 (comment)). This is maybe less complicated than the approach used here, but it still alters the class significantly.TODO:
init=True
andrepr=True
for all input variables