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

Adds model validator to ensure consistent renaming #9

Merged
merged 4 commits into from
Sep 19, 2023

Conversation

DrPaulSharp
Copy link
Collaborator

No description provided.

methods_to_wrap = ['_setitem', '_delitem', '_iadd', 'append', 'insert', 'pop', 'remove', 'clear', 'extend']
for class_list in class_lists:
attribute = getattr(self, class_list)
for methodName in methods_to_wrap:
setattr(attribute, methodName, self._classlist_wrapper(attribute, getattr(attribute, methodName)))

@model_validator(mode='after')
def update_renamed_models(self) -> 'Project':
Copy link
Contributor

Choose a reason for hiding this comment

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

This function scares me with all the nested for loops. Is it possible to implement using signals/slot (observer pattern) instead?

@DrPaulSharp DrPaulSharp merged commit 5355150 into RascalSoftware:main Sep 19, 2023
6 checks passed
@DrPaulSharp DrPaulSharp deleted the rename branch September 19, 2023 14:46
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