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

Make FileIndex flexible for different type keys. #265

Merged
merged 3 commits into from
Sep 29, 2023
Merged

Conversation

axlan
Copy link
Collaborator

@axlan axlan commented Sep 28, 2023

No description provided.

@axlan axlan requested a review from adamshapiro0 September 28, 2023 22:08
@axlan axlan self-assigned this Sep 28, 2023
@axlan axlan force-pushed the flexible-index-type branch from 0890b68 to eb77310 Compare September 28, 2023 22:40
@@ -191,7 +195,7 @@ def load(self, index_path, data_path=None, delete_on_error=True):
if not os.path.exists(data_path):
# If the user didn't explicitly set data_path and the default file doesn't exist, it is not considered
# an error.
if self._data['type'][-1] == MessageType.INVALID:
if self._data['type'][-1] == self.enum_class.INVALID:
Copy link
Collaborator

Choose a reason for hiding this comment

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

INVALID is just the name used by MessageType. Another enum might define a different value to use as an undefined/invalid value. Probably should pass this into the constructor too.

Copy link
Collaborator

@adamshapiro0 adamshapiro0 left a comment

Choose a reason for hiding this comment

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

Looks good, just careful with INVALID.

@axlan axlan force-pushed the flexible-index-type branch from 49ec882 to e8921c1 Compare September 29, 2023 15:38
@axlan axlan merged commit ebdd627 into master Sep 29, 2023
14 checks passed
@axlan axlan deleted the flexible-index-type branch September 29, 2023 15:43
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