mpcontribs-client 5.10.0__tar.gz → 5.10.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. {mpcontribs_client-5.10.0/mpcontribs_client.egg-info → mpcontribs_client-5.10.2}/PKG-INFO +1 -1
  2. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/mpcontribs/client/__init__.py +97 -90
  3. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2/mpcontribs_client.egg-info}/PKG-INFO +1 -1
  4. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/requirements/deployment.txt +33 -23
  5. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/requirements/ubuntu-latest_py3.10.txt +34 -24
  6. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/requirements/ubuntu-latest_py3.10_extras.txt +36 -26
  7. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/requirements/ubuntu-latest_py3.11.txt +34 -24
  8. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/requirements/ubuntu-latest_py3.11_extras.txt +36 -26
  9. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/LICENSE +0 -0
  10. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/README.md +0 -0
  11. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/mpcontribs_client.egg-info/SOURCES.txt +0 -0
  12. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/mpcontribs_client.egg-info/dependency_links.txt +0 -0
  13. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/mpcontribs_client.egg-info/not-zip-safe +0 -0
  14. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/mpcontribs_client.egg-info/requires.txt +0 -0
  15. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/mpcontribs_client.egg-info/top_level.txt +0 -0
  16. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/setup.cfg +0 -0
  17. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/setup.py +0 -0
  18. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/tests/conftest.py +0 -0
  19. {mpcontribs_client-5.10.0 → mpcontribs_client-5.10.2}/tests/test_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mpcontribs-client
3
- Version: 5.10.0
3
+ Version: 5.10.2
4
4
  Summary: client library for MPContribs API
5
5
  Home-page: https://github.com/materialsproject/MPContribs/tree/master/mpcontribs-client
6
6
  Author: Patrick Huck
@@ -20,7 +20,7 @@ from math import isclose
20
20
  from semantic_version import Version
21
21
  from requests.exceptions import RequestException
22
22
  from bson.objectid import ObjectId
23
- from typing import Union, Type, List
23
+ from typing import Union, Type, Optional
24
24
  from tqdm.auto import tqdm
25
25
  from hashlib import md5
26
26
  from pathlib import Path
@@ -115,6 +115,7 @@ ureg.define("ppb = 1e-9")
115
115
  ureg.define("atom = 1")
116
116
  ureg.define("bohr_magneton = e * hbar / (2 * m_e) = µᵇ = µ_B = mu_B")
117
117
  ureg.define("electron_mass = 9.1093837015e-31 kg = mₑ = m_e")
118
+ ureg.define("sccm = cm³/min")
118
119
 
119
120
  LOG_LEVEL = os.environ.get("MPCONTRIBS_CLIENT_LOG_LEVEL", "INFO")
120
121
  log_level = getattr(logging, LOG_LEVEL.upper())
@@ -296,7 +297,7 @@ def _response_hook(resp, *args, **kwargs):
296
297
  def _chunk_by_size(items, max_size=0.95 * MAX_BYTES):
297
298
  buffer, buffer_size = [], 0
298
299
 
299
- for idx, item in enumerate(items):
300
+ for item in items:
300
301
  item_size = _compress(item)[0]
301
302
 
302
303
  if buffer_size + item_size <= max_size:
@@ -465,7 +466,7 @@ class Structure(PmgStructure):
465
466
  class Attachment(dict):
466
467
  """Wrapper class around dict to handle attachments"""
467
468
 
468
- def decode(self) -> str:
469
+ def decode(self) -> bytes:
469
470
  """Decode base64-encoded content of attachment"""
470
471
  return b64decode(self["content"], validate=True)
471
472
 
@@ -477,7 +478,7 @@ class Attachment(dict):
477
478
 
478
479
  return unpacked
479
480
 
