benchling-sdk 1.10.0a12__py3-none-any.whl → 1.11.0a0__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.
@@ -12,9 +12,28 @@ def ref(reference: ReferencedSessionLinkType) -> str:
12
12
 
13
13
  Example:
14
14
  dna_sequence = benchling.dna_sequences.get_by_id("seq_1234")
15
- AppSessionMessageCreate(f"This is my DNA sequence {ref(dna_sequence)} for analysis"
15
+ AppSessionMessageCreate(f"This is my DNA sequence {ref(dna_sequence)} for analysis")
16
16
  """
17
- # Not sure {} are possible in Benchling IDs, but the spec says we're escaping
18
- unescape_id = reference.id
19
- escaped_id = unescape_id.replace("{", "\\{").replace("}", "\\}")
17
+ return ref_by_id(reference.id)
18
+
19
+
20
+ def ref_by_id(reference_id: str) -> str:
21
+ """
22
+ Ref by ID.
23
+
24
+ Helper method for serializing a reference to an object into a string embeddable in
25
+ AppSessionMessageCreate content via the reference object's id. This is helpful when clients
26
+ don't already have access to the referenced object.
27
+
28
+ Example:
29
+ dna_sequence_id: str = "seq_asQya4lk"
30
+ AppSessionMessageCreate(f"This is my DNA sequence {ref_by_id(dna_sequence_id)} for analysis")
31
+ """
32
+ assert reference_id, "reference_id cannot be empty or None"
33
+ return _encode_id(reference_id)
34
+
35
+
36
+ def _encode_id(id: str) -> str:
37
+ """Not sure {} are possible in Benchling IDs, but the spec says we're escaping."""
38
+ escaped_id = id.replace("{", "\\{").replace("}", "\\}")
20
39
  return f"{{id:{escaped_id}}}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: benchling-sdk
3
- Version: 1.10.0a12
3
+ Version: 1.11.0a0
4
4
  Summary: SDK for interacting with the Benchling Platform.
5
5
  License: Apache-2.0
6
6
  Author: Benchling Support
@@ -20,7 +20,7 @@ benchling_sdk/apps/helpers/webhook_helpers.py,sha256=R5bk480BbvomQ0kK9RXsnsrMBn-
20
20
  benchling_sdk/apps/status/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  benchling_sdk/apps/status/errors.py,sha256=BezqnaHkCG1QBscD4301NjSYBHu7BzdYEUKF90psuz0,2377
22
22
  benchling_sdk/apps/status/framework.py,sha256=go0pyU5qgMCvsrTDXWk3V9FZwbaRHgfhEWtjIZ-JLEE,27418
23
- benchling_sdk/apps/status/helpers.py,sha256=o8jdgdxUYdGh2j0Gb3AYoeXI9Bu-ubyIkgWBuCGLKgE,705
23
+ benchling_sdk/apps/status/helpers.py,sha256=MSa2soRIK7TiA9TWAEg-EoqZ7ZYyjTmtJ28JIe6LUds,1316
24
24
  benchling_sdk/apps/status/types.py,sha256=vE7-_7ns3mvPRJoVv-GQxc3389dIIH4mcG0VDNWpVhQ,746
25
25
  benchling_sdk/apps/types.py,sha256=TBTfAB3IOoZjZqzTOK25kN3b6RTU9Z7tOMdBbq6u8lA,110
26
26
  benchling_sdk/auth/__init__.py,sha256=N4pJYVUnTLzg5HO9ZldHaI-Am97i6AOCdQS0M5QcVpA,120
@@ -115,7 +115,7 @@ benchling_sdk/services/v2/v2_alpha_service.py,sha256=vNfYK0Dheml9ozR_0tzTlA3blPD
115
115
  benchling_sdk/services/v2/v2_beta_service.py,sha256=0vbjFFfPQNUGUhckR_cnzGjypRMBpBP6c5c49zrA3mk,11564
116
116
  benchling_sdk/services/v2/v2_stable_service.py,sha256=YIc-_0p6x1NQqj7awnWgCTHxbxYO7ZOolePZyW90whc,35246
117
117
  benchling_sdk/services/v2_service.py,sha256=3eoIjYEmGLPdWCpBN0pl7q7_HNWCsUvfvTn3Hcz0wSM,2860
118
- benchling_sdk-1.10.0a12.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
119
- benchling_sdk-1.10.0a12.dist-info/METADATA,sha256=n5szlyWEsJSYFRmKpajezDP15hNiJSzGh6MVRfDKyQs,2127
120
- benchling_sdk-1.10.0a12.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
121
- benchling_sdk-1.10.0a12.dist-info/RECORD,,
118
+ benchling_sdk-1.11.0a0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
119
+ benchling_sdk-1.11.0a0.dist-info/METADATA,sha256=kIJQoX4idjcIolmANOqV6HXFfbk9DpZ-ZG9TJ5hJXHk,2126
120
+ benchling_sdk-1.11.0a0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
121
+ benchling_sdk-1.11.0a0.dist-info/RECORD,,