benchling-sdk 1.10.0a1__tar.gz → 1.10.0a3__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.
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/PKG-INFO +1 -1
- benchling_sdk-1.10.0a3/benchling_sdk/apps/canvas/errors.py +14 -0
- benchling_sdk-1.10.0a1/benchling_sdk/apps/helpers/canvas_helpers.py → benchling_sdk-1.10.0a3/benchling_sdk/apps/canvas/framework.py +9 -126
- benchling_sdk-1.10.0a3/benchling_sdk/apps/canvas/types.py +125 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/apps/config/decryption_provider.py +1 -1
- {benchling_sdk-1.10.0a1/benchling_sdk/apps → benchling_sdk-1.10.0a3/benchling_sdk/apps/config}/framework.py +2 -102
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/apps/config/mock_config.py +1 -1
- benchling_sdk-1.10.0a3/benchling_sdk/apps/framework.py +92 -0
- benchling_sdk-1.10.0a3/benchling_sdk/apps/status/errors.py +82 -0
- benchling_sdk-1.10.0a1/benchling_sdk/apps/helpers/session_helpers.py → benchling_sdk-1.10.0a3/benchling_sdk/apps/status/framework.py +35 -145
- benchling_sdk-1.10.0a3/benchling_sdk/apps/status/types.py +45 -0
- benchling_sdk-1.10.0a3/benchling_sdk/services/v2/beta/__init__.py +0 -0
- benchling_sdk-1.10.0a3/benchling_sdk/services/v2/stable/__init__.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/pyproject.toml +1 -1
- benchling_sdk-1.10.0a1/benchling_sdk/apps/errors.py +0 -16
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/LICENSE +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/README.md +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/__init__.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/apps/__init__.py +0 -0
- {benchling_sdk-1.10.0a1/benchling_sdk/apps/helpers → benchling_sdk-1.10.0a3/benchling_sdk/apps/canvas}/__init__.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/apps/config/__init__.py +0 -0
- {benchling_sdk-1.10.0a1/benchling_sdk/apps/helpers → benchling_sdk-1.10.0a3/benchling_sdk/apps/config}/cryptography_helpers.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/apps/config/errors.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/apps/config/scalars.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/apps/config/types.py +0 -0
- {benchling_sdk-1.10.0a1/benchling_sdk → benchling_sdk-1.10.0a3/benchling_sdk/apps}/helpers/__init__.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/apps/helpers/config_helpers.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/apps/helpers/manifest_helpers.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/apps/helpers/webhook_helpers.py +0 -0
- {benchling_sdk-1.10.0a1/benchling_sdk/models/webhooks → benchling_sdk-1.10.0a3/benchling_sdk/apps/status}/__init__.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/auth/__init__.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/auth/api_key_auth.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/auth/bearer_token_auth.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/auth/client_credentials_oauth2.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/benchling.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/docs/__init__.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/docs/__main__.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/errors.py +0 -0
- {benchling_sdk-1.10.0a1/benchling_sdk/services/v2 → benchling_sdk-1.10.0a3/benchling_sdk/helpers}/__init__.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/helpers/client_helpers.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/helpers/constants.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/helpers/decorators.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/helpers/file_helpers.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/helpers/logging_helpers.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/helpers/package_helpers.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/helpers/pagination_helpers.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/helpers/response_helpers.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/helpers/retry_helpers.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/helpers/serialization_helpers.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/helpers/transaction_manager.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/models/__init__.py +0 -0
- {benchling_sdk-1.10.0a1/benchling_sdk/services/v2/alpha → benchling_sdk-1.10.0a3/benchling_sdk/models/webhooks}/__init__.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/models/webhooks/v0/__init__.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/py.typed +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/__init__.py +0 -0
- {benchling_sdk-1.10.0a1/benchling_sdk/services/v2/beta → benchling_sdk-1.10.0a3/benchling_sdk/services/v2}/__init__.py +0 -0
- {benchling_sdk-1.10.0a1/benchling_sdk/services/v2/stable → benchling_sdk-1.10.0a3/benchling_sdk/services/v2/alpha}/__init__.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/alpha/v2_alpha_app_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/alpha/v2_alpha_dna_sequence_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/base_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_aa_sequence_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_app_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_collaboration_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_custom_entity_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_dataset_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_dna_oligo_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_dna_sequence_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_entity_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_entry_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_folder_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_project_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_rna_oligo_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/beta/v2_beta_worklist_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/aa_sequence_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/api_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/app_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/assay_result_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/assay_run_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/blob_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/box_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/container_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/custom_entity_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/custom_notation_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/dna_alignments_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/dna_oligo_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/dna_sequence_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/dropdown_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/entry_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/event_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/export_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/feature_library_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/folder_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/inventory_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/lab_automation_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/label_template_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/location_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/mixture_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/molecule_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/nucleotide_alignments_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/oligo_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/organization_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/plate_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/printer_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/project_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/registry_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/request_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/rna_oligo_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/rna_sequence_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/schema_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/task_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/team_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/user_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/warehouse_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/workflow_output_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/workflow_task_group_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/stable/workflow_task_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/v2_alpha_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/v2_beta_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2/v2_stable_service.py +0 -0
- {benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/services/v2_service.py +0 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
class DuplicateBlockIdError(Exception):
|
2
|
+
"""Error indicating that duplicate ids were present on blocks within a Canvas."""
|
3
|
+
|
4
|
+
pass
|
5
|
+
|
6
|
+
|
7
|
+
class NoMatchingBlocksError(Exception):
|
8
|
+
"""
|
9
|
+
Error indicating that blocks were expected, but none matched.
|
10
|
+
|
11
|
+
Used to prevent requiring developers to handle Optional[_UiBlock] for type safety.
|
12
|
+
"""
|
13
|
+
|
14
|
+
pass
|
@@ -4,137 +4,36 @@ from typing import cast, Dict, Generic, List, Optional, Protocol, Set, Type, Typ
|
|
4
4
|
|
5
5
|
from benchling_api_client.v2.extensions import UnknownType
|
6
6
|
|
7
|
+
from benchling_sdk.apps.canvas.errors import DuplicateBlockIdError, NoMatchingBlocksError
|
8
|
+
from benchling_sdk.apps.canvas.types import (
|
9
|
+
_UI_BLOCK_MAPPINGS_CREATE,
|
10
|
+
_UI_BLOCK_MAPPINGS_UPDATE,
|
11
|
+
_UiBlock,
|
12
|
+
_UiBlockCreate,
|
13
|
+
_UiBlockType,
|
14
|
+
_UiBlockUpdate,
|
15
|
+
)
|
7
16
|
from benchling_sdk.helpers.logging_helpers import log_stability_warning, StabilityLevel
|
8
17
|
from benchling_sdk.models import (
|
9
18
|
AppCanvas,
|
10
19
|
AppCanvasApp,
|
11
20
|
AppCanvasCreate,
|
12
21
|
AppCanvasUpdate,
|
13
|
-
ButtonUiBlock,
|
14
|
-
ButtonUiBlockCreate,
|
15
|
-
ButtonUiBlockUpdate,
|
16
|
-
ChipUiBlock,
|
17
|
-
ChipUiBlockCreate,
|
18
|
-
ChipUiBlockUpdate,
|
19
22
|
DropdownMultiValueUiBlock,
|
20
|
-
DropdownMultiValueUiBlockCreate,
|
21
|
-
DropdownMultiValueUiBlockUpdate,
|
22
23
|
DropdownUiBlock,
|
23
|
-
DropdownUiBlockCreate,
|
24
|
-
DropdownUiBlockUpdate,
|
25
|
-
MarkdownUiBlock,
|
26
|
-
MarkdownUiBlockCreate,
|
27
|
-
MarkdownUiBlockUpdate,
|
28
24
|
SearchInputMultiValueUiBlock,
|
29
|
-
SearchInputMultiValueUiBlockCreate,
|
30
|
-
SearchInputMultiValueUiBlockUpdate,
|
31
25
|
SearchInputUiBlock,
|
32
|
-
SearchInputUiBlockCreate,
|
33
|
-
SearchInputUiBlockUpdate,
|
34
26
|
SectionUiBlock,
|
35
|
-
SectionUiBlockCreate,
|
36
|
-
SectionUiBlockUpdate,
|
37
27
|
SelectorInputMultiValueUiBlock,
|
38
|
-
SelectorInputMultiValueUiBlockCreate,
|
39
|
-
SelectorInputMultiValueUiBlockUpdate,
|
40
28
|
SelectorInputUiBlock,
|
41
|
-
SelectorInputUiBlockCreate,
|
42
|
-
SelectorInputUiBlockUpdate,
|
43
29
|
TableUiBlock,
|
44
|
-
TableUiBlockCreate,
|
45
|
-
TableUiBlockUpdate,
|
46
30
|
TextInputUiBlock,
|
47
|
-
TextInputUiBlockCreate,
|
48
|
-
TextInputUiBlockUpdate,
|
49
31
|
)
|
50
32
|
|
51
33
|
log_stability_warning(StabilityLevel.BETA)
|
52
34
|
|
53
35
|
S = TypeVar("S", bound="_FilteredCanvasBuilderBlockStream")
|
54
36
|
|
55
|
-
_UiBlock = Union[
|
56
|
-
ButtonUiBlock,
|
57
|
-
ChipUiBlock,
|
58
|
-
DropdownMultiValueUiBlock,
|
59
|
-
DropdownUiBlock,
|
60
|
-
MarkdownUiBlock,
|
61
|
-
SearchInputMultiValueUiBlock,
|
62
|
-
SearchInputUiBlock,
|
63
|
-
SectionUiBlock,
|
64
|
-
SelectorInputMultiValueUiBlock,
|
65
|
-
SelectorInputUiBlock,
|
66
|
-
TableUiBlock,
|
67
|
-
TextInputUiBlock,
|
68
|
-
UnknownType,
|
69
|
-
]
|
70
|
-
|
71
|
-
_UiBlockType = TypeVar(
|
72
|
-
"_UiBlockType",
|
73
|
-
bound=_UiBlock,
|
74
|
-
)
|
75
|
-
|
76
|
-
_UiBlockCreate = Union[
|
77
|
-
ButtonUiBlockCreate,
|
78
|
-
ChipUiBlockCreate,
|
79
|
-
DropdownMultiValueUiBlockCreate,
|
80
|
-
DropdownUiBlockCreate,
|
81
|
-
MarkdownUiBlockCreate,
|
82
|
-
SearchInputMultiValueUiBlockCreate,
|
83
|
-
SearchInputUiBlockCreate,
|
84
|
-
SectionUiBlockCreate,
|
85
|
-
SelectorInputMultiValueUiBlockCreate,
|
86
|
-
SelectorInputUiBlockCreate,
|
87
|
-
TableUiBlockCreate,
|
88
|
-
TextInputUiBlockCreate,
|
89
|
-
UnknownType,
|
90
|
-
]
|
91
|
-
|
92
|
-
_UiBlockUpdate = Union[
|
93
|
-
ButtonUiBlockUpdate,
|
94
|
-
ChipUiBlockUpdate,
|
95
|
-
DropdownMultiValueUiBlockUpdate,
|
96
|
-
DropdownUiBlockUpdate,
|
97
|
-
MarkdownUiBlockUpdate,
|
98
|
-
SearchInputMultiValueUiBlockUpdate,
|
99
|
-
SearchInputUiBlockUpdate,
|
100
|
-
SectionUiBlockUpdate,
|
101
|
-
SelectorInputMultiValueUiBlockUpdate,
|
102
|
-
SelectorInputUiBlockUpdate,
|
103
|
-
TableUiBlockUpdate,
|
104
|
-
TextInputUiBlockUpdate,
|
105
|
-
UnknownType,
|
106
|
-
]
|
107
|
-
|
108
|
-
_UI_BLOCK_MAPPINGS_CREATE = {
|
109
|
-
ButtonUiBlock: ButtonUiBlockCreate,
|
110
|
-
ChipUiBlock: ChipUiBlockCreate,
|
111
|
-
DropdownMultiValueUiBlock: DropdownMultiValueUiBlockCreate,
|
112
|
-
DropdownUiBlock: DropdownUiBlockCreate,
|
113
|
-
MarkdownUiBlock: MarkdownUiBlockCreate,
|
114
|
-
SearchInputMultiValueUiBlock: SearchInputMultiValueUiBlockCreate,
|
115
|
-
SearchInputUiBlock: SearchInputUiBlockCreate,
|
116
|
-
SectionUiBlock: SectionUiBlockCreate,
|
117
|
-
SelectorInputMultiValueUiBlock: SelectorInputMultiValueUiBlockCreate,
|
118
|
-
SelectorInputUiBlock: SelectorInputUiBlockCreate,
|
119
|
-
TableUiBlock: TableUiBlockCreate,
|
120
|
-
TextInputUiBlock: TextInputUiBlockCreate,
|
121
|
-
}
|
122
|
-
|
123
|
-
_UI_BLOCK_MAPPINGS_UPDATE = {
|
124
|
-
ButtonUiBlock: ButtonUiBlockUpdate,
|
125
|
-
ChipUiBlock: ChipUiBlockUpdate,
|
126
|
-
DropdownMultiValueUiBlock: DropdownMultiValueUiBlockUpdate,
|
127
|
-
DropdownUiBlock: DropdownUiBlockUpdate,
|
128
|
-
MarkdownUiBlock: MarkdownUiBlockUpdate,
|
129
|
-
SearchInputMultiValueUiBlock: SearchInputMultiValueUiBlockUpdate,
|
130
|
-
SearchInputUiBlock: SearchInputUiBlockUpdate,
|
131
|
-
SectionUiBlock: SectionUiBlockUpdate,
|
132
|
-
SelectorInputMultiValueUiBlock: SelectorInputMultiValueUiBlockUpdate,
|
133
|
-
SelectorInputUiBlock: SelectorInputUiBlockUpdate,
|
134
|
-
TableUiBlock: TableUiBlockUpdate,
|
135
|
-
TextInputUiBlock: TextInputUiBlockUpdate,
|
136
|
-
}
|
137
|
-
|
138
37
|
|
139
38
|
def _ui_block_to_create(block: _UiBlock) -> _UiBlockCreate:
|
140
39
|
# Rely on the fact that the read/write shapes are compatible, for now
|
@@ -166,22 +65,6 @@ def _ui_block_to_update(block: _UiBlock) -> _UiBlockUpdate:
|
|
166
65
|
return block # type: ignore
|
167
66
|
|
168
67
|
|
169
|
-
class DuplicateBlockIdError(Exception):
|
170
|
-
"""Error indicating that duplicate ids were present on blocks within a Canvas."""
|
171
|
-
|
172
|
-
pass
|
173
|
-
|
174
|
-
|
175
|
-
class NoMatchingBlocksError(Exception):
|
176
|
-
"""
|
177
|
-
Error indicating that blocks were expected, but none matched.
|
178
|
-
|
179
|
-
Used to prevent requiring developers to handle Optional[_UiBlock] for type safety.
|
180
|
-
"""
|
181
|
-
|
182
|
-
pass
|
183
|
-
|
184
|
-
|
185
68
|
class _CanvasBuilderUiBlock(Generic[_UiBlockType]):
|
186
69
|
"""Internal UI block wrapper for CanvasBuilder."""
|
187
70
|
|
@@ -0,0 +1,125 @@
|
|
1
|
+
from typing import TypeVar, Union
|
2
|
+
|
3
|
+
from benchling_api_client.v2.extensions import UnknownType
|
4
|
+
|
5
|
+
from benchling_sdk.models import (
|
6
|
+
ButtonUiBlock,
|
7
|
+
ButtonUiBlockCreate,
|
8
|
+
ButtonUiBlockUpdate,
|
9
|
+
ChipUiBlock,
|
10
|
+
ChipUiBlockCreate,
|
11
|
+
ChipUiBlockUpdate,
|
12
|
+
DropdownMultiValueUiBlock,
|
13
|
+
DropdownMultiValueUiBlockCreate,
|
14
|
+
DropdownMultiValueUiBlockUpdate,
|
15
|
+
DropdownUiBlock,
|
16
|
+
DropdownUiBlockCreate,
|
17
|
+
DropdownUiBlockUpdate,
|
18
|
+
MarkdownUiBlock,
|
19
|
+
MarkdownUiBlockCreate,
|
20
|
+
MarkdownUiBlockUpdate,
|
21
|
+
SearchInputMultiValueUiBlock,
|
22
|
+
SearchInputMultiValueUiBlockCreate,
|
23
|
+
SearchInputMultiValueUiBlockUpdate,
|
24
|
+
SearchInputUiBlock,
|
25
|
+
SearchInputUiBlockCreate,
|
26
|
+
SearchInputUiBlockUpdate,
|
27
|
+
SectionUiBlock,
|
28
|
+
SectionUiBlockCreate,
|
29
|
+
SectionUiBlockUpdate,
|
30
|
+
SelectorInputMultiValueUiBlock,
|
31
|
+
SelectorInputMultiValueUiBlockCreate,
|
32
|
+
SelectorInputMultiValueUiBlockUpdate,
|
33
|
+
SelectorInputUiBlock,
|
34
|
+
SelectorInputUiBlockCreate,
|
35
|
+
SelectorInputUiBlockUpdate,
|
36
|
+
TableUiBlock,
|
37
|
+
TableUiBlockCreate,
|
38
|
+
TableUiBlockUpdate,
|
39
|
+
TextInputUiBlock,
|
40
|
+
TextInputUiBlockCreate,
|
41
|
+
TextInputUiBlockUpdate,
|
42
|
+
)
|
43
|
+
|
44
|
+
_UiBlock = Union[
|
45
|
+
ButtonUiBlock,
|
46
|
+
ChipUiBlock,
|
47
|
+
DropdownMultiValueUiBlock,
|
48
|
+
DropdownUiBlock,
|
49
|
+
MarkdownUiBlock,
|
50
|
+
SearchInputMultiValueUiBlock,
|
51
|
+
SearchInputUiBlock,
|
52
|
+
SectionUiBlock,
|
53
|
+
SelectorInputMultiValueUiBlock,
|
54
|
+
SelectorInputUiBlock,
|
55
|
+
TableUiBlock,
|
56
|
+
TextInputUiBlock,
|
57
|
+
UnknownType,
|
58
|
+
]
|
59
|
+
|
60
|
+
_UiBlockType = TypeVar(
|
61
|
+
"_UiBlockType",
|
62
|
+
bound=_UiBlock,
|
63
|
+
)
|
64
|
+
|
65
|
+
_UiBlockCreate = Union[
|
66
|
+
ButtonUiBlockCreate,
|
67
|
+
ChipUiBlockCreate,
|
68
|
+
DropdownMultiValueUiBlockCreate,
|
69
|
+
DropdownUiBlockCreate,
|
70
|
+
MarkdownUiBlockCreate,
|
71
|
+
SearchInputMultiValueUiBlockCreate,
|
72
|
+
SearchInputUiBlockCreate,
|
73
|
+
SectionUiBlockCreate,
|
74
|
+
SelectorInputMultiValueUiBlockCreate,
|
75
|
+
SelectorInputUiBlockCreate,
|
76
|
+
TableUiBlockCreate,
|
77
|
+
TextInputUiBlockCreate,
|
78
|
+
UnknownType,
|
79
|
+
]
|
80
|
+
|
81
|
+
_UiBlockUpdate = Union[
|
82
|
+
ButtonUiBlockUpdate,
|
83
|
+
ChipUiBlockUpdate,
|
84
|
+
DropdownMultiValueUiBlockUpdate,
|
85
|
+
DropdownUiBlockUpdate,
|
86
|
+
MarkdownUiBlockUpdate,
|
87
|
+
SearchInputMultiValueUiBlockUpdate,
|
88
|
+
SearchInputUiBlockUpdate,
|
89
|
+
SectionUiBlockUpdate,
|
90
|
+
SelectorInputMultiValueUiBlockUpdate,
|
91
|
+
SelectorInputUiBlockUpdate,
|
92
|
+
TableUiBlockUpdate,
|
93
|
+
TextInputUiBlockUpdate,
|
94
|
+
UnknownType,
|
95
|
+
]
|
96
|
+
|
97
|
+
_UI_BLOCK_MAPPINGS_CREATE = {
|
98
|
+
ButtonUiBlock: ButtonUiBlockCreate,
|
99
|
+
ChipUiBlock: ChipUiBlockCreate,
|
100
|
+
DropdownMultiValueUiBlock: DropdownMultiValueUiBlockCreate,
|
101
|
+
DropdownUiBlock: DropdownUiBlockCreate,
|
102
|
+
MarkdownUiBlock: MarkdownUiBlockCreate,
|
103
|
+
SearchInputMultiValueUiBlock: SearchInputMultiValueUiBlockCreate,
|
104
|
+
SearchInputUiBlock: SearchInputUiBlockCreate,
|
105
|
+
SectionUiBlock: SectionUiBlockCreate,
|
106
|
+
SelectorInputMultiValueUiBlock: SelectorInputMultiValueUiBlockCreate,
|
107
|
+
SelectorInputUiBlock: SelectorInputUiBlockCreate,
|
108
|
+
TableUiBlock: TableUiBlockCreate,
|
109
|
+
TextInputUiBlock: TextInputUiBlockCreate,
|
110
|
+
}
|
111
|
+
|
112
|
+
_UI_BLOCK_MAPPINGS_UPDATE = {
|
113
|
+
ButtonUiBlock: ButtonUiBlockUpdate,
|
114
|
+
ChipUiBlock: ChipUiBlockUpdate,
|
115
|
+
DropdownMultiValueUiBlock: DropdownMultiValueUiBlockUpdate,
|
116
|
+
DropdownUiBlock: DropdownUiBlockUpdate,
|
117
|
+
MarkdownUiBlock: MarkdownUiBlockUpdate,
|
118
|
+
SearchInputMultiValueUiBlock: SearchInputMultiValueUiBlockUpdate,
|
119
|
+
SearchInputUiBlock: SearchInputUiBlockUpdate,
|
120
|
+
SectionUiBlock: SectionUiBlockUpdate,
|
121
|
+
SelectorInputMultiValueUiBlock: SelectorInputMultiValueUiBlockUpdate,
|
122
|
+
SelectorInputUiBlock: SelectorInputUiBlockUpdate,
|
123
|
+
TableUiBlock: TableUiBlockUpdate,
|
124
|
+
TextInputUiBlock: TextInputUiBlockUpdate,
|
125
|
+
}
|
{benchling_sdk-1.10.0a1 → benchling_sdk-1.10.0a3}/benchling_sdk/apps/config/decryption_provider.py
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
from abc import ABC, abstractmethod
|
2
2
|
|
3
|
-
from benchling_sdk.apps.
|
3
|
+
from benchling_sdk.apps.config.cryptography_helpers import _create_key_type
|
4
4
|
from benchling_sdk.helpers.package_helpers import _required_packages_context, ExtrasPackage
|
5
5
|
|
6
6
|
|
@@ -1,23 +1,14 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
1
|
import collections
|
4
|
-
from typing import Dict, List, Optional, OrderedDict, Protocol, Tuple
|
2
|
+
from typing import Dict, List, Optional, OrderedDict, Protocol, Tuple
|
5
3
|
|
6
4
|
from benchling_api_client.v2.extensions import UnknownType
|
7
5
|
from ordered_set import OrderedSet
|
8
6
|
|
9
|
-
from benchling_sdk.apps import helpers
|
10
7
|
from benchling_sdk.apps.config.errors import UnsupportedConfigItemError
|
11
8
|
from benchling_sdk.apps.config.types import ConfigItemPath, ConfigurationReference
|
12
9
|
from benchling_sdk.benchling import Benchling
|
13
|
-
from benchling_sdk.helpers.logging_helpers import log_stability_warning, StabilityLevel
|
14
10
|
from benchling_sdk.models import AppConfigItem, ListAppConfigurationItemsSort
|
15
11
|
|
16
|
-
log_stability_warning(StabilityLevel.ALPHA)
|
17
|
-
|
18
|
-
|
19
|
-
AppType = TypeVar("AppType", bound="App")
|
20
|
-
|
21
12
|
|
22
13
|
class ConfigProvider(Protocol):
|
23
14
|
"""
|
@@ -31,96 +22,6 @@ class ConfigProvider(Protocol):
|
|
31
22
|
pass
|
32
23
|
|
33
24
|
|
34
|
-
class ConfigItemStoreProvider(Protocol):
|
35
|
-
"""Return a config item store."""
|
36
|
-
|
37
|
-
def __call__(self, app_id: str) -> ConfigItemStore:
|
38
|
-
"""Return a config item store."""
|
39
|
-
pass
|
40
|
-
|
41
|
-
|
42
|
-
class App:
|
43
|
-
"""
|
44
|
-
App.
|
45
|
-
|
46
|
-
See https://docs.benchling.com/docs/getting-started-benchling-apps
|
47
|
-
|
48
|
-
Accepts providers as arguments to lazily initialize since some required attributes may not be
|
49
|
-
known until runtime. Also allows for easier mocking in tests.
|
50
|
-
"""
|
51
|
-
|
52
|
-
_app_id: str
|
53
|
-
_benchling: Benchling
|
54
|
-
_config_store: ConfigItemStore
|
55
|
-
|
56
|
-
def __init__(
|
57
|
-
self, app_id: str, benchling: Benchling, config_store: Optional[ConfigItemStore] = None
|
58
|
-
) -> None:
|
59
|
-
"""
|
60
|
-
Initialize a Benchling App.
|
61
|
-
|
62
|
-
:param app_id: An id representing a tenanted app installation (e.g., "app_Uh3BZ55aYcXGFJVb")
|
63
|
-
:param benchling: A Benchling object for making API calls. The auth_method should be valid for the specified App.
|
64
|
-
Commonly this is ClientCredentialsOAuth2 using the app's client ID and client secret.
|
65
|
-
:param config_store: The configuration item store for accessing an App's tenanted app config items.
|
66
|
-
If unspecified, will default to retrieving app config from the tenant referenced by Benchling.
|
67
|
-
Apps that don't use app configuration can safely ignore this.
|
68
|
-
"""
|
69
|
-
self._app_id = app_id
|
70
|
-
self._benchling = benchling
|
71
|
-
self._config_store = (
|
72
|
-
config_store if config_store else ConfigItemStore(BenchlingConfigProvider(benchling, app_id))
|
73
|
-
)
|
74
|
-
|
75
|
-
@property
|
76
|
-
def id(self) -> str:
|
77
|
-
"""Return the app tenanted installation id."""
|
78
|
-
return self._app_id
|
79
|
-
|
80
|
-
@property
|
81
|
-
def benchling(self) -> Benchling:
|
82
|
-
"""Return a Benchling instance for the App."""
|
83
|
-
return self._benchling
|
84
|
-
|
85
|
-
@property
|
86
|
-
def config_store(self) -> ConfigItemStore:
|
87
|
-
"""Return a ConfigItemStore instance for the App."""
|
88
|
-
return self._config_store
|
89
|
-
|
90
|
-
def create_session_context(
|
91
|
-
self: AppType,
|
92
|
-
name: str,
|
93
|
-
timeout_seconds: int,
|
94
|
-
context_enter_handler: Optional[helpers.session_helpers.SessionContextEnterHandler[AppType]] = None,
|
95
|
-
context_exit_handler: Optional[helpers.session_helpers.SessionContextExitHandler[AppType]] = None,
|
96
|
-
) -> helpers.session_helpers.SessionContextManager[AppType]:
|
97
|
-
"""
|
98
|
-
Create Session Context.
|
99
|
-
|
100
|
-
Create a new app session in Benchling.
|
101
|
-
"""
|
102
|
-
# Avoid circular import + MyPy "is not defined" if using relative like above
|
103
|
-
from benchling_sdk.apps.helpers.session_helpers import new_session_context
|
104
|
-
|
105
|
-
return new_session_context(self, name, timeout_seconds, context_enter_handler, context_exit_handler)
|
106
|
-
|
107
|
-
def continue_session_context(
|
108
|
-
self: AppType,
|
109
|
-
session_id: str,
|
110
|
-
context_enter_handler: Optional[helpers.session_helpers.SessionContextEnterHandler[AppType]] = None,
|
111
|
-
context_exit_handler: Optional[helpers.session_helpers.SessionContextExitHandler[AppType]] = None,
|
112
|
-
) -> helpers.session_helpers.SessionContextManager[AppType]:
|
113
|
-
"""
|
114
|
-
Continue Session Context.
|
115
|
-
|
116
|
-
Fetch an existing app session from Benchling and enter a context with it.
|
117
|
-
"""
|
118
|
-
# Avoid circular import + MyPy "is not defined" if using relative like above
|
119
|
-
from benchling_sdk.apps.helpers.session_helpers import continue_session_context
|
120
|
-
|
121
|
-
return continue_session_context(self, session_id, context_enter_handler, context_exit_handler)
|
122
|
-
|
123
|
-
|
124
25
|
class BenchlingConfigProvider(ConfigProvider):
|
125
26
|
"""
|
126
27
|
Benchling Config provider.
|
@@ -135,8 +36,7 @@ class BenchlingConfigProvider(ConfigProvider):
|
|
135
36
|
"""
|
136
37
|
Initialize Benchling Config Provider.
|
137
38
|
|
138
|
-
:param
|
139
|
-
:param tenant_url_provider: A provider for a tenant url.
|
39
|
+
:param benchling: A Benchling instance.
|
140
40
|
:param app_id: The app_id from which to retrieve configuration.
|
141
41
|
"""
|
142
42
|
self._app_id = app_id
|
@@ -34,6 +34,7 @@ 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.framework import _supported_config_item, ConfigItemStore, StaticConfigProvider
|
37
38
|
from benchling_sdk.apps.config.scalars import (
|
38
39
|
BoolScalar,
|
39
40
|
DateScalar,
|
@@ -48,7 +49,6 @@ from benchling_sdk.apps.config.scalars import (
|
|
48
49
|
TextScalar,
|
49
50
|
)
|
50
51
|
from benchling_sdk.apps.config.types import ConfigurationReference
|
51
|
-
from benchling_sdk.apps.framework import _supported_config_item, ConfigItemStore, StaticConfigProvider
|
52
52
|
from benchling_sdk.apps.helpers.config_helpers import (
|
53
53
|
element_definition_from_dependency,
|
54
54
|
enum_from_dependency,
|
@@ -0,0 +1,92 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
from benchling_sdk.apps.config.framework import BenchlingConfigProvider, ConfigItemStore
|
6
|
+
from benchling_sdk.apps.status.framework import (
|
7
|
+
continue_session_context,
|
8
|
+
new_session_context,
|
9
|
+
SessionContextEnterHandler,
|
10
|
+
SessionContextExitHandler,
|
11
|
+
SessionContextManager,
|
12
|
+
)
|
13
|
+
from benchling_sdk.benchling import Benchling
|
14
|
+
from benchling_sdk.helpers.logging_helpers import log_stability_warning, StabilityLevel
|
15
|
+
|
16
|
+
log_stability_warning(StabilityLevel.ALPHA)
|
17
|
+
|
18
|
+
|
19
|
+
class App:
|
20
|
+
"""
|
21
|
+
App.
|
22
|
+
|
23
|
+
See https://docs.benchling.com/docs/getting-started-benchling-apps
|
24
|
+
|
25
|
+
Accepts providers as arguments to lazily initialize since some required attributes may not be
|
26
|
+
known until runtime. Also allows for easier mocking in tests.
|
27
|
+
"""
|
28
|
+
|
29
|
+
_app_id: str
|
30
|
+
_benchling: Benchling
|
31
|
+
_config_store: ConfigItemStore
|
32
|
+
|
33
|
+
def __init__(
|
34
|
+
self, app_id: str, benchling: Benchling, config_store: Optional[ConfigItemStore] = None
|
35
|
+
) -> None:
|
36
|
+
"""
|
37
|
+
Initialize a Benchling App.
|
38
|
+
|
39
|
+
:param app_id: An id representing a tenanted app installation (e.g., "app_Uh3BZ55aYcXGFJVb")
|
40
|
+
:param benchling: A Benchling object for making API calls. The auth_method should be valid for the specified App.
|
41
|
+
Commonly this is ClientCredentialsOAuth2 using the app's client ID and client secret.
|
42
|
+
:param config_store: The configuration item store for accessing an App's tenanted app config items.
|
43
|
+
If unspecified, will default to retrieving app config from the tenant referenced by Benchling.
|
44
|
+
Apps that don't use app configuration can safely ignore this.
|
45
|
+
"""
|
46
|
+
self._app_id = app_id
|
47
|
+
self._benchling = benchling
|
48
|
+
self._config_store = (
|
49
|
+
config_store if config_store else ConfigItemStore(BenchlingConfigProvider(benchling, app_id))
|
50
|
+
)
|
51
|
+
|
52
|
+
@property
|
53
|
+
def id(self) -> str:
|
54
|
+
"""Return the app tenanted installation id."""
|
55
|
+
return self._app_id
|
56
|
+
|
57
|
+
@property
|
58
|
+
def benchling(self) -> Benchling:
|
59
|
+
"""Return a Benchling instance for the App."""
|
60
|
+
return self._benchling
|
61
|
+
|
62
|
+
@property
|
63
|
+
def config_store(self) -> ConfigItemStore:
|
64
|
+
"""Return a ConfigItemStore instance for the App."""
|
65
|
+
return self._config_store
|
66
|
+
|
67
|
+
def create_session_context(
|
68
|
+
self,
|
69
|
+
name: str,
|
70
|
+
timeout_seconds: int,
|
71
|
+
context_enter_handler: Optional[SessionContextEnterHandler] = None,
|
72
|
+
context_exit_handler: Optional[SessionContextExitHandler] = None,
|
73
|
+
) -> SessionContextManager:
|
74
|
+
"""
|
75
|
+
Create Session Context.
|
76
|
+
|
77
|
+
Create a new app session in Benchling.
|
78
|
+
"""
|
79
|
+
return new_session_context(self, name, timeout_seconds, context_enter_handler, context_exit_handler)
|
80
|
+
|
81
|
+
def continue_session_context(
|
82
|
+
self,
|
83
|
+
session_id: str,
|
84
|
+
context_enter_handler: Optional[SessionContextEnterHandler] = None,
|
85
|
+
context_exit_handler: Optional[SessionContextExitHandler] = None,
|
86
|
+
) -> SessionContextManager:
|
87
|
+
"""
|
88
|
+
Continue Session Context.
|
89
|
+
|
90
|
+
Fetch an existing app session from Benchling and enter a context with it.
|
91
|
+
"""
|
92
|
+
return continue_session_context(self, session_id, context_enter_handler, context_exit_handler)
|
@@ -0,0 +1,82 @@
|
|
1
|
+
from typing import List, Union
|
2
|
+
|
3
|
+
from benchling_sdk.models import AppSessionMessageCreate, AppSessionMessageStyle
|
4
|
+
|
5
|
+
|
6
|
+
class SessionClosedError(Exception):
|
7
|
+
"""
|
8
|
+
Session Closed Error.
|
9
|
+
|
10
|
+
A session was inoperable because its status in Benchling was terminal.
|
11
|
+
"""
|
12
|
+
|
13
|
+
pass
|
14
|
+
|
15
|
+
|
16
|
+
class SessionContextClosedError(Exception):
|
17
|
+
"""
|
18
|
+
Session Context Closed Error.
|
19
|
+
|
20
|
+
An operation was attempted using the session context manager after it was closed.
|
21
|
+
"""
|
22
|
+
|
23
|
+
pass
|
24
|
+
|
25
|
+
|
26
|
+
class InvalidSessionTimeoutError(Exception):
|
27
|
+
"""
|
28
|
+
Invalid Session Timeout Error.
|
29
|
+
|
30
|
+
A session's timeout value was set to an invalid value.
|
31
|
+
"""
|
32
|
+
|
33
|
+
pass
|
34
|
+
|
35
|
+
|
36
|
+
class MissingAttachedCanvasError(Exception):
|
37
|
+
"""
|
38
|
+
Missing Attached Canvas Error.
|
39
|
+
|
40
|
+
A canvas operation was requested, but a session context has no attached canvas.
|
41
|
+
"""
|
42
|
+
|
43
|
+
pass
|
44
|
+
|
45
|
+
|
46
|
+
class AppUserFacingError(Exception):
|
47
|
+
"""
|
48
|
+
App User Facing Error.
|
49
|
+
|
50
|
+
Extend this class with custom exceptions you want to be written back to the user as a SessionMessage.
|
51
|
+
|
52
|
+
SessionClosingContextExitHandler will invoke messages() and write them to a user. Callers choosing to
|
53
|
+
write their own SessionContextExitHandler may need to replicate this behavior themselves.
|
54
|
+
|
55
|
+
This is useful for control flow where an app wants to terminate with an error state that is resolvable
|
56
|
+
by the user.
|
57
|
+
|
58
|
+
For example:
|
59
|
+
|
60
|
+
class InvalidUserInputError(AppUserFacingError):
|
61
|
+
pass
|
62
|
+
|
63
|
+
raise InvalidUserInputError("Please enter a number between 1 and 10")
|
64
|
+
|
65
|
+
This would create a message shown to the user like:
|
66
|
+
|
67
|
+
AppSessionMessageCreate("Please enter a number between 1 and 10", style=AppSessionMessageStyle.ERROR)
|
68
|
+
"""
|
69
|
+
|
70
|
+
_messages: List[str]
|
71
|
+
|
72
|
+
def __init__(self, messages: Union[str, List[str]], *args) -> None:
|
73
|
+
"""Initialize an AppUserFacingError with one message or a list."""
|
74
|
+
self._messages = [messages] if isinstance(messages, str) else messages
|
75
|
+
super().__init__(args)
|
76
|
+
|
77
|
+
def messages(self) -> List[AppSessionMessageCreate]:
|
78
|
+
"""Create a series of AppSessionMessageCreate to write to a Session and displayed to the user."""
|
79
|
+
return [
|
80
|
+
AppSessionMessageCreate(content=message, style=AppSessionMessageStyle.ERROR)
|
81
|
+
for message in self._messages
|
82
|
+
]
|