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

Change geomType arguments to prefer GeomType enum #229

Merged
merged 6 commits into from
Dec 21, 2020
Merged

Conversation

youngmit
Copy link
Contributor

Most code that takes a geomType argument used to expect a string, which would
be tested against the string constants defined in the geometry module. This
was error-prone, inefficient, and ambiguous. This adds some extra conversion
functionality to the GeomType enumeration class and changes most interfaces that
pass geomType around to use instances of the GeomType enum instead. Some
functions will still attempt a conversion from string to aid in backwards
compatibility, but these should be reduced moving forward.

Additionally, to better-organize the code in the geometry module, the
SystemLayoutInput class has been migrated to its own module.

@onufer
Copy link
Member

onufer commented Dec 18, 2020

can you add a test that confirms core.geomType is an enum rather than a string. I was having an issue with that about a month ago.

@youngmit
Copy link
Contributor Author

can you add a test that confirms core.geomType is an enum rather than a string. I was having an issue with that about a month ago.

Done! Yeah your issues were the main reason I made this PR. ALSO, lucky test 1,000 (I think)! 🎉

Comment on lines +311 to +312
self._geomType: geometry.GeomType
self.symmetry: str
Copy link
Member

Choose a reason for hiding this comment

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

woah weird. I see this is described here https://www.python.org/dev/peps/pep-0526/
and has no initial value.

@youngmit youngmit merged commit 877e4bf into master Dec 21, 2020
@youngmit youngmit deleted the mty/geomTypeEnum branch December 21, 2020 19:09
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.

3 participants