From b2db06da5cc0a48ab078664f84cacb6b884ddf5c Mon Sep 17 00:00:00 2001
From: Markus Scheidgen <markus.scheidgen@gmail.com>
Date: Tue, 5 May 2020 19:33:32 +0200
Subject: [PATCH] Minor fixes.

---
 nomad/archive.py | 2 +-
 nomad/client.py  | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/nomad/archive.py b/nomad/archive.py
index a9be785ac9..1652b37bba 100644
--- a/nomad/archive.py
+++ b/nomad/archive.py
@@ -608,7 +608,7 @@ def query_archive(f_or_archive_reader: Union[str, ArchiveReader, BytesIO], query
                     pass
                 else:
                     length = len(archive_child)
-                    if isinstance(index, list):
+                    if isinstance(index, tuple):
                         index = (_fix_index(index[0], length), _fix_index(index[1], length))
                         if index[0] == index[1]:
                             archive_child = [archive_child[index[0]]]
diff --git a/nomad/client.py b/nomad/client.py
index 9721c9610a..fd7a0dc4f9 100644
--- a/nomad/client.py
+++ b/nomad/client.py
@@ -271,8 +271,11 @@ class ArchiveQuery(collections.abc.Sequence):
             section_run_key = next(key for key in required if key.split('[')[0] == 'section_run')
             if section_run_key is not None:
                 # add all quantities in required to the query part
-                quantities = set()
-                stack = [required[section_run_key]]
+                quantities = {'section_run'}
+                stack = []
+                section_run = required[section_run_key]
+                if isinstance(section_run, dict):
+                    stack.append(section_run)
                 while len(stack) > 0:
                     required_dict = stack.pop()
                     for key, value in required_dict.items():
-- 
GitLab