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

misc: Revert removal of description used in Index #827

Merged
merged 5 commits into from
Dec 19, 2024

Conversation

Jim-Encord
Copy link
Contributor

Introduction and Explanation

Index does apparently have a description. We should not have such bad duplicated functionality without tests

Copy link

github-actions bot commented Dec 18, 2024

Unit test report ((Pydantic 2.x)

193 tests   193 ✅  6s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit 79e8285.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Dec 18, 2024

Unit test report (Pydantic 1.x)

193 tests   193 ✅  5s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit 79e8285.

♻️ This comment has been updated with latest results.

@@ -56,6 +56,7 @@ class CreatePresetParams(BaseDTO):
class CreatePresetPayload(BaseDTO):
name: str
filter_preset_json: Dict
description: Optional[str] = ""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may be worth refactoring this to have two separate Preset Types dependant on whether we are Active or Index. But that would be more code. Including a description erroneously in the payload for Active is kinda sad

Copy link
Contributor

Choose a reason for hiding this comment

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

probably better to have separate types

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@Jim-Encord Jim-Encord force-pushed the jb/apparently-index-does-have-a-description branch from 00d4e49 to 79e8285 Compare December 18, 2024 15:06
@Jim-Encord Jim-Encord merged commit 4751e20 into master Dec 19, 2024
5 of 6 checks passed
@Jim-Encord Jim-Encord deleted the jb/apparently-index-does-have-a-description branch December 19, 2024 15:08
Copy link
Contributor Author

@Jim-Encord Jim-Encord left a comment

Choose a reason for hiding this comment

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

Stale comments

self._client.patch(
f"index/presets/{self.uuid}",
params=None,
payload=payload,
result_type=None,
)
self._preset_instance.name = name or self.name
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make it so we update local cache on successful update. Note that it falls after the request which will throw if unsuccessful.

if not filter_preset.local_filters and not filter_preset.global_filters:
raise EncordException("We require there to be a non-zero number of filters in a preset")
payload = CreatePresetPayload(
payload = IndexCreatePresetPayload(
name=name,
filter_preset_json=filter_preset.to_dict(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: Above we parse the input, just to immediately de-serialise it. Would it not be better to have it take a more structured object in the signature. Cc @Encord-davids. Theoretically breaks the interface but it's all somewhat fubar anyway

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.

2 participants