benchling-sdk 1.9.0a4__py3-none-any.whl → 1.10.0__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.
- benchling_sdk/apps/canvas/__init__.py +0 -0
- benchling_sdk/apps/canvas/errors.py +14 -0
- benchling_sdk/apps/{helpers/canvas_helpers.py → canvas/framework.py} +129 -188
- benchling_sdk/apps/canvas/types.py +125 -0
- benchling_sdk/apps/config/__init__.py +0 -3
- benchling_sdk/apps/config/decryption_provider.py +1 -1
- benchling_sdk/apps/config/errors.py +38 -0
- benchling_sdk/apps/config/framework.py +343 -0
- benchling_sdk/apps/config/helpers.py +157 -0
- benchling_sdk/apps/config/{mock_dependencies.py → mock_config.py} +78 -99
- benchling_sdk/apps/config/types.py +36 -0
- benchling_sdk/apps/framework.py +49 -338
- benchling_sdk/apps/helpers/webhook_helpers.py +2 -2
- benchling_sdk/apps/status/__init__.py +0 -0
- benchling_sdk/apps/status/errors.py +85 -0
- benchling_sdk/apps/{helpers/session_helpers.py → status/framework.py} +58 -167
- benchling_sdk/apps/status/helpers.py +20 -0
- benchling_sdk/apps/status/types.py +45 -0
- benchling_sdk/apps/types.py +3 -0
- benchling_sdk/errors.py +4 -4
- benchling_sdk/helpers/retry_helpers.py +3 -1
- benchling_sdk/models/__init__.py +44 -0
- benchling_sdk/services/v2/beta/{v2_beta_dataset_service.py → v2_beta_data_frame_service.py} +126 -116
- benchling_sdk/services/v2/stable/assay_result_service.py +18 -0
- benchling_sdk/services/v2/v2_beta_service.py +11 -11
- {benchling_sdk-1.9.0a4.dist-info → benchling_sdk-1.10.0.dist-info}/METADATA +4 -4
- {benchling_sdk-1.9.0a4.dist-info → benchling_sdk-1.10.0.dist-info}/RECORD +30 -21
- benchling_sdk/apps/config/dependencies.py +0 -1085
- benchling_sdk/apps/config/scalars.py +0 -226
- benchling_sdk/apps/helpers/config_helpers.py +0 -409
- /benchling_sdk/apps/{helpers → config}/cryptography_helpers.py +0 -0
- {benchling_sdk-1.9.0a4.dist-info → benchling_sdk-1.10.0.dist-info}/LICENSE +0 -0
- {benchling_sdk-1.9.0a4.dist-info → benchling_sdk-1.10.0.dist-info}/WHEEL +0 -0
@@ -4,7 +4,7 @@ from datetime import date, datetime
|
|
4
4
|
import json
|
5
5
|
import random
|
6
6
|
import string
|
7
|
-
from typing import Dict, get_args, List, Optional, Protocol,
|
7
|
+
from typing import cast, Dict, get_args, List, Optional, Protocol, Union
|
8
8
|
|
9
9
|
from benchling_api_client.v2.beta.models.base_manifest_config import BaseManifestConfig
|
10
10
|
from benchling_api_client.v2.beta.models.benchling_app_manifest import BenchlingAppManifest
|
@@ -34,34 +34,20 @@ from benchling_api_client.v2.extensions import UnknownType
|
|
34
34
|
from benchling_api_client.v2.stable.types import UNSET, Unset
|
35
35
|
|
36
36
|
from benchling_sdk.apps.config.decryption_provider import BaseDecryptionProvider
|
37
|
-
from benchling_sdk.apps.config.
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
DateTimeScalar,
|
48
|
-
FloatScalar,
|
49
|
-
IntScalar,
|
50
|
-
JsonScalar,
|
51
|
-
JsonType,
|
52
|
-
ScalarDefinition,
|
53
|
-
ScalarType,
|
54
|
-
SecureTextScalar,
|
55
|
-
TextScalar,
|
56
|
-
)
|
57
|
-
from benchling_sdk.apps.helpers.config_helpers import (
|
58
|
-
element_definition_from_dependency,
|
59
|
-
enum_from_dependency,
|
60
|
-
field_definitions_from_dependency,
|
61
|
-
options_from_dependency,
|
62
|
-
subtype_from_entity_schema_dependency,
|
63
|
-
workflow_task_schema_output_from_dependency,
|
37
|
+
from benchling_sdk.apps.config.errors import UnsupportedConfigItemError
|
38
|
+
from benchling_sdk.apps.config.framework import _supported_config_item, ConfigItemStore, StaticConfigProvider
|
39
|
+
from benchling_sdk.apps.config.helpers import (
|
40
|
+
_element_definition_from_dependency,
|
41
|
+
_enum_from_dependency,
|
42
|
+
_field_definitions_from_dependency,
|
43
|
+
_options_from_dependency,
|
44
|
+
_subtype_from_entity_schema_dependency,
|
45
|
+
_workflow_task_schema_output_from_dependency,
|
46
|
+
datetime_config_value_to_str,
|
64
47
|
)
|
48
|
+
from benchling_sdk.apps.config.types import ConfigurationReference
|
49
|
+
from benchling_sdk.apps.types import JsonType
|
50
|
+
from benchling_sdk.helpers.logging_helpers import log_stability_warning, StabilityLevel
|
65
51
|
from benchling_sdk.models import (
|
66
52
|
AppConfigItem,
|
67
53
|
ArrayElementAppConfigItem,
|
@@ -103,7 +89,7 @@ ManifestDependencies = Union[
|
|
103
89
|
UnknownType,
|
104
90
|
]
|
105
91
|
|
106
|
-
|
92
|
+
log_stability_warning(StabilityLevel.BETA)
|
107
93
|
|
108
94
|
|
109
95
|
class MockDecryptionFunction(Protocol):
|
@@ -141,7 +127,7 @@ class MockDecryptionProvider(BaseDecryptionProvider):
|
|
141
127
|
return self._mock_decryption_function(ciphertext)
|
142
128
|
|
143
129
|
|
144
|
-
class
|
130
|
+
class MockConfigItemStore(ConfigItemStore):
|
145
131
|
"""
|
146
132
|
Mock App Config.
|
147
133
|
|
@@ -152,42 +138,28 @@ class MockBenchlingAppConfig:
|
|
152
138
|
"""
|
153
139
|
|
154
140
|
_config_items: List[AppConfigItem]
|
155
|
-
_decryption_provider: Optional[MockDecryptionProvider]
|
156
141
|
|
157
|
-
def __init__(
|
158
|
-
self, config_items: List[AppConfigItem], decryption_provider: Optional[MockDecryptionProvider]
|
159
|
-
):
|
142
|
+
def __init__(self, config_items: List[AppConfigItem]):
|
160
143
|
"""
|
161
144
|
Init Mock Benchling App Config.
|
162
145
|
|
163
146
|
The class can be initialized by providing a list of AppConfigItem, but the recommended
|
164
147
|
usage is to mock directly from a manifest, like `MockBenchlingAppConfig.from_manifest()`
|
165
148
|
"""
|
149
|
+
super().__init__(StaticConfigProvider([_supported_config_item(item) for item in config_items]))
|
166
150
|
self._config_items = config_items
|
167
|
-
self._decryption_provider = decryption_provider
|
168
151
|
|
169
152
|
@classmethod
|
170
|
-
def from_manifest(
|
171
|
-
cls, manifest: BenchlingAppManifest, decryption_provider: Optional[MockDecryptionProvider] = None
|
172
|
-
) -> MockBenchlingAppConfig:
|
153
|
+
def from_manifest(cls, manifest: BenchlingAppManifest) -> MockConfigItemStore:
|
173
154
|
"""
|
174
155
|
From Manifest.
|
175
156
|
|
176
157
|
Reads a manifest amd mocks out all dependencies.
|
177
158
|
"""
|
178
159
|
config_items = mock_app_config_items_from_manifest(manifest)
|
179
|
-
return cls(config_items
|
180
|
-
|
181
|
-
def to_dependencies(self, target_dependencies: Type[D]) -> D:
|
182
|
-
"""
|
183
|
-
To Dependencies.
|
184
|
-
|
185
|
-
Convenience method for providing mocked app config to a target class extending BaseDependencies.
|
186
|
-
"""
|
187
|
-
link_store = DependencyLinkStore(StaticConfigProvider(self.config_items))
|
188
|
-
return target_dependencies.from_store(link_store, decryption_provider=self._decryption_provider)
|
160
|
+
return cls(config_items)
|
189
161
|
|
190
|
-
def with_replacement(self, replacement: AppConfigItem) ->
|
162
|
+
def with_replacement(self, replacement: AppConfigItem) -> MockConfigItemStore:
|
191
163
|
"""
|
192
164
|
With Replacement.
|
193
165
|
|
@@ -197,9 +169,9 @@ class MockBenchlingAppConfig:
|
|
197
169
|
replaced_app_config = replace_mocked_config_item_by_path(
|
198
170
|
list(self.config_items), _config_path(replacement), replacement
|
199
171
|
)
|
200
|
-
return
|
172
|
+
return MockConfigItemStore(replaced_app_config)
|
201
173
|
|
202
|
-
def with_replacements(self, replacements: List[AppConfigItem]) ->
|
174
|
+
def with_replacements(self, replacements: List[AppConfigItem]) -> MockConfigItemStore:
|
203
175
|
"""
|
204
176
|
With Replacement.
|
205
177
|
|
@@ -211,7 +183,7 @@ class MockBenchlingAppConfig:
|
|
211
183
|
replaced_app_config = replace_mocked_config_item_by_path(
|
212
184
|
list(replaced_app_config), _config_path(replacement), replacement
|
213
185
|
)
|
214
|
-
return
|
186
|
+
return MockConfigItemStore(list(replaced_app_config))
|
215
187
|
|
216
188
|
@property
|
217
189
|
def config_items(self) -> List[ConfigurationReference]:
|
@@ -317,7 +289,7 @@ def mock_datetime_app_config_item(path: List[str], value: Optional[datetime]) ->
|
|
317
289
|
"""Mock a datetime app config item with a path and specified value."""
|
318
290
|
return DatetimeAppConfigItem(
|
319
291
|
path=path,
|
320
|
-
value=value
|
292
|
+
value=datetime_config_value_to_str(value) if value else None,
|
321
293
|
type=DatetimeAppConfigItemType.DATETIME,
|
322
294
|
id=_random_string("aci_"),
|
323
295
|
)
|
@@ -375,9 +347,10 @@ def mock_text_app_config_item(path: List[str], value: Optional[str]) -> TextAppC
|
|
375
347
|
|
376
348
|
def _mock_dependency(
|
377
349
|
dependency: ManifestDependencies,
|
378
|
-
parent_path: List[str] =
|
350
|
+
parent_path: Optional[List[str]] = None,
|
379
351
|
) -> List[AppConfigItem]:
|
380
352
|
"""Mock a dependency from its manifest definition."""
|
353
|
+
parent_path = parent_path if parent_path else []
|
381
354
|
# MyPy has trouble inferring lists with [config_item] + sub_items so use the syntax like:
|
382
355
|
# [*[config_item], *sub_items]
|
383
356
|
# See https://github.com/python/mypy/issues/3933#issuecomment-808739063
|
@@ -392,12 +365,12 @@ def _mock_dependency(
|
|
392
365
|
)
|
393
366
|
sub_items = [
|
394
367
|
_mock_subdependency(subdependency, dependency, parent_path=parent_path)
|
395
|
-
for subdependency in
|
368
|
+
for subdependency in _options_from_dependency(dependency)
|
396
369
|
]
|
397
370
|
return [*[config_item], *sub_items]
|
398
371
|
elif isinstance(dependency, EntitySchemaDependency):
|
399
372
|
linked_resource_id = _random_string("val_")
|
400
|
-
subtype =
|
373
|
+
subtype = _subtype_from_entity_schema_dependency(dependency)
|
401
374
|
optional_subtype: Union[SchemaDependencySubtypes, Unset] = (
|
402
375
|
_convert_entity_subtype(subtype) if subtype is not None else UNSET
|
403
376
|
)
|
@@ -411,7 +384,7 @@ def _mock_dependency(
|
|
411
384
|
)
|
412
385
|
sub_items = [
|
413
386
|
_mock_subdependency(subdependency, dependency, parent_path=parent_path)
|
414
|
-
for subdependency in
|
387
|
+
for subdependency in _field_definitions_from_dependency(dependency)
|
415
388
|
]
|
416
389
|
return [*[entity_item], *sub_items]
|
417
390
|
elif isinstance(dependency, SchemaDependency):
|
@@ -425,7 +398,7 @@ def _mock_dependency(
|
|
425
398
|
)
|
426
399
|
sub_items = [
|
427
400
|
_mock_subdependency(subdependency, dependency, parent_path=parent_path)
|
428
|
-
for subdependency in
|
401
|
+
for subdependency in _field_definitions_from_dependency(dependency)
|
429
402
|
]
|
430
403
|
return [*[config_item], *sub_items]
|
431
404
|
elif isinstance(dependency, WorkflowTaskSchemaDependency):
|
@@ -439,11 +412,11 @@ def _mock_dependency(
|
|
439
412
|
)
|
440
413
|
sub_items = [
|
441
414
|
_mock_subdependency(subdependency, dependency, parent_path=parent_path)
|
442
|
-
for subdependency in
|
415
|
+
for subdependency in _field_definitions_from_dependency(dependency)
|
443
416
|
]
|
444
|
-
workflow_task_output =
|
417
|
+
workflow_task_output = _workflow_task_schema_output_from_dependency(dependency)
|
445
418
|
if workflow_task_output:
|
446
|
-
output_fields =
|
419
|
+
output_fields = _field_definitions_from_dependency(workflow_task_output)
|
447
420
|
output_items = [
|
448
421
|
_mock_workflow_output_subdependency(subdependency, dependency, parent_path=parent_path)
|
449
422
|
for subdependency in output_fields
|
@@ -479,39 +452,40 @@ def _convert_entity_subtype(manifest_subtype: SchemaDependencySubtypesBeta) -> S
|
|
479
452
|
|
480
453
|
|
481
454
|
def _mock_scalar_dependency(
|
482
|
-
dependency: ManifestScalarConfig, parent_path: List[str] =
|
455
|
+
dependency: ManifestScalarConfig, parent_path: Optional[List[str]] = None
|
483
456
|
) -> AppConfigItem:
|
457
|
+
parent_path = parent_path if parent_path else []
|
484
458
|
if isinstance(dependency, ManifestBooleanScalarConfig):
|
485
|
-
bool_value =
|
459
|
+
bool_value = cast(bool, _mock_scalar_value(dependency))
|
486
460
|
bool_config = mock_bool_app_config_item([dependency.name], bool_value)
|
487
461
|
return _append_config_item_path(bool_config, parent_path)
|
488
462
|
elif isinstance(dependency, ManifestDateScalarConfig):
|
489
|
-
date_value =
|
463
|
+
date_value = cast(date, _mock_scalar_value(dependency))
|
490
464
|
date_config = mock_date_app_config_item([dependency.name], date_value)
|
491
465
|
return _append_config_item_path(date_config, parent_path)
|
492
466
|
elif isinstance(dependency, ManifestDatetimeScalarConfig):
|
493
|
-
datetime_value =
|
467
|
+
datetime_value = cast(datetime, _mock_scalar_value(dependency))
|
494
468
|
datetime_config = mock_datetime_app_config_item([dependency.name], datetime_value)
|
495
469
|
return _append_config_item_path(datetime_config, parent_path)
|
496
470
|
elif isinstance(dependency, ManifestFloatScalarConfig):
|
497
|
-
float_value =
|
471
|
+
float_value = cast(float, _mock_scalar_value(dependency))
|
498
472
|
float_config = mock_float_app_config_item([dependency.name], float_value)
|
499
473
|
return _append_config_item_path(float_config, parent_path)
|
500
474
|
elif isinstance(dependency, ManifestIntegerScalarConfig):
|
501
|
-
int_value =
|
475
|
+
int_value = cast(int, _mock_scalar_value(dependency))
|
502
476
|
int_config = mock_int_app_config_item([dependency.name], int_value)
|
503
477
|
return _append_config_item_path(int_config, parent_path)
|
504
478
|
elif isinstance(dependency, ManifestJsonScalarConfig):
|
505
|
-
json_value =
|
479
|
+
json_value = cast(JsonType, _mock_scalar_value(dependency))
|
506
480
|
json_config = mock_json_app_config_item([dependency.name], json_value)
|
507
481
|
return _append_config_item_path(json_config, parent_path)
|
508
482
|
elif isinstance(dependency, ManifestSecureTextScalarConfig):
|
509
|
-
secure_text_value =
|
483
|
+
secure_text_value = cast(str, _mock_scalar_value(dependency))
|
510
484
|
secure_text_config = mock_secure_text_app_config_item([dependency.name], secure_text_value)
|
511
485
|
return _append_config_item_path(secure_text_config, parent_path)
|
512
486
|
else:
|
513
487
|
assert not isinstance(dependency, UnknownType), f"Unable to mock unknown type {dependency}"
|
514
|
-
text_value =
|
488
|
+
text_value = cast(str, _mock_scalar_value(dependency))
|
515
489
|
text_config = mock_text_app_config_item([dependency.name], text_value)
|
516
490
|
return _append_config_item_path(text_config, parent_path)
|
517
491
|
|
@@ -524,12 +498,13 @@ def _append_config_item_path(config_item: AppConfigItem, parent_path: List[str])
|
|
524
498
|
|
525
499
|
|
526
500
|
def _mock_array_dependency(
|
527
|
-
dependency: ManifestArrayConfig, parent_path: List[str] =
|
501
|
+
dependency: ManifestArrayConfig, parent_path: Optional[List[str]] = None, rows: int = 1
|
528
502
|
) -> List[AppConfigItem]:
|
529
503
|
config_rows = []
|
504
|
+
parent_path = parent_path if parent_path else []
|
530
505
|
for i in range(rows):
|
531
506
|
row = _mock_array_row(dependency, parent_path=parent_path)
|
532
|
-
elements =
|
507
|
+
elements = _element_definition_from_dependency(dependency)
|
533
508
|
element_configs = [_mock_dependency(element, row.path) for element in elements]
|
534
509
|
flattened_configs = [element for sublist in element_configs for element in sublist]
|
535
510
|
config_rows.append(row)
|
@@ -537,8 +512,9 @@ def _mock_array_dependency(
|
|
537
512
|
return config_rows
|
538
513
|
|
539
514
|
|
540
|
-
def _mock_array_row(dependency: ManifestArrayConfig, parent_path: List[str] =
|
515
|
+
def _mock_array_row(dependency: ManifestArrayConfig, parent_path: Optional[List[str]] = None):
|
541
516
|
row_name = _random_string("Row ")
|
517
|
+
parent_path = parent_path if parent_path else []
|
542
518
|
return ArrayElementAppConfigItem(
|
543
519
|
id=_random_string("aci_"),
|
544
520
|
path=parent_path + [dependency.name, row_name],
|
@@ -547,25 +523,16 @@ def _mock_array_row(dependency: ManifestArrayConfig, parent_path: List[str] = li
|
|
547
523
|
)
|
548
524
|
|
549
525
|
|
550
|
-
def
|
551
|
-
dependency: ManifestScalarConfig, scalar_definition_type: Type[ScalarDefinition[ScalarType]]
|
552
|
-
) -> Optional[ScalarType]:
|
553
|
-
assert not isinstance(dependency, UnknownType), f"Unable to mock unknown type {dependency}"
|
554
|
-
# These types should be equivalent and this appeases MyPy
|
555
|
-
mocked_value_type = ScalarConfigTypes(dependency.type)
|
556
|
-
mocked_value_str = (
|
557
|
-
_mock_scalar_with_enum(dependency)
|
558
|
-
if _is_scalar_with_enum(dependency)
|
559
|
-
else _mock_scalar_value(mocked_value_type)
|
560
|
-
)
|
561
|
-
return scalar_definition_type.from_str(mocked_value_str)
|
562
|
-
|
563
|
-
|
564
|
-
def _mock_scalar_with_enum(dependency: ManifestScalarConfig) -> str:
|
526
|
+
def _mock_scalar_with_enum(dependency: ManifestScalarConfig) -> Union[float, int, str]:
|
565
527
|
assert isinstance(
|
566
528
|
dependency, (ManifestFloatScalarConfig, ManifestIntegerScalarConfig, ManifestTextScalarConfig)
|
567
529
|
)
|
568
|
-
|
530
|
+
value = random.choice(dependency.enum)
|
531
|
+
if isinstance(dependency, ManifestFloatScalarConfig):
|
532
|
+
return cast(float, value)
|
533
|
+
elif isinstance(dependency, ManifestIntegerScalarConfig):
|
534
|
+
return cast(int, value)
|
535
|
+
return str(value)
|
569
536
|
|
570
537
|
|
571
538
|
def _is_scalar_with_enum(dependency: ManifestScalarConfig) -> bool:
|
@@ -573,15 +540,16 @@ def _is_scalar_with_enum(dependency: ManifestScalarConfig) -> bool:
|
|
573
540
|
dependency, (ManifestFloatScalarConfig, ManifestIntegerScalarConfig, ManifestTextScalarConfig)
|
574
541
|
):
|
575
542
|
# MyPy doesn't find this to be truthy without a specific len check
|
576
|
-
return len(
|
543
|
+
return len(_enum_from_dependency(dependency)) > 0
|
577
544
|
return False
|
578
545
|
|
579
546
|
|
580
547
|
def _mock_subdependency(
|
581
548
|
subdependency: Union[BaseManifestConfig, FieldDefinitionsManifest],
|
582
549
|
parent_config,
|
583
|
-
parent_path: List[str] =
|
550
|
+
parent_path: Optional[List[str]] = None,
|
584
551
|
) -> AppConfigItem:
|
552
|
+
parent_path = parent_path if parent_path else []
|
585
553
|
if isinstance(parent_config, DropdownDependency):
|
586
554
|
linked_resource_id = _random_string("opt_")
|
587
555
|
return GenericApiIdentifiedAppConfigItem(
|
@@ -608,8 +576,9 @@ def _mock_subdependency(
|
|
608
576
|
def _mock_workflow_output_subdependency(
|
609
577
|
subdependency: Union[BaseManifestConfig, FieldDefinitionsManifest],
|
610
578
|
parent_config,
|
611
|
-
parent_path: List[str] =
|
579
|
+
parent_path: Optional[List[str]] = None,
|
612
580
|
) -> AppConfigItem:
|
581
|
+
parent_path = parent_path if parent_path else []
|
613
582
|
linked_resource_id = _random_string("tsf_")
|
614
583
|
app_config = FieldAppConfigItem(
|
615
584
|
id=_random_string("aci_"),
|
@@ -625,18 +594,28 @@ def _mock_linked_resource(id: str, name: Optional[str] = None) -> LinkedAppConfi
|
|
625
594
|
return LinkedAppConfigResourceSummary(id=id, name=name if name else _random_string("Resource Name"))
|
626
595
|
|
627
596
|
|
628
|
-
def _mock_scalar_value(
|
597
|
+
def _mock_scalar_value(
|
598
|
+
dependency: ManifestScalarConfig,
|
599
|
+
) -> Union[bool, date, datetime, int, float, str, Dict[str, Union[str, float]]]:
|
629
600
|
"""Mock a scalar config value from its manifest definition."""
|
630
|
-
if
|
631
|
-
|
601
|
+
if isinstance(dependency, UnknownType):
|
602
|
+
raise UnsupportedConfigItemError(
|
603
|
+
f"Unable to mock scalar value for unsupported dependency type {dependency}"
|
604
|
+
)
|
605
|
+
# These types should be equivalent and this appeases MyPy
|
606
|
+
scalar_type = ScalarConfigTypes(dependency.type)
|
607
|
+
if _is_scalar_with_enum(dependency):
|
608
|
+
return _mock_scalar_with_enum(dependency)
|
609
|
+
elif scalar_type == scalar_type.BOOLEAN:
|
610
|
+
return True
|
632
611
|
elif scalar_type == scalar_type.DATE:
|
633
|
-
return date.today()
|
612
|
+
return date.today()
|
634
613
|
elif scalar_type == scalar_type.DATETIME:
|
635
|
-
return datetime.now()
|
614
|
+
return datetime.now()
|
636
615
|
elif scalar_type == scalar_type.FLOAT:
|
637
|
-
return
|
616
|
+
return random.random()
|
638
617
|
elif scalar_type == scalar_type.INTEGER:
|
639
|
-
return
|
618
|
+
return random.randint(-1000, 1000)
|
640
619
|
elif scalar_type == scalar_type.JSON:
|
641
620
|
return json.dumps(
|
642
621
|
{_random_string(): [_random_string(), _random_string()], _random_string(): random.random()}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Tuple instead of list so it's hashable and preserves order
|
2
|
+
from typing import Tuple, Union
|
3
|
+
|
4
|
+
from benchling_sdk.models import (
|
5
|
+
ArrayElementAppConfigItem,
|
6
|
+
BooleanAppConfigItem,
|
7
|
+
DateAppConfigItem,
|
8
|
+
DatetimeAppConfigItem,
|
9
|
+
EntitySchemaAppConfigItem,
|
10
|
+
FieldAppConfigItem,
|
11
|
+
FloatAppConfigItem,
|
12
|
+
GenericApiIdentifiedAppConfigItem,
|
13
|
+
IntegerAppConfigItem,
|
14
|
+
JsonAppConfigItem,
|
15
|
+
SecureTextAppConfigItem,
|
16
|
+
TextAppConfigItem,
|
17
|
+
)
|
18
|
+
|
19
|
+
# Tuple for an ordered collection that's hashable
|
20
|
+
ConfigItemPath = Tuple[str, ...]
|
21
|
+
|
22
|
+
# Everything from AppConfigItem except UnknownType
|
23
|
+
ConfigurationReference = Union[
|
24
|
+
ArrayElementAppConfigItem,
|
25
|
+
DateAppConfigItem,
|
26
|
+
DatetimeAppConfigItem,
|
27
|
+
JsonAppConfigItem,
|
28
|
+
EntitySchemaAppConfigItem,
|
29
|
+
FieldAppConfigItem,
|
30
|
+
BooleanAppConfigItem,
|
31
|
+
IntegerAppConfigItem,
|
32
|
+
FloatAppConfigItem,
|
33
|
+
GenericApiIdentifiedAppConfigItem,
|
34
|
+
SecureTextAppConfigItem,
|
35
|
+
TextAppConfigItem,
|
36
|
+
]
|