480
- def write(self, outdir: Union[str, Path] = None) -> Path:
481
+ def write(self, outdir: Optional[Union[str, Path]] = None) -> Path:
481
482
  """Write attachment to file using its name
482
483
 
483
484
  Args:
@@ -489,7 +490,7 @@ class Attachment(dict):
489
490
  path.write_bytes(content)
490
491
  return path
491
492
 
492
- def display(self, outdir: Union[str, Path] = None):
493
+ def display(self, outdir: Optional[Union[str, Path]] = None):
493
494
  """Display Image/FileLink for attachment if in IPython/Jupyter
494
495
 
495
496
  Args:
@@ -760,7 +761,7 @@ def _expand_params(protocol, host, version, projects_json, apikey=None):
760
761
  columns = {"string": [], "number": []}
761
762
  projects = ujson.loads(projects_json)
762
763
  query = {"project__in": ",".join(projects)}
763
- query["_fields"] = ["columns"]
764
+ query["_fields"] = "columns"
764
765
  url = f"{protocol}://{host}"
765
766
  http_client = RequestsClient()
766
767
  http_client.session.headers["Content-Type"] = "application/json"
@@ -869,11 +870,11 @@ class Client(SwaggerClient):
869
870
 
870
871
  def __init__(
871
872
  self,
872
- apikey: str = None,
873
- headers: dict = None,
874
- host: str = None,
875
- project: str = None,
876
- session: requests.Session = None,
873
+ apikey: Optional[str] = None,
874
+ headers: Optional[dict] = None,
875
+ host: Optional[str] = None,
876
+ project: Optional[str] = None,
877
+ session: Optional[requests.Session] = None,
877
878
  ):
878
879
  """Initialize the client - only reloads API spec from server as needed
879
880
 
@@ -965,7 +966,7 @@ class Client(SwaggerClient):
965
966
 
966
967
  def _get_per_page_default_max(
967
968
  self, op: str = "query", resource: str = "contributions"
968
- ) -> int:
969
+ ) -> tuple[int, int]:
969
970
  attr = f"{op}{resource.capitalize()}"
970
971
  resource = self.swagger_spec.resources[resource]
971
972
  param_spec = getattr(resource, attr).params["per_page"].param_spec
@@ -987,7 +988,7 @@ class Client(SwaggerClient):
987
988
  op: str = "query",
988
989
  resource: str = "contributions",
989
990
  pages: int = -1,
990
- ) -> List[dict]:
991
+ ) -> list[dict]:
991
992
  """Avoid URI too long errors"""
992
993
  pp_default, pp_max = self._get_per_page_default_max(op=op, resource=resource)
993
994
  per_page = (
@@ -1046,7 +1047,7 @@ class Client(SwaggerClient):
1046
1047
  params: dict,
1047
1048
  rel_url: str = "contributions",
1048
1049
  op: str = "query",
1049
- data: dict = None,
1050
+ data: Optional[dict] = None,
1050
1051
  ):
1051
1052
  rname = rel_url.split("/", 1)[0]
1052
1053
  resource = self.swagger_spec.resources[rname]
@@ -1064,7 +1065,9 @@ class Client(SwaggerClient):
1064
1065
  return future
1065
1066
 
1066
1067
  def available_query_params(
1067
- self, startswith: tuple = None, resource: str = "contributions"
1068
+ self,
1069
+ startswith: Optional[tuple] = None,
1070
+ resource: str = "contributions",
1068
1071
  ) -> list:
1069
1072
  resources = self.swagger_spec.resources
1070
1073
  resource_obj = resources.get(resource)
@@ -1080,7 +1083,9 @@ class Client(SwaggerClient):
1080
1083
 
1081
1084
  return [param for param in params if param.startswith(startswith)]
1082
1085
 
1083
- def get_project(self, name: str = None, fields: list = None) -> Type[Dict]:
1086
+ def get_project(
1087
+ self, name: Optional[str] = None, fields: Optional[list] = None
1088
+ ) -> Dict:
1084
1089
  """Retrieve a project entry
1085
1090
 
1086
1091
  Args:
@@ -1098,12 +1103,12 @@ class Client(SwaggerClient):
1098
1103
 
