-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add hint schemes to summary and materials * Bump maggma for hints * Remove xfails and test fixes * Fix lru_cache decorator
- Loading branch information
Jason Munro
authored
Nov 30, 2021
1 parent
f31191a
commit c94800f
Showing
18 changed files
with
116 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
fastapi==0.70.0 | ||
maggma==0.32.3 | ||
maggma==0.33.0 | ||
uvicorn==0.15.0 | ||
gunicorn[gevent]==20.1.0 | ||
boto3==1.20.15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from maggma.api.resource import HintScheme | ||
|
||
|
||
class MaterialsHintScheme(HintScheme): | ||
""" | ||
Hint scheme for the materials endpoint. | ||
""" | ||
|
||
def generate_hints(self, query): | ||
|
||
if "nelements" in query["criteria"]: | ||
return {"hint": {"nelements": 1}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from maggma.api.resource import HintScheme | ||
|
||
|
||
class SummaryHintScheme(HintScheme): | ||
""" | ||
Hint scheme for the summary endpoint. | ||
""" | ||
|
||
def generate_hints(self, query): | ||
|
||
if "nelements" in query["criteria"]: | ||
return {"hint": {"nelements": 1}} | ||
|
||
elif "has_props" in query["criteria"]: | ||
return {"hint": {"has_props": 1}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from mp_api.routes.materials.hint_scheme import MaterialsHintScheme | ||
|
||
|
||
def test_materials_hint_scheme(): | ||
scheme = MaterialsHintScheme() | ||
assert scheme.generate_hints({"criteria": {"nelements": 3}}) == { | ||
"hint": {"nelements": 1} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from mp_api.routes.summary.hint_scheme import SummaryHintScheme | ||
|
||
|
||
def test_summary_hint_scheme(): | ||
scheme = SummaryHintScheme() | ||
assert scheme.generate_hints({"criteria": {"nelements": 3}}) == { | ||
"hint": {"nelements": 1} | ||
} | ||
assert scheme.generate_hints({"criteria": {"has_props": "dos"}}) == { | ||
"hint": {"has_props": 1} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters