rowan-python 1.1.8__tar.gz → 1.1.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rowan-python
3
- Version: 1.1.8
3
+ Version: 1.1.9
4
4
  Summary: Rowan Python Library
5
5
  Project-URL: Homepage, https://github.com/rowansci/rowan-client
6
6
  Project-URL: Bug Tracker, https://github.com/rowansci/rowan-client/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "rowan-python"
3
- version = "1.1.8"
3
+ version = "1.1.9"
4
4
  description = "Rowan Python Library"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.8"
@@ -8,3 +8,4 @@ from . import constants
8
8
  from .folder import Folder
9
9
  from .workflow import Workflow
10
10
  from .calculation import Calculation
11
+ from .protein import Protein
@@ -0,0 +1,63 @@
1
+ import stjames
2
+ from typing import Optional
3
+
4
+
5
+ from .utils import api_client
6
+
7
+
8
+ class Protein:
9
+ @classmethod
10
+ def retrieve(cls, uuid: stjames.UUID) -> dict:
11
+ with api_client() as client:
12
+ response = client.get(f"/protein/{uuid}")
13
+ response.raise_for_status()
14
+ return response.json()
15
+
16
+ @classmethod
17
+ def update(
18
+ cls,
19
+ uuid: stjames.UUID,
20
+ name: Optional[str] = None,
21
+ data: Optional[dict] = None,
22
+ public: Optional[bool] = None,
23
+ pocket: Optional[list[list[float]]] = None,
24
+ ) -> None:
25
+ old_data = cls.retrieve(uuid)
26
+
27
+ new_data = {}
28
+ new_data["name"] = name if name is not None else old_data["name"]
29
+ new_data["data"] = data if data is not None else old_data["data"]
30
+ new_data["public"] = public if public is not None else old_data["public"]
31
+ new_data["pocket"] = pocket if pocket is not None else old_data["pocket"]
32
+
33
+ with api_client() as client:
34
+ response = client.post(f"/protein/{uuid}", json=new_data)
35
+ response.raise_for_status()
36
+ return response.json()
37
+
38
+ @classmethod
39
+ def delete(cls, uuid: stjames.UUID) -> None:
40
+ with api_client() as client:
41
+ response = client.delete(f"/protein/{uuid}")
42
+ response.raise_for_status()
43
+
44
+ @classmethod
45
+ def list(
46
+ cls,
47
+ ancestor_uuid: Optional[stjames.UUID] = None,
48
+ name_contains: Optional[str] = None,
49
+ page: int = 0,
50
+ size: int = 20,
51
+ ):
52
+ params = {"page": page, "size": size}
53
+
54
+ if ancestor_uuid is not None:
55
+ params["ancestor_uuid"] = ancestor_uuid
56
+
57
+ if name_contains is not None:
58
+ params["name_contains"] = name_contains
59
+
60
+ with api_client() as client:
61
+ response = client.get("/protein", params=params)
62
+ response.raise_for_status()
63
+ return response.json()
File without changes
File without changes
File without changes
File without changes