-
Notifications
You must be signed in to change notification settings - Fork 10
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
remove unused pkg and update deps #126
Conversation
src/pfb/importers/gen3dict.py
Outdated
@@ -275,7 +275,10 @@ def _array_type(property_type): | |||
if "description" in property_type: | |||
enum["name"] = property_type["description"] | |||
else: | |||
enum["name"] = property_type["termDef"][0]["term"] | |||
enum["name"] = property_type["term"]["termDef"]["term"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: This block can be rewritten as
enum["name"] = (
property_type.get("description") or
property_type["term"]["termDef"]["term"] or
property_type["termDef"][0]["term"])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I was suppose to write this using .get() somehow I just forgot 🤦
src/pfb/importers/gen3dict.py
Outdated
@@ -275,7 +275,10 @@ def _array_type(property_type): | |||
if "description" in property_type: | |||
enum["name"] = property_type["description"] | |||
else: | |||
enum["name"] = property_type["termDef"][0]["term"] | |||
enum["name"] = property_type["term"]["termDef"]["term"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should exist but should we do something safer like property_type.get("term", None).get("termDef").get("term")
so we know we get a None
returned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I was suppose to write this using .get() somehow I just forgot 🤦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaulting to None will still be unsafe. If you want to be safe I believe the format would be
result = property_type.get("term", {}).get("termDef", {}).get("term")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this is the right way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with one suggestion. The suggestion is not required to be implemented, but encouraged.
Link to JIRA ticket if there is one: https://ctds-planx.atlassian.net/browse/HP-1589
Improvements
Dependency updates