-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from harmonydata/catalogue-match-instruments
Catalogue match instruments
- Loading branch information
Showing
17 changed files
with
534 additions
and
213 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
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
Submodule harmony
updated
29 files
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,24 @@ | ||
from harmony.schemas.requests.text import MatchBody | ||
from harmony_api import http_exceptions, helpers, constants | ||
|
||
|
||
def model_from_match_body_is_available(match_body: MatchBody) -> bool: | ||
""" | ||
Check model availability. | ||
""" | ||
|
||
model = match_body.parameters | ||
__check_model(model.dict()) | ||
|
||
return True | ||
|
||
|
||
def __check_model(model_dict: dict): | ||
if model_dict not in constants.ALL_HARMONY_API_MODELS: | ||
raise http_exceptions.CouldNotProcessRequestHTTPException( | ||
"Could not process request because the model does not exist." | ||
) | ||
if not helpers.check_model_availability(model_dict): | ||
raise http_exceptions.CouldNotProcessRequestHTTPException( | ||
"Could not process request because the model is not available." | ||
) |
Oops, something went wrong.