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

Optimisation: do not re-access mapper properties inside the request loop #1223

Merged
merged 1 commit into from
Jun 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions optimade/server/entry_collections/entry_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,13 @@ def find(

bad_optimade_fields = set()
bad_provider_fields = set()
supported_prefixes = self.resource_mapper.SUPPORTED_PREFIXES
all_attributes = self.resource_mapper.ALL_ATTRIBUTES
for field in include_fields:
if field not in self.resource_mapper.ALL_ATTRIBUTES:
if field not in all_attributes:
if field.startswith("_"):
if any(
field.startswith(f"_{prefix}_")
for prefix in self.resource_mapper.SUPPORTED_PREFIXES
field.startswith(f"_{prefix}_") for prefix in supported_prefixes
):
bad_provider_fields.add(field)
else:
Expand Down