-
Notifications
You must be signed in to change notification settings - Fork 41
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-620] Add properties checker util functions #748
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.
Would like some unit tests here to verify some expected returns
@@ -267,6 +268,45 @@ def _resolve_annotation_classes( | |||
return local_classes_not_in_dataset, local_classes_not_in_team | |||
|
|||
|
|||
def build_list_properties(annotations: List[dt.Annotation]) -> List[SelectedProperty]: | |||
return [prop for annotation in annotations for prop in annotation.properties or []] |
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 think this might need to also return the annotation.class info alongside the SelectedProperty, in a similar vein to metadata.json. See slack for more info.
team_properties: List[FullProperty], import_properties: List[SelectedProperty] | ||
) -> List[SelectedProperty]: | ||
missing_properties: List[SelectedProperty] = [] | ||
team_properties_lookup = {prop.name: prop for prop in team_properties} |
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.
Like the key lookup approach, very nice.
Problem
Lacking support for properties checker util functions
Solution
adds in util functions for checking properties
build_list_properties(List[dt.Annotation]) -> List[SelectedProperty]
properties_missing(List[FullProperty], List[SelectedProperty]) -> List[SelectedProperty]
mismatched_properties(List[FullProperty], List[SelectedProperty]) -> List[SelectedProperty]
TODO:
Changelog
Add properties checker util functions