1099
1104
  def query_projects(
1100
1105
  self,
1101
- query: dict = None,
1102
- term: str = None,
1103
- fields: list = None,
1104
- sort: str = None,
1106
+ query: Optional[dict] = None,
1107
+ term: Optional[str] = None,
1108
+ fields: Optional[list] = None,
1109
+ sort: Optional[str] = None,
1105
1110
  timeout: int = -1,
1106
- ) -> List[dict]:
1111
+ ) -> list[dict]:
1107
1112
  """Query projects by query and/or term (Atlas Search)
1108
1113
 
1109
1114
  See `client.available_query_params(resource="projects")` for keyword arguments used in
@@ -1205,7 +1210,7 @@ class Client(SwaggerClient):
1205
1210
  else:
1206
1211
  raise MPContribsClientError(resp)
1207
1212
 
1208
- def update_project(self, update: dict, name: str = None):
1213
+ def update_project(self, update: dict, name: Optional[str] = None):
1209
1214
  """Update project info
1210
1215
 
1211
1216
  Args:
@@ -1271,7 +1276,7 @@ class Client(SwaggerClient):
1271
1276
  else:
1272
1277
  raise MPContribsClientError(error)
1273
1278
 
1274
- def delete_project(self, name: str = None):
1279
+ def delete_project(self, name: Optional[str] = None):
1275
1280
  """Delete a project
1276
1281
 
1277
1282
  Args:
@@ -1290,7 +1295,7 @@ class Client(SwaggerClient):
1290
1295
  if resp and "error" in resp:
1291
1296
  raise MPContribsClientError(resp["error"])
1292
1297
 
1293
- def get_contribution(self, cid: str, fields: list = None) -> Type[Dict]:
1298
+ def get_contribution(self, cid: str, fields: Optional[list] = None) -> Dict:
1294
1299
  """Retrieve a contribution
1295
1300
 
1296
1301
  Args:
@@ -1304,7 +1309,7 @@ class Client(SwaggerClient):
1304
1309
  self.contributions.getContributionById(pk=cid, _fields=fields).result()
1305
1310
  )
1306
1311
 
1307
- def get_table(self, tid_or_md5: str) -> Type[Table]:
1312
+ def get_table(self, tid_or_md5: str) -> Table:
1308
1313
  """Retrieve full Pandas DataFrame for a table
1309
1314
 
1310
1315
  Args:
@@ -1346,7 +1351,7 @@ class Client(SwaggerClient):
1346
1351
 
1347
1352
  return Table.from_dict(table)
1348
1353
 
1349
- def get_structure(self, sid_or_md5: str) -> Type[Structure]:
1354
+ def get_structure(self, sid_or_md5: str) -> Structure:
1350
1355
  """Retrieve pymatgen structure
1351
1356
 
1352
1357
  Args:
@@ -1374,7 +1379,7 @@ class Client(SwaggerClient):
1374
1379
  resp = self.structures.getStructureById(pk=sid, _fields=fields).result()
1375
1380
  return Structure.from_dict(resp)
1376
1381
 
1377
- def get_attachment(self, aid_or_md5: str) -> Type[Attachment]:
1382
+ def get_attachment(self, aid_or_md5: str) -> Attachment:
1378
1383
  """Retrieve an attachment
1379
1384
 
1380
1385
  Args:
@@ -1402,7 +1407,9 @@ class Client(SwaggerClient):
1402
1407
  self.attachments.getAttachmentById(pk=aid, _fields=["_all"]).result()
1403
1408
  )
1404
1409
 
1405
- def init_columns(self, columns: dict = None) -> dict:
1410
+ def init_columns(
1411
+ self, columns: Optional[dict] = None, name: Optional[str] = None
1412
+ ) -> dict:
1406
1413
  """initialize columns for a project to set their order and desired units
1407
1414
 
1408
1415
  The `columns` field of a project tracks the minima and maxima of each `data` field
