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

[MRG] Update Network eq method #902

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

gtdang
Copy link
Collaborator

@gtdang gtdang commented Oct 9, 2024

The eq method was refactored to be more flexible to new methods added to the object.

The eq method loops over class attributes and compares the values to assess equality.

  • Previously we used the dir() function to list all of the classes attributes and methods and then filtered for only the attributes.
    • We used a hard-coded list of attributes and methods we wanted to pass over. This was annoying because each new method added to the Network class had to be manually added to this list.
  • This change uses the var() function to grab just the list of attributes from the class so new methods don't need to be coded manually.
  • The change was also made to the test_gui.py>check_equal_networks function, which had logic adapted from the eq method.

Previously any new method added to the Network object had to be added to a hardcoded list to ignore making a comparison. Using var() instead of dir() to get at only the attributes avoids this by only accessing the attributes and not all attributes and methods.
…s to ignore

Previously any new method added to the Network object had to be added to a hardcoded list to ignore making a comparison. Using var() instead of dir() to get at only the attributes avoids this by only accessing the attributes and not all attributes and methods.
@gtdang gtdang requested a review from ntolley October 9, 2024 21:36
@gtdang gtdang marked this pull request as ready for review October 9, 2024 21:38
Copy link
Contributor

@ntolley ntolley left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@ntolley ntolley merged commit 7a42650 into jonescompneurolab:master Oct 17, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants