Skip to content

Commit

Permalink
fix: prevent KeyError for getting inspect data
Browse files Browse the repository at this point in the history
  • Loading branch information
newgene committed Apr 10, 2023
1 parent 8275843 commit 039b846
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions biothings/hub/datainspect/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def flatten(self, data_provider, mode=("type", "stats"), do_validate=True):

results = {}
if data_provider_type == "source":
src_sources_inspect_data = registerer_obj.src_doc["inspect"]["jobs"]
src_sources_inspect_data = registerer_obj.src_doc.get("inspect", {}).get("jobs", {})
for src_source_name, inspect_data in src_sources_inspect_data.items():
results[src_source_name] = {
_mode: btinspect.flatten_and_validate(
Expand All @@ -340,7 +340,7 @@ def flatten(self, data_provider, mode=("type", "stats"), do_validate=True):
for _mode in mode
}
else:
inspect_data = registerer_obj.src_build["inspect"]["results"]
inspect_data = registerer_obj.src_build.get("inspect", {}).get("results", {})
results[backend_provider] = {
_mode: btinspect.flatten_and_validate(inspect_data.get(_mode) or {}, do_validate) for _mode in mode
}
Expand Down

0 comments on commit 039b846

Please sign in to comment.