@@ -1435,8 +1442,11 @@ class Client(SwaggerClient):
1435
1442
  Args:
1436
1443
  columns (dict): dictionary mapping data column to its unit
1437
1444
  """
1438
- if not self.project:
1439
- raise MPContribsClientError("initialize client with project argument!")
1445
+ name = self.project or name
1446
+ if not name:
1447
+ raise MPContribsClientError(
1448
+ "initialize client with project or set `name` argument!"
1449
+ )
1440
1450
 
1441
1451
  columns = flatten(columns or {}, reducer="dot")
1442
1452
 
@@ -1497,9 +1507,7 @@ class Client(SwaggerClient):
1497
1507
 
1498
1508
  # TODO catch unsupported column renaming or implement solution
1499
1509
  # reconcile with existing columns
1500
- resp = self.projects.getProjectByName(
1501
- pk=self.project, _fields=["columns"]
1502
- ).result()
1510
+ resp = self.projects.getProjectByName(pk=name, _fields=["columns"]).result()
1503
1511
  existing_columns = {}
1504
1512
 
1505
1513
  for col in resp["columns"]:
@@ -1556,11 +1564,9 @@ class Client(SwaggerClient):
1556
1564
  if not valid:
1557
1565
  raise MPContribsClientError(error)
1558
1566
 
1559
- return self.projects.updateProjectByName(
1560
- pk=self.project, project=payload
1561
- ).result()
1567
+ return self.projects.updateProjectByName(pk=name, project=payload).result()
1562
1568
 
1563
- def delete_contributions(self, query: dict = None, timeout: int = -1):
1569
+ def delete_contributions(self, query: Optional[dict] = None, timeout: int = -1):
1564
1570
  """Remove all contributions for a query
1565
1571
 
1566
1572
  Args:
@@ -1594,7 +1600,7 @@ class Client(SwaggerClient):
1594
1600
  _run_futures(futures, total=total, timeout=timeout)
1595
1601
  left, _ = self.get_totals(query=query)
1596
1602
  deleted = total - left
1597
- self.init_columns()
1603
+ self.init_columns(name=query["project"])
1598
1604
  self._reinit()
1599
1605
  toc = time.perf_counter()
1600
1606
  dt = (toc - tic) / 60
@@ -1607,7 +1613,7 @@ class Client(SwaggerClient):
1607
1613
 
