From 5761bafcb1a0830cd0686419d38423ce2083fe9c Mon Sep 17 00:00:00 2001 From: Markus Scheidgen <markus.scheidgen@gmail.com> Date: Mon, 24 Feb 2020 11:06:57 +0100 Subject: [PATCH] Cleaned search_model hiearchy. --- nomad/app/api/archive.py | 11 +---------- nomad/app/api/common.py | 4 ++++ nomad/app/api/repo.py | 6 +----- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/nomad/app/api/archive.py b/nomad/app/api/archive.py index 589e045ac6..e10c46ee78 100644 --- a/nomad/app/api/archive.py +++ b/nomad/app/api/archive.py @@ -217,16 +217,7 @@ add_pagination_parameters(_archive_query_parser) add_scroll_parameters(_archive_query_parser) add_search_parameters(_archive_query_parser) -_archive_query_model_fields = { - 'results': fields.List(fields.Raw, description=( - 'A list of search results. Each result is a dict with quantities names as key and ' - 'values as values')), - 'python': fields.String(description=( - 'A string of python code snippet which can be executed to reproduce the api result.')), - 'curl': fields.String(description=( - 'A string of curl command which can be executed to reproduce the api result.')), -} -_archive_query_model = api.inherit('ArchiveCalculations', search_model, _archive_query_model_fields) +_archive_query_model = api.inherit('ArchiveCalculations', search_model) @ns.route('/query') diff --git a/nomad/app/api/common.py b/nomad/app/api/common.py index a0632ab0da..6d7a312a4e 100644 --- a/nomad/app/api/common.py +++ b/nomad/app/api/common.py @@ -65,6 +65,10 @@ search_model = api.model('Search', { 'results': fields.List(fields.Raw, description=( 'A list of search results. Each result is a dict with quantitie names as key and ' 'values as values')), + 'python': fields.String(description=( + 'A string of python code snippet which can be executed to reproduce the api result.')), + 'curl': fields.String(description=( + 'A string of curl command which can be executed to reproduce the api result.')) }) diff --git a/nomad/app/api/repo.py b/nomad/app/api/repo.py index 23a34b31de..54d6d4c175 100644 --- a/nomad/app/api/repo.py +++ b/nomad/app/api/repo.py @@ -98,11 +98,7 @@ _repo_calcs_model_fields = { 'A dict with all statistics. Each statistic is dictionary with a metrics dict as ' 'value and quantity value as key. The possible metrics are code runs(calcs), %s. ' 'There is a pseudo quantity "total" with a single value "all" that contains the ' - ' metrics over all results. ' % ', '.join(datamodel.Domain.instance.metrics_names))), - 'python': fields.String(description=( - 'A string of python code snippet which can be executed to reproduce the api result.')), - 'curl': fields.String(description=( - 'A string of curl command which can be executed to reproduce the api result.')), + ' metrics over all results. ' % ', '.join(datamodel.Domain.instance.metrics_names))) } for group_name, (group_quantity, _) in search.groups.items(): _repo_calcs_model_fields[group_name] = fields.Nested(api.model('RepoDatasets', { -- GitLab