Skip to content

Commit

Permalink
Apply pre-commit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledk2 committed Nov 27, 2024
1 parent 30d89d0 commit 9dfcbeb
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
34 changes: 25 additions & 9 deletions omero_search_engine/api/v1/resources/resource_analyser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,20 +1054,36 @@ def get_resource_keys(resource, data_source):


def get_containets_from_name(container_name=None, returned_data_source=None):
act_names =[]# {}
act_names = [] # {}
pr_names = get_resource_names("all")
for resourse, names_ in pr_names.items():
if len(names_)>0:
print (names_.keys())
if len(names_) > 0:
print(names_.keys())

for data_source, names in names_.items():
act_names.append( [
{"id": name["id"], "name": name["name"], "data_source":data_source, "image count":name["no_images"], "type":resourse}
for name in names
if not container_name or(name.get("name") and container_name.lower() in name.get("name").lower()) and (not returned_data_source or returned_data_source==data_source)
])
act_names.append(
[
{
"id": name["id"],
"name": name["name"],
"data_source": data_source,
"image count": name["no_images"],
"type": resourse,
}
for name in names
if not container_name
or (
name.get("name")
and container_name.lower() in name.get("name").lower()
)
and (
not returned_data_source or returned_data_source == data_source
)
]
)
return act_names


def return_containes_images():
data = get_containets_from_name()
return {"Error": None, "results": {"results":data}}
return {"Error": None, "results": {"results": data}}
18 changes: 9 additions & 9 deletions omero_search_engine/api/v1/resources/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ def submit_query_return_containers():
except Exception:
query = None
if not query:
query={}
#return jsonify(build_error_message("No query is provided"))
if len(query)>0:
query = {}
# return jsonify(build_error_message("No query is provided"))
if len(query) > 0:
adjust_query_for_container(query)
return_columns = request.args.get("return_columns")
data_source = request.args.get("data_source")
Expand All @@ -377,17 +377,17 @@ def submit_query_return_containers():
return_columns = json.loads(return_columns.lower())
except Exception:
return_columns = False
if len(query)>0:
if len(query) > 0:
validation_results = query_validator(query)
if validation_results == "OK":
return jsonify(
determine_search_results_(
query,
data_source=data_source,
return_columns=return_columns,
return_containers=True,
query,
data_source=data_source,
return_columns=return_columns,
return_containers=True,
)
)
)
else:
return jsonify(build_error_message(validation_results))
else:
Expand Down

0 comments on commit 9dfcbeb

Please sign in to comment.