Skip to content

Commit d26d52e

Browse files
cleanup
1 parent c607814 commit d26d52e

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

mp_api/client/mprester.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,23 +1359,17 @@ def get_download_info(
13591359
return meta, urls
13601360

13611361
def _check_get_download_info_url_by_task_id(self, prefix, task_ids) -> list[str]:
1362-
nomad_exist_task_ids: list[str] = []
13631362
prefix = prefix.replace("/raw/query", "/repo/")
1364-
for task_id in task_ids:
1365-
url = prefix + task_id
1366-
if self._check_nomad_exist(url):
1367-
nomad_exist_task_ids.append(task_id)
1368-
return nomad_exist_task_ids
1363+
return [
1364+
task_id for task_id in task_ids if self._check_nomad_exist(prefix + task_id)
1365+
]
13691366

13701367
@staticmethod
13711368
def _check_nomad_exist(url) -> bool:
13721369
response = get(url=url)
13731370
if response.status_code != 200:
13741371
return False
1375-
content = load_json(response.text)
1376-
if content["pagination"]["total"] == 0:
1377-
return False
1378-
return True
1372+
return load_json(response.text)["pagination"]["total"] != 0
13791373

13801374
@staticmethod
13811375
def _print_help_message(nomad_exist_task_ids, task_ids, file_patterns, calc_types):

0 commit comments

Comments
 (0)