fix: ED-2306 Make dynamic attributes unaware of spaces#1084
fix: ED-2306 Make dynamic attributes unaware of spaces#1084clinton-encord wants to merge 11 commits intomasterfrom
Conversation
Unit test report (Python 3.9.24, Pydantic 2.12.3)510 tests 510 ✅ 13s ⏱️ Results for commit 75d0f98. ♻️ This comment has been updated with latest results. |
Unit test report (Python 3.9.24, Pydantic 1.10.22)510 tests 510 ✅ 12s ⏱️ Results for commit 75d0f98. ♻️ This comment has been updated with latest results. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the handling of dynamic attributes to make them more self-contained within the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the handling of dynamic attributes to make them 'space-unaware'. The core change involves moving the management of dynamic attributes from Space classes to the ObjectInstance itself. This is a good architectural improvement that centralizes the logic and simplifies the Space implementations. The changes are well-supported by updates to test data and the addition of a new end-to-end serialization test. I've left a couple of minor suggestions for code cleanup.
| object_instance.set_answer_from_list(answer_list) | ||
| else: | ||
| # Not great that we're looping through spaces, but usually not that many spaces on a label row | ||
| answer_list = answer["actions"] |
| # Act | ||
| new_object_instance.set_answer(frames=[0], attribute=key_point_dynamic_text_attribute, answer=answer_on_frame_0) | ||
|
|
||
| # # Act |
| # | ||
| # # Assert |
| object_instance: The object instance to remove answers from. | ||
| frames: List of frame numbers to remove answers from. | ||
| """ | ||
| dynamic_answer_manager = self._object_hash_to_dynamic_answer_manager.get(object_instance.object_hash) |
There was a problem hiding this comment.
All of this was initially used in ontology_labels_impl.py when doing add_action_answers, but we now use the ObjectInstance methods to do that instead.
SDK integration test report 1 files ±0 1 suites ±0 13m 8s ⏱️ - 9m 21s For more details on these failures and errors, see this check. Results for commit 75d0f98. ± Comparison against base commit 552a77d. ♻️ This comment has been updated with latest results. |
| def set_dynamic_answer( | ||
| self, | ||
| object_instance: ObjectInstance, | ||
| frames: Frames, | ||
| answer: Union[str, NumericAnswerValue, Option, Sequence[Option]], | ||
| attribute: Optional[Attribute] = None, | ||
| ) -> None: | ||
| """Set dynamic attribute answers for an object instance on specific frames. | ||
|
|
||
| This method is only for dynamic attributes. For static attributes, use `ObjectInstance.set_answer`. |
There was a problem hiding this comment.
I actually would prefer to just raise an error here now, until we properly implement space-aware dynamic attributes, but afraid it will break people's existing scripts...
Introduction and Explanation
Backwards compatibitlity:
JIRA
Link ticket(s)
Documentation
There should be enough internal documentation for a product owner to write customer-facing documentation or a separate PR linked if writing the customer documentation directly. Link all that are relevant below.
Tests
Some unit tests!
Known issues
If there are any known issues with the solution, make a statement about what they are and why they are Ok to leave unsolved for now. Make tickets for the known issues linked to the original ticket linked above