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

Additional Nodes functionality and Node robustness #22

Merged
merged 5 commits into from
Jul 6, 2021

Conversation

haavahk
Copy link
Contributor

@haavahk haavahk commented Jun 18, 2021

If relevant a pull request should include

  • A reference to a related issue in your repository.
  • A description of the changes proposed in the pull request.
  • @mentions of the person or team responsible for reviewing proposed changes.
  • Make sure you have made a pull of the latest changes from the main branch and re-run all unittests
  • Lastly remember to lint with, isort, flake8 and black

Remember to perform linting before making a pull request

pip install black isort flake8
isort .
flake8 .
black .

Copy link
Owner

@Krande Krande left a comment

Choose a reason for hiding this comment

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

A lot of good work here :)

Take a look at my comments when you have time and we can discuss how\if we should implement my suggested edits prior to merge

Comment on lines 3087 to 3090
elem.nodes.pop(node_index)
elem.nodes.insert(node_index, new_node)
elem._shape = None
logging.debug(f"{old_node} exchanged with {new_node} --> {elem}")
Copy link
Owner

Choose a reason for hiding this comment

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

What about the ref on the old node referring to the element it was just deleted from?

Consider adding something like this at the end of each element eval

old_node.refs.pop(old_node.refs.index(elem))

Comment on lines 3082 to 3086
try:
ref_index = elem.nodes.index(old)
node_index = elem.nodes.index(old_node)
except ValueError:
logging.error(f"Could not find {old_node} in {elem}")
return
Copy link
Owner

@Krande Krande Jun 21, 2021

Choose a reason for hiding this comment

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

Is logging error and return the right mechanism here? Obviously if a element does not contain a node which thinks it is a member of the element then something is probably very wrong.

Therefore I suggest a raise ValueError might be a better fit here stopping any further execution since this error should in principle never happen?

@Krande Krande merged commit a3cebd6 into Krande:main Jul 6, 2021
@haavahk haavahk deleted the nodes_and_elements branch July 8, 2021 12:48
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.

None yet

2 participants