1608
1614
  def get_totals(
1609
1615
  self,
1610
- query: dict = None,
1616
+ query: Optional[dict] = None,
1611
1617
  timeout: int = -1,
1612
1618
  resource: str = "contributions",
1613
1619
  op: str = "query",
@@ -1648,11 +1654,11 @@ class Client(SwaggerClient):
1648
1654
 
1649
1655
  return result["total_count"], result["total_pages"]
1650
1656
 
1651
- def count(self, query: dict = None) -> int:
1657
+ def count(self, query: Optional[dict] = None) -> int:
1652
1658
  """shortcut for get_totals()"""
1653
1659
  return self.get_totals(query=query)[0]
1654
1660
 
1655
- def get_unique_identifiers_flags(self, query: dict = None) -> dict:
1661
+ def get_unique_identifiers_flags(self, query: Optional[dict] = None) -> dict:
1656
1662
  """Retrieve values for `unique_identifiers` flags.
1657
1663
 
1658
1664
  See `client.available_query_params(resource="projects")` for available query parameters.
@@ -1672,10 +1678,10 @@ class Client(SwaggerClient):
1672
1678
 
1673
1679
  def get_all_ids(
1674
1680
  self,
1675
- query: dict = None,
1676
- include: List[str] = None,
1681
+ query: Optional[dict] = None,
1682
+ include: Optional[list[str]] = None,
1677
1683
  timeout: int = -1,
1678
- data_id_fields: dict = None,
1684
+ data_id_fields: Optional[dict] = None,
1679
1685
  fmt: str = "sets",
1680
1686
  op: str = "query",
1681
1687
  ) -> dict:
@@ -1830,12 +1836,12 @@ class Client(SwaggerClient):
1830
1836
 
1831
1837
  def query_contributions(
1832
1838
  self,
1833
- query: dict = None,
1834
- fields: list = None,
1835
- sort: str = None,
1839
+ query: Optional[dict] = None,
1840
+ fields: Optional[list] = None,
1841
+ sort: Optional[str] = None,
1836
1842
  paginate: bool = False,
1837
1843
  timeout: int = -1,
1838
- ) -> List[dict]:
1844
+ ) -> dict:
1839
1845
  """Query contributions
1840
1846
 
1841
1847
  See `client.available_query_params()` for keyword arguments used in query.
@@ -1886,7 +1892,7 @@ class Client(SwaggerClient):
1886
1892
  return ret
1887
1893
 
1888
1894
  def update_contributions(
1889
- self, data: dict, query: dict = None, timeout: int = -1
1895
+ self, data: dict, query: Optional[dict] = None, timeout: int = -1
1890
1896
  ) -> dict:
1891
1897
  """Apply the same update to all contributions in a project (matching query)
1892
1898
 
@@ -1898,7 +1904,7 @@ class Client(SwaggerClient):
1898
1904
  timeout (int): cancel remaining requests if timeout exceeded (in seconds)
1899
1905
  """
1900
1906
  if not data:
1901
- return "Nothing to update."
1907
+ raise MPContribsClientError("Nothing to update.")
1902
1908
 
1903
1909
  tic = time.perf_counter()
1904
1910
  valid, error = self._is_valid_payload("Contribution", data)
@@ -1912,27 +1918,28 @@ class Client(SwaggerClient):
1912
1918
 
1913
1919
  query = query or {}
1914
1920
 
1915
- if not self.project and (not query or "project" not in query):
1916
- raise MPContribsClientError(
1917
- "initialize client with project, or include project in query!"
1918
- )
1919
-
1920
- if "project" in query and self.project != query["project"]:
1921
- raise MPContribsClientError(
1922
- f"client initialized with different project {self.project}!"
1923
- )
1921
+ if self.project:
1922
+ if "project" in query and self.project != query["project"]:
1923
+ raise MPContribsClientError(
1924
+ f"client initialized with different project {self.project}!"
1925
+ )
1926
+ query["project"] = self.project
1927
+ else:
1928
+ if not query or "project" not in query:
1929
+ raise MPContribsClientError(
1930
+ "initialize client with project, or include project in query!"
1931
+ )
1924
1932
 
1925
- query["project"] = self.project
1926
- cids = list(self.get_all_ids(query).get(self.project, {}).get("ids", set()))
1933
+ name = query["project"]
1934
+ cids = list(self.get_all_ids(query).get(name, {}).get("ids", set()))
1927
1935
 
1928
1936
  if not cids:
1929
- logger.info(f"There aren't any contributions to update for {self.project}")
1930
- return
1937
+ raise MPContribsClientError(
1938
+ f"There aren't any contributions to update for {name}"
1939
+ )
1931
1940
 
1932
1941
  # get current list of data columns to decide if swagger reload is needed
1933
- resp = self.projects.getProjectByName(
1934
- pk=self.project, _fields=["columns"]
1935
- ).result()
1942
+ resp = self.projects.getProjectByName(pk=name, _fields=["columns"]).result()
1936
1943
  old_paths = set(c["path"] for c in resp["columns"])
1937
1944
 
1938
1945
  total = len(cids)
@@ -1947,20 +1954,18 @@ class Client(SwaggerClient):
1947
1954
  updated = sum(resp["count"] for _, resp in responses.items())
1948
1955
 
1949
1956
  if updated:
1950
- resp = self.projects.getProjectByName(
1951
- pk=self.project, _fields=["columns"]
1952
- ).result()
1957
+ resp = self.projects.getProjectByName(pk=name, _fields=["columns"]).result()
1953
1958
  new_paths = set(c["path"] for c in resp["columns"])
1954
1959
 
1955
1960
  if new_paths != old_paths:
1956
- self.init_columns()
1961
+ self.init_columns(name=name)
1957
1962
  self._reinit()
1958
1963
 
1959
1964
  toc = time.perf_counter()
1960
1965
  return {"updated": updated, "total": total, "seconds_elapsed": toc - tic}
1961
1966
 
1962
1967
  def make_public(
1963
- self, query: dict = None, recursive: bool = False, timeout: int = -1
1968
+ self, query: Optional[dict] = None, recursive: bool = False, timeout: int = -1
1964
1969
  ) -> dict:
1965
1970
  """Publish a project and optionally its contributions
1966
1971
 
@@ -1973,7 +1978,7 @@ class Client(SwaggerClient):
1973
1978
  )
1974
1979
 
1975
1980
  def make_private(
1976
- self, query: dict = None, recursive: bool = False, timeout: int = -1
1981
+ self, query: Optional[dict] = None, recursive: bool = False, timeout: int = -1
1977
1982
  ) -> dict:
1978
1983
  """Make a project and optionally its contributions private
1979
1984
 
@@ -1988,7 +1993,7 @@ class Client(SwaggerClient):
1988
1993
  def _set_is_public(
1989
1994
  self,
1990
1995
  is_public: bool,
1991
- query: dict = None,
1996
+ query: Optional[dict] = None,
1992
1997
  recursive: bool = False,
1993
1998
  timeout: int = -1,
1994
1999
  ) -> dict:
@@ -2040,7 +2045,7 @@ class Client(SwaggerClient):
2040
2045
  if recursive:
2041
2046
  query = query or {}
2042
2047
  query["is_public"] = not is_public
2043
- ret["contributions"] = self.updateContributions(
2048
+ ret["contributions"] = self.update_contributions(
2044
2049
  {"is_public": is_public}, query=query, timeout=timeout
2045
2050
  )
2046
2051
 
@@ -2048,7 +2053,7 @@ class Client(SwaggerClient):
2048
2053
 
2049
2054
  def submit_contributions(
2050
2055
  self,
2051
- contributions: List[dict],
2056
+ contributions: list[dict],
2052
2057
  ignore_dupes: bool = False,
2053
2058
  timeout: int = -1,
2054
2059
  skip_dupe_check: bool = False,
@@ -2250,6 +2255,8 @@ class Client(SwaggerClient):
2250
2255
  element = Attachment.from_file(element)
2251
2256
 
2252
2257
  dct = {k: element[k] for k in ["mime", "content"]}
2258
+ else:
2259
+ raise MPContribsClientError("This should never happen")
2253
2260
 
2254
2261
  digest = get_md5(dct)
2255
2262
 
@@ -2406,11 +2413,11 @@ class Client(SwaggerClient):
2406
2413
  logger.info(
2407
2414
  f"{project_name}: resubmit failed contributions manually"
2408
2415
  )
2416
+ self.init_columns(name=project_name)
2409
2417
 
2418
+ self._reinit()
2410
2419
  toc = time.perf_counter()
2411
2420
  dt = (toc - tic) / 60
2412
- self.init_columns()
2413
- self._reinit()
2414
2421
  logger.info(
2415
2422
  f"It took {dt:.1f}min to submit {total_processed}/{total} contributions."
2416
2423
  )
@@ -2419,12 +2426,12 @@ class Client(SwaggerClient):
2419
2426
 
2420
2427
  def download_contributions(
2421
2428
  self,
2422
- query: dict = None,
2429
+ query: Optional[dict] = None,
2423
2430
  outdir: Union[str, Path] = DEFAULT_DOWNLOAD_DIR,
2424
2431
  overwrite: bool = False,
2425
- include: List[str] = None,
2432
+ include: Optional[list[str]] = None,
2426
2433
  timeout: int = -1,
2427
- ) -> int:
2434
+ ) -> list:
2428
2435
  """Download a list of contributions as .json.gz file(s)
2429
2436
 
2430
2437
  Args:
@@ -2446,7 +2453,7 @@ class Client(SwaggerClient):
2446
2453
  if include and not components:
2447
2454
  raise MPContribsClientError(f"`include` must be subset of {COMPONENTS}!")
2448
2455
 
2449
- all_ids = self.get_all_ids(query, include=components, timeout=timeout)
2456
+ all_ids = self.get_all_ids(query, include=list(components), timeout=timeout)
2450
2457
  fmt = query.get("format", "json")
2451
2458
  contributions, components_loaded = [], defaultdict(dict)
2452
2459
 
@@ -2520,12 +2527,12 @@ class Client(SwaggerClient):
2520
2527
 
2521
2528
  def download_structures(
2522
2529
  self,
2523
- ids: List[str],
2530
+ ids: list[str],
2524
2531
  outdir: Union[str, Path] = DEFAULT_DOWNLOAD_DIR,
2525
2532
  overwrite: bool = False,
2526
2533
  timeout: int = -1,
2527
2534
  fmt: str = "json",
2528
- ) -> Path:
2535
+ ) -> list[Path]:
2529
2536
  """Download a list of structures as a .json.gz file
2530
2537
 
2531
2538
  Args:
@@ -2549,12 +2556,12 @@ class Client(SwaggerClient):
2549
2556
 
2550
2557
  def download_tables(
2551
2558
  self,
2552
- ids: List[str],
2559
+ ids: list[str],
2553
2560
  outdir: Union[str, Path] = DEFAULT_DOWNLOAD_DIR,
2554
2561
  overwrite: bool = False,
2555
2562
  timeout: int = -1,
2556
2563
  fmt: str = "json",
2557
- ) -> Path:
2564
+ ) -> list[Path]:
2558
2565
  """Download a list of tables as a .json.gz file
2559
2566
 
2560
2567
  Args:
@@ -2578,12 +2585,12 @@ class Client(SwaggerClient):
2578
2585
 
2579
2586
  def download_attachments(
2580
2587
  self,
2581
- ids: List[str],
2588
+ ids: list[str],
2582
2589
  outdir: Union[str, Path] = DEFAULT_DOWNLOAD_DIR,
2583
2590
  overwrite: bool = False,
2584
2591
  timeout: int = -1,
2585
2592
  fmt: str = "json",
2586
- ) -> Path:
2593
+ ) -> list[Path]:
2587
2594
  """Download a list of attachments as a .json.gz file
2588
2595
 
2589
2596
  Args:
@@ -2608,12 +2615,12 @@ class Client(SwaggerClient):
2608
2615
  def _download_resource(
2609
2616
  self,
2610
2617
  resource: str,
2611
- ids: List[str],
2618
+ ids: list[str],
2612
2619
  outdir: Union[str, Path] = DEFAULT_DOWNLOAD_DIR,
2613
2620
  overwrite: bool = False,
2614
2621
  timeout: int = -1,
2615
2622
  fmt: str = "json",
2616
- ) -> Path:
2623
+ ) -> list[Path]:
2617
2624
  """Helper to download a list of resources as .json.gz file
2618
2625
 
2619
2626
  Args:
@@ -2625,7 +2632,7 @@ class Client(SwaggerClient):
2625
2632
  fmt: download format - "json" or "csv"
2626
2633
 
2627
2634
  Returns:
2628
- tuple (paths of output files, objects per path / per_page)
2635
+ list of paths to output files
2629
2636
  """
2630
2637
  resources = ["contributions"] + COMPONENTS
2631
2638
  if resource not in resources:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mpcontribs-client
3
- Version: 5.10.0
3
+ Version: 5.10.2
4
4
  Summary: client library for MPContribs API
5
5
  Home-page: https://github.com/materialsproject/MPContribs/tree/master/mpcontribs-client
6
6
  Author: Patrick Huck