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

Don't send so many synonyms #296

Merged
merged 4 commits into from
Sep 28, 2021
Merged

Don't send so many synonyms #296

merged 4 commits into from
Sep 28, 2021

Conversation

patrickkwang
Copy link
Contributor

No description provided.

@patrickkwang patrickkwang linked an issue Sep 23, 2021 that may be closed by this pull request
Copy link
Contributor

@alongreyber alongreyber 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

"""Map single CURIE."""
try:
categories, identifiers = data[curie]
except KeyError:
return [curie]
prefixes = {
prefixes = list(dict.fromkeys(
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this just to deduplicate? Maybe switch to set() if that's the case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we need to deduplicate but also retain the order, which is why I've done this rather than using set().

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha. Can we document this in a comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

for _curie in identifiers
if _curie.startswith(prefix)
]
if curies:
Copy link
Contributor

Choose a reason for hiding this comment

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

So this returns curies for the first prefix where curies exist, instead of all curies for all prefixes? If I'm understanding it right, can we document this behavior explicitly in a docstring or comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

@patrickkwang patrickkwang merged commit 2c82e94 into master Sep 28, 2021
@patrickkwang patrickkwang deleted the trim-syns branch September 28, 2021 15:49
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.

Don't send equivalent queries
2 participants