mpcontribs-client 5.9.0__py3-none-any.whl → 5.10.1__py3-none-any.whl
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.
- mpcontribs/client/__init__.py +19 -15
- {mpcontribs_client-5.9.0.dist-info → mpcontribs_client-5.10.1.dist-info}/METADATA +20 -10
- mpcontribs_client-5.10.1.dist-info/RECORD +6 -0
- {mpcontribs_client-5.9.0.dist-info → mpcontribs_client-5.10.1.dist-info}/WHEEL +1 -1
- mpcontribs_client-5.9.0.dist-info/RECORD +0 -6
- {mpcontribs_client-5.9.0.dist-info → mpcontribs_client-5.10.1.dist-info}/LICENSE +0 -0
- {mpcontribs_client-5.9.0.dist-info → mpcontribs_client-5.10.1.dist-info}/top_level.txt +0 -0
mpcontribs/client/__init__.py
CHANGED
|
@@ -54,8 +54,6 @@ from urllib3.util.retry import Retry
|
|
|
54
54
|
from filetype.types.archive import Gz
|
|
55
55
|
from filetype.types.image import Jpeg, Png, Gif, Tiff
|
|
56
56
|
from pint import UnitRegistry
|
|
57
|
-
from pint.unit import UnitDefinition
|
|
58
|
-
from pint.converters import ScaleConverter
|
|
59
57
|
from pint.errors import DimensionalityError
|
|
60
58
|
from tempfile import gettempdir
|
|
61
59
|
from plotly.express._chart_types import line as line_chart
|
|
@@ -104,13 +102,20 @@ ureg = UnitRegistry(
|
|
|
104
102
|
lambda s: s.replace("%", " percent "),
|
|
105
103
|
],
|
|
106
104
|
)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
ureg.define(
|
|
110
|
-
|
|
105
|
+
if "percent" not in ureg:
|
|
106
|
+
# percent is native in pint >= 0.21
|
|
107
|
+
ureg.define("percent = 0.01 = %")
|
|
108
|
+
if "permille" not in ureg:
|
|
109
|
+
# permille is native in pint >= 0.24.2
|
|
110
|
+
ureg.define("permille = 0.001 = ‰ = %%")
|
|
111
|
+
if "ppm" not in ureg:
|
|
112
|
+
# ppm is native in pint >= 0.21
|
|
113
|
+
ureg.define("ppm = 1e-6")
|
|
114
|
+
ureg.define("ppb = 1e-9")
|
|
111
115
|
ureg.define("atom = 1")
|
|
112
116
|
ureg.define("bohr_magneton = e * hbar / (2 * m_e) = µᵇ = µ_B = mu_B")
|
|
113
117
|
ureg.define("electron_mass = 9.1093837015e-31 kg = mₑ = m_e")
|
|
118
|
+
ureg.define("sccm = cm³/min")
|
|
114
119
|
|
|
115
120
|
LOG_LEVEL = os.environ.get("MPCONTRIBS_CLIENT_LOG_LEVEL", "INFO")
|
|
116
121
|
log_level = getattr(logging, LOG_LEVEL.upper())
|
|
@@ -1398,7 +1403,7 @@ class Client(SwaggerClient):
|
|
|
1398
1403
|
self.attachments.getAttachmentById(pk=aid, _fields=["_all"]).result()
|
|
1399
1404
|
)
|
|
1400
1405
|
|
|
1401
|
-
def init_columns(self, columns: dict = None) -> dict:
|
|
1406
|
+
def init_columns(self, columns: dict = None, name: str = None) -> dict:
|
|
1402
1407
|
"""initialize columns for a project to set their order and desired units
|
|
1403
1408
|
|
|
1404
1409
|
The `columns` field of a project tracks the minima and maxima of each `data` field
|
|
@@ -1431,8 +1436,11 @@ class Client(SwaggerClient):
|
|
|
1431
1436
|
Args:
|
|
1432
1437
|
columns (dict): dictionary mapping data column to its unit
|
|
1433
1438
|
"""
|
|
1434
|
-
|
|
1435
|
-
|
|
1439
|
+
name = self.project or name
|
|
1440
|
+
if not name:
|
|
1441
|
+
raise MPContribsClientError(
|
|
1442
|
+
"initialize client with project or set `name` argument!"
|
|
1443
|
+
)
|
|
1436
1444
|
|
|
1437
1445
|
columns = flatten(columns or {}, reducer="dot")
|
|
1438
1446
|
|
|
@@ -1493,9 +1501,7 @@ class Client(SwaggerClient):
|
|
|
1493
1501
|
|
|
1494
1502
|
# TODO catch unsupported column renaming or implement solution
|
|
1495
1503
|
# reconcile with existing columns
|
|
1496
|
-
resp = self.projects.getProjectByName(
|
|
1497
|
-
pk=self.project, _fields=["columns"]
|
|
1498
|
-
).result()
|
|
1504
|
+
resp = self.projects.getProjectByName(pk=name, _fields=["columns"]).result()
|
|
1499
1505
|
existing_columns = {}
|
|
1500
1506
|
|
|
1501
1507
|
for col in resp["columns"]:
|
|
@@ -1552,9 +1558,7 @@ class Client(SwaggerClient):
|
|
|
1552
1558
|
if not valid:
|
|
1553
1559
|
raise MPContribsClientError(error)
|
|
1554
1560
|
|
|
1555
|
-
return self.projects.updateProjectByName(
|
|
1556
|
-
pk=self.project, project=payload
|
|
1557
|
-
).result()
|
|
1561
|
+
return self.projects.updateProjectByName(pk=name, project=payload).result()
|
|
1558
1562
|
|
|
1559
1563
|
def delete_contributions(self, query: dict = None, timeout: int = -1):
|
|
1560
1564
|
"""Remove all contributions for a query
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: mpcontribs-client
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.10.1
|
|
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
|
|
@@ -9,7 +9,7 @@ License: MIT
|
|
|
9
9
|
Requires-Python: >=3.8
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
License-File: LICENSE
|
|
12
|
-
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: numpy
|
|
13
13
|
Requires-Dist: boltons
|
|
14
14
|
Requires-Dist: bravado
|
|
15
15
|
Requires-Dist: filetype
|
|
@@ -17,7 +17,7 @@ Requires-Dist: flatten-dict
|
|
|
17
17
|
Requires-Dist: ipython
|
|
18
18
|
Requires-Dist: json2html
|
|
19
19
|
Requires-Dist: pandas
|
|
20
|
-
Requires-Dist: pint
|
|
20
|
+
Requires-Dist: pint
|
|
21
21
|
Requires-Dist: plotly
|
|
22
22
|
Requires-Dist: pyIsEmail
|
|
23
23
|
Requires-Dist: pymatgen
|
|
@@ -29,12 +29,22 @@ Requires-Dist: ujson
|
|
|
29
29
|
Requires-Dist: semantic-version
|
|
30
30
|
Requires-Dist: cachetools
|
|
31
31
|
Provides-Extra: dev
|
|
32
|
-
Requires-Dist: flake8
|
|
33
|
-
Requires-Dist: pytest
|
|
34
|
-
Requires-Dist: pytest-flake8
|
|
35
|
-
Requires-Dist: pytest-pycodestyle
|
|
36
|
-
Requires-Dist: pytest-cov
|
|
37
|
-
Requires-Dist: py
|
|
32
|
+
Requires-Dist: flake8; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-flake8; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-pycodestyle; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
37
|
+
Requires-Dist: py; extra == "dev"
|
|
38
|
+
Dynamic: author
|
|
39
|
+
Dynamic: author-email
|
|
40
|
+
Dynamic: description
|
|
41
|
+
Dynamic: description-content-type
|
|
42
|
+
Dynamic: home-page
|
|
43
|
+
Dynamic: license
|
|
44
|
+
Dynamic: provides-extra
|
|
45
|
+
Dynamic: requires-dist
|
|
46
|
+
Dynamic: requires-python
|
|
47
|
+
Dynamic: summary
|
|
38
48
|
|
|
39
49
|

|
|
40
50
|

|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
mpcontribs/client/__init__.py,sha256=SmVQBVOTWRYfX-rUXEP1gdPkJANxWdTDUP5c679yRSU,97012
|
|
2
|
+
mpcontribs_client-5.10.1.dist-info/LICENSE,sha256=5tG0Niaqw2hnuyZZYkRXLSnfVrZA47COwduU_6caPLM,1074
|
|
3
|
+
mpcontribs_client-5.10.1.dist-info/METADATA,sha256=vsvzgHYxTxXppTw3ZaCu7mJU4HAmmvOgKZdwv3ijg-o,2776
|
|
4
|
+
mpcontribs_client-5.10.1.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
5
|
+
mpcontribs_client-5.10.1.dist-info/top_level.txt,sha256=t8R5L_Dg9oDQMh2gyRFdZGnrzZsr7OjCBTrhTcmimC8,11
|
|
6
|
+
mpcontribs_client-5.10.1.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
mpcontribs/client/__init__.py,sha256=K4OCUoMpwJvkAbJvM03-TPd5wzQi0RkBpjd8WJBwP7w,96983
|
|
2
|
-
mpcontribs_client-5.9.0.dist-info/LICENSE,sha256=5tG0Niaqw2hnuyZZYkRXLSnfVrZA47COwduU_6caPLM,1074
|
|
3
|
-
mpcontribs_client-5.9.0.dist-info/METADATA,sha256=5zIrQcDW0whyINa0Vnq8PnRIlHvd8tdvyDjPt05p7LE,2572
|
|
4
|
-
mpcontribs_client-5.9.0.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
5
|
-
mpcontribs_client-5.9.0.dist-info/top_level.txt,sha256=t8R5L_Dg9oDQMh2gyRFdZGnrzZsr7OjCBTrhTcmimC8,11
|
|
6
|
-
mpcontribs_client-5.9.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|