Skip to content

Commit

Permalink
Optimisation: do not re-access mapper properties inside the request l…
Browse files Browse the repository at this point in the history
…oop (#1223)
  • Loading branch information
ml-evs committed Jun 13, 2022
1 parent 991591b commit 55a2731
Showing 1 changed file with 4 additions and 3 deletions.
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

0 comments on commit 55a2731

Please sign in to comment.