-
Notifications
You must be signed in to change notification settings - Fork 42
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
[PY-622][PY-626][PY-665] Import Properties (create/update) while importing annotations #759
Conversation
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.
Intricate work, good stuff. Some concern that there are not extra tests for the extra functionality. Reach out to me if there's a reason for that, or if you need backup, and we can sort it together.
@@ -405,13 +405,13 @@ class Property: | |||
name: str | |||
|
|||
# Type of the property | |||
type: str | |||
type: PropertyType |
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.
It wasn't you who did this, but changing this block to a triple quote block instead would be a decent low hanging fruit improvement.
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.
Do you mean something like this:
type: """PropertyType"""
@@ -267,6 +274,159 @@ def _resolve_annotation_classes( | |||
return local_classes_not_in_dataset, local_classes_not_in_team | |||
|
|||
|
|||
def _import_properties( | |||
metadata_path: Union[Path, bool], |
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.
With this function, I'd (like in the other PR I reviewed), say break this down. I haven't counted the McCabe complexity of this, but it looks like it's quite high. We removed the requirement for lower than 10 complexity because of some older inherited code, but it would be good to apply a higher standard for these lints on this level.
Also, same note on the function names. These can be more explanatory, and refactored with no difficulty.
If you break this down, no need to rewrite tests if it's already adequately covered, as this just becomes social testing of all.
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.
I believe we have some tickets on E2E test on properties import - so testing this function properly should be covered in that.
For the function names, what would you prefer? some examples:
_import_properties
->_create_update_properties
? - as it Creates/Updates missing/mismatched properties from annotation & metadata.json file to team-properties._update_payload_with_properties
->_update_annotation_payload_with_properties
? - as it updates the annotation import API payload data with annotation-properties data
What are your thoughts on it?
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.
Overall good code, but I think there's one issue that might come into play and maybe requires changing.
* handling properties data while importing annotations * add tests for _handle_annotation_data * update importer - add annotations_properties in payload of import annotations * update importer - rm _handle_properties code * fix test * update test * fix indent * add the missing return value * fix issues with multi_select create_property
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.
Left couple of comments
…d value field (#769) * update nested value changes for property-value objects * fix tests + fix linting
Problem
Solution
Implement
_import_properties
before_import_annotations
& add those properties in import annotations API payload.Changelog
Implement Import Properties (create/update) while importing annotations