cave-utils 2.0.0b3__tar.gz → 2.0.2__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.
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/PKG-INFO +4 -5
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/README.md +4 -5
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils/api/__init__.py +54 -63
- cave_utils-2.0.2/cave_utils/api/appBar.py +129 -0
- cave_utils-2.0.2/cave_utils/api/extraKwargs.py +33 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils/api/globalOutputs.py +16 -26
- cave_utils-2.0.2/cave_utils/api/groupedOutputs.py +377 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils/api/mapFeatures.py +184 -193
- cave_utils-2.0.2/cave_utils/api/maps.py +684 -0
- cave_utils-2.0.2/cave_utils/api/pages.py +266 -0
- cave_utils-2.0.2/cave_utils/api/panes.py +167 -0
- cave_utils-2.0.2/cave_utils/api/settings.py +256 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils/api_utils/__init__.py +1 -1
- cave_utils-2.0.2/cave_utils/api_utils/general.py +600 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils/api_utils/validator.py +6 -12
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils/api_utils/validator_utils.py +27 -17
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils/log.py +3 -2
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils.egg-info/PKG-INFO +4 -5
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/pyproject.toml +1 -1
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/setup.cfg +1 -1
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/test/test_log.py +1 -1
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/test/test_validator.py +138 -75
- cave_utils-2.0.0b3/cave_utils/api/appBar.py +0 -132
- cave_utils-2.0.0b3/cave_utils/api/extraKwargs.py +0 -29
- cave_utils-2.0.0b3/cave_utils/api/groupedOutputs.py +0 -366
- cave_utils-2.0.0b3/cave_utils/api/maps.py +0 -684
- cave_utils-2.0.0b3/cave_utils/api/pages.py +0 -244
- cave_utils-2.0.0b3/cave_utils/api/panes.py +0 -156
- cave_utils-2.0.0b3/cave_utils/api/settings.py +0 -225
- cave_utils-2.0.0b3/cave_utils/api_utils/general.py +0 -589
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/LICENSE +0 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/NOTICE.md +0 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils/__init__.py +0 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils/arguments.py +0 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils/socket.py +0 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils.egg-info/SOURCES.txt +0 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils.egg-info/dependency_links.txt +0 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils.egg-info/requires.txt +0 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/cave_utils.egg-info/top_level.txt +0 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/test/test_arguments.py +0 -0
- {cave_utils-2.0.0b3 → cave_utils-2.0.2}/test/test_import.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cave_utils
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: Python wrapper for api use in the cave_app
|
|
5
5
|
Author-email: Connor Makowski <conmak@mit.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/mit-cave/cave_utils
|
|
@@ -80,9 +80,8 @@ pip install cave_utils
|
|
|
80
80
|
|
|
81
81
|
2. Remove `cave_utils` from the root `requirements.txt` file
|
|
82
82
|
|
|
83
|
-
3. In your cave_app, set `
|
|
84
|
-
- This will validate your data every time an
|
|
85
|
-
- Outputs will be stored in `logs/validation/{session_name}.log`
|
|
83
|
+
3. In your cave_app, set `LIVE_API_VALIDATION_PRINT=True` in the `.env` file
|
|
84
|
+
- This will validate your data every time an API command is called for each session
|
|
86
85
|
|
|
87
86
|
4. Use the following command to run your cave_app:
|
|
88
87
|
`cave run --docker-args "--volume {local_path_to_cave_utils}/cave_utils:/cave_utils"`
|
|
@@ -94,7 +93,7 @@ pip install cave_utils
|
|
|
94
93
|
`cave run --docker-args "--volume {local_path_to_cave_utils}/cave_utils:/cave_utils" -it`
|
|
95
94
|
2. Then install cave utils in the docker container:
|
|
96
95
|
`pip install -e /cave_utils`
|
|
97
|
-
3. Then run some tests (eg `validate_all_examples.py`):
|
|
96
|
+
3. Then run some tests (eg `validate_all_examples.py`):
|
|
98
97
|
`python cave_api/tests/validate_all_examples.py`
|
|
99
98
|
|
|
100
99
|
# Generate Documentation
|
|
@@ -64,9 +64,8 @@ pip install cave_utils
|
|
|
64
64
|
|
|
65
65
|
2. Remove `cave_utils` from the root `requirements.txt` file
|
|
66
66
|
|
|
67
|
-
3. In your cave_app, set `
|
|
68
|
-
- This will validate your data every time an
|
|
69
|
-
- Outputs will be stored in `logs/validation/{session_name}.log`
|
|
67
|
+
3. In your cave_app, set `LIVE_API_VALIDATION_PRINT=True` in the `.env` file
|
|
68
|
+
- This will validate your data every time an API command is called for each session
|
|
70
69
|
|
|
71
70
|
4. Use the following command to run your cave_app:
|
|
72
71
|
`cave run --docker-args "--volume {local_path_to_cave_utils}/cave_utils:/cave_utils"`
|
|
@@ -78,7 +77,7 @@ pip install cave_utils
|
|
|
78
77
|
`cave run --docker-args "--volume {local_path_to_cave_utils}/cave_utils:/cave_utils" -it`
|
|
79
78
|
2. Then install cave utils in the docker container:
|
|
80
79
|
`pip install -e /cave_utils`
|
|
81
|
-
3. Then run some tests (eg `validate_all_examples.py`):
|
|
80
|
+
3. Then run some tests (eg `validate_all_examples.py`):
|
|
82
81
|
`python cave_api/tests/validate_all_examples.py`
|
|
83
82
|
|
|
84
83
|
# Generate Documentation
|
|
@@ -102,4 +101,4 @@ pip install cave_utils
|
|
|
102
101
|
- `pyproject.toml`
|
|
103
102
|
3. Update the release
|
|
104
103
|
- `source venv/bin/activate`
|
|
105
|
-
- `./update_version.sh`
|
|
104
|
+
- `./update_version.sh`
|
|
@@ -23,6 +23,7 @@ from cave_utils.api.mapFeatures import mapFeatures
|
|
|
23
23
|
from cave_utils.api.groupedOutputs import groupedOutputs
|
|
24
24
|
import type_enforced
|
|
25
25
|
|
|
26
|
+
|
|
26
27
|
@type_enforced.Enforcer
|
|
27
28
|
class Root(ApiValidator):
|
|
28
29
|
"""
|
|
@@ -45,58 +46,33 @@ class Root(ApiValidator):
|
|
|
45
46
|
**kwargs,
|
|
46
47
|
):
|
|
47
48
|
"""
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
- `settings:
|
|
51
|
-
- Type: dict
|
|
52
|
-
- What: General settings for your application.
|
|
53
|
-
- Note: 'settings.iconUrl' is the only required field in `settings`
|
|
54
|
-
- See: `cave_utils.api.settings`
|
|
55
|
-
- `appBar`:
|
|
56
|
-
- Type: dict
|
|
57
|
-
- What: Settings for the app bar.
|
|
58
|
-
- Note: 'appBar.data' is required, and should have at least one item in it.
|
|
59
|
-
- See: `cave_utils.api.appBar`
|
|
60
|
-
|
|
61
|
-
Optional Arguments:
|
|
49
|
+
Arguments:
|
|
62
50
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
- Default: `{}`
|
|
87
|
-
- See: `cave_utils.api.groupedOutputs`
|
|
88
|
-
- `globalOutputs`:
|
|
89
|
-
- Type: dict
|
|
90
|
-
- What: Configure data that is general to the entire application and can be compared across sessions.
|
|
91
|
-
- Default: `{}`
|
|
92
|
-
- See: `cave_utils.api.globalOutputs`
|
|
93
|
-
- `extraKwargs`:
|
|
94
|
-
- Type: dict
|
|
95
|
-
- What: Special arguments to be passed to the server.
|
|
96
|
-
- Default: `{}`
|
|
97
|
-
- See: `cave_utils.api.extraKwargs`
|
|
51
|
+
* **`settings`**: `[dict]` → General settings for your application.
|
|
52
|
+
* **Note**: `settings.iconUrl` is the only required field in `settings`
|
|
53
|
+
* **See**: `cave_utils.api.settings`
|
|
54
|
+
* **`appBar`**: `[dict]` → Configure actions for your app bar(s).
|
|
55
|
+
* **Note**: `appBar.data` is required and should have at least one item in it.
|
|
56
|
+
* **See**: `cave_utils.api.appBar`
|
|
57
|
+
* **`panes`**: `[dict]` = `{}` → Configure panes for your application.
|
|
58
|
+
* **See**: `cave_utils.api.panes`
|
|
59
|
+
* **`pages`**: `[dict]` = `{}` → Configure pages for your application.
|
|
60
|
+
* **See**: `cave_utils.api.pages`
|
|
61
|
+
* **`maps`**: `[dict]` = `{}` → Configure map views and settings for your application.
|
|
62
|
+
* **See**: `cave_utils.api.maps`
|
|
63
|
+
* **`mapFeatures`**: `[dict]` = `{}` →
|
|
64
|
+
* Configure map features (interactive items on the map) for your application.
|
|
65
|
+
* **See**: `cave_utils.api.mapFeatures`
|
|
66
|
+
* **`groupedOutputs`**: `[dict]` = `{}` →
|
|
67
|
+
* Configure data that can be sliced and diced for charts and tables based on arbitrary groups.
|
|
68
|
+
* **See**: `cave_utils.api.groupedOutputs`
|
|
69
|
+
* **`globalOutputs`**: `[dict]` = `{}` →
|
|
70
|
+
* Configure data that is general to the entire application and can be compared across sessions.
|
|
71
|
+
* **See**: `cave_utils.api.globalOutputs`
|
|
72
|
+
* **`extraKwargs`**: `[dict]` = `{}` → Special arguments to be passed to the server.
|
|
73
|
+
* **See**: `cave_utils.api.extraKwargs`
|
|
98
74
|
"""
|
|
99
|
-
kwargs = {k:v for k,v in kwargs.items() if k !=
|
|
75
|
+
kwargs = {k: v for k, v in kwargs.items() if k != "associated"}
|
|
100
76
|
return {
|
|
101
77
|
"kwargs": kwargs,
|
|
102
78
|
"accepted_values": {},
|
|
@@ -141,7 +117,13 @@ class Root(ApiValidator):
|
|
|
141
117
|
maps_data = self.data.get("maps", dict())
|
|
142
118
|
maps_validMapIds = []
|
|
143
119
|
if maps_data != {}:
|
|
144
|
-
maps(
|
|
120
|
+
maps(
|
|
121
|
+
data=maps_data,
|
|
122
|
+
log=self.log,
|
|
123
|
+
prepend_path=["maps"],
|
|
124
|
+
mapFeatures_feature_props=mapFeatures_feature_props,
|
|
125
|
+
**kwargs,
|
|
126
|
+
)
|
|
145
127
|
maps_validMapIds = list(maps_data.get("data", {}).keys())
|
|
146
128
|
# Validate globalOutputs
|
|
147
129
|
globalOutputs_data = self.data.get("globalOutputs", dict())
|
|
@@ -155,7 +137,7 @@ class Root(ApiValidator):
|
|
|
155
137
|
)
|
|
156
138
|
globalOuputs_validPropIds = list(globalOutputs_data.get("values", {}).keys())
|
|
157
139
|
# Validate groupedOutputs
|
|
158
|
-
groupedOutputs_data = self.data.get("groupedOutputs",dict())
|
|
140
|
+
groupedOutputs_data = self.data.get("groupedOutputs", dict())
|
|
159
141
|
groupedOutputs_validLevelIds = {}
|
|
160
142
|
groupedOutputs_validStatIds = {}
|
|
161
143
|
groupedOutputs_validGroupIds = {}
|
|
@@ -168,15 +150,24 @@ class Root(ApiValidator):
|
|
|
168
150
|
)
|
|
169
151
|
# Populate valid ids for each relevant groupedOutput to be used in pages.
|
|
170
152
|
try:
|
|
171
|
-
groupedOutputs_validLevelIds = {
|
|
153
|
+
groupedOutputs_validLevelIds = {
|
|
154
|
+
k: list(v.get("levels").keys())
|
|
155
|
+
for k, v in groupedOutputs_data.get("groupings", {}).items()
|
|
156
|
+
}
|
|
172
157
|
except:
|
|
173
158
|
pass
|
|
174
159
|
try:
|
|
175
|
-
groupedOutputs_validStatIds = {
|
|
160
|
+
groupedOutputs_validStatIds = {
|
|
161
|
+
k: list(v.get("stats").keys())
|
|
162
|
+
for k, v in groupedOutputs_data.get("data", {}).items()
|
|
163
|
+
}
|
|
176
164
|
except:
|
|
177
165
|
pass
|
|
178
166
|
try:
|
|
179
|
-
groupedOutputs_validGroupIds = {
|
|
167
|
+
groupedOutputs_validGroupIds = {
|
|
168
|
+
k: list(v.get("groupLists").keys())
|
|
169
|
+
for k, v in groupedOutputs_data.get("data", {}).items()
|
|
170
|
+
}
|
|
180
171
|
except:
|
|
181
172
|
pass
|
|
182
173
|
# Validate pages
|
|
@@ -184,8 +175,8 @@ class Root(ApiValidator):
|
|
|
184
175
|
page_validPageIds = []
|
|
185
176
|
if pages_data != {}:
|
|
186
177
|
pages(
|
|
187
|
-
data=pages_data,
|
|
188
|
-
log=self.log,
|
|
178
|
+
data=pages_data,
|
|
179
|
+
log=self.log,
|
|
189
180
|
prepend_path=["pages"],
|
|
190
181
|
# Special Kwargs to validate globalOutputs, groupedOutputs and maps are valid:
|
|
191
182
|
globalOuputs_validPropIds=globalOuputs_validPropIds,
|
|
@@ -193,18 +184,18 @@ class Root(ApiValidator):
|
|
|
193
184
|
groupedOutputs_validLevelIds=groupedOutputs_validLevelIds,
|
|
194
185
|
groupedOutputs_validStatIds=groupedOutputs_validStatIds,
|
|
195
186
|
groupedOutputs_validGroupIds=groupedOutputs_validGroupIds,
|
|
196
|
-
**kwargs
|
|
187
|
+
**kwargs,
|
|
197
188
|
)
|
|
198
189
|
page_validPageIds = list(pages_data.get("data", {}).keys())
|
|
199
190
|
# Validate appBar
|
|
200
191
|
appBar_data = self.data.get("appBar", dict())
|
|
201
192
|
if appBar_data != {}:
|
|
202
193
|
appBar(
|
|
203
|
-
data=appBar_data,
|
|
204
|
-
log=self.log,
|
|
205
|
-
prepend_path=["appBar"],
|
|
194
|
+
data=appBar_data,
|
|
195
|
+
log=self.log,
|
|
196
|
+
prepend_path=["appBar"],
|
|
206
197
|
# Special kwargs to validate panes and pages are valid:
|
|
207
198
|
page_validPageIds=page_validPageIds,
|
|
208
199
|
pane_validPaneIds=pane_validPaneIds,
|
|
209
|
-
**kwargs
|
|
210
|
-
)
|
|
200
|
+
**kwargs,
|
|
201
|
+
)
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The app bar is a key element of the CAVE App, positioned on the left or
|
|
3
|
+
right side of the screen. It provides actions that allow users to
|
|
4
|
+
navigate between [pages][], launch [panes][], and interact with the
|
|
5
|
+
CAVE API through [predefined][] or [custom][] commands.
|
|
6
|
+
|
|
7
|
+
If specified, both left and right side app bars can be displayed
|
|
8
|
+
simultaneously.
|
|
9
|
+
|
|
10
|
+
[pages]: pages.html
|
|
11
|
+
[panes]: panes.html
|
|
12
|
+
[predefined]: #appBar_data_star.spec
|
|
13
|
+
[custom]: #appBar_data_star.spec
|
|
14
|
+
"""
|
|
15
|
+
from cave_utils.api_utils.validator_utils import ApiValidator, CustomKeyValidator
|
|
16
|
+
import type_enforced
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@type_enforced.Enforcer
|
|
20
|
+
class appBar(ApiValidator):
|
|
21
|
+
"""
|
|
22
|
+
The app bar is located under the path **`appBar`**.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
@staticmethod
|
|
26
|
+
def spec(data: dict = dict(), **kwargs):
|
|
27
|
+
"""
|
|
28
|
+
@private
|
|
29
|
+
Arguments:
|
|
30
|
+
|
|
31
|
+
* **`data`**: `[dict]` = `{}` → The data to pass to `appBar.data.*`.
|
|
32
|
+
"""
|
|
33
|
+
return {"kwargs": kwargs, "accepted_values": {}}
|
|
34
|
+
|
|
35
|
+
def __extend_spec__(self, **kwargs):
|
|
36
|
+
data = self.data.get("data", {})
|
|
37
|
+
CustomKeyValidator(
|
|
38
|
+
data=data, log=self.log, prepend_path=["data"], validator=appBar_data_star, **kwargs
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@type_enforced.Enforcer
|
|
43
|
+
class appBar_data_star(ApiValidator):
|
|
44
|
+
"""
|
|
45
|
+
The app bar data is located under the path **`appBar.data`**.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
@staticmethod
|
|
49
|
+
def spec(
|
|
50
|
+
icon: str,
|
|
51
|
+
type: str,
|
|
52
|
+
bar: str,
|
|
53
|
+
variant: [str, None] = None,
|
|
54
|
+
color: [str, None] = None,
|
|
55
|
+
order: [dict, None] = None,
|
|
56
|
+
apiCommand: [str, None] = None,
|
|
57
|
+
apiCommandKeys: [list, None] = None,
|
|
58
|
+
**kwargs,
|
|
59
|
+
):
|
|
60
|
+
"""
|
|
61
|
+
Arguments:
|
|
62
|
+
|
|
63
|
+
* **`icon`**: `[str]` → An icon to display in the center of the action element.
|
|
64
|
+
* **Note**: It must be a valid icon name from the [react-icons][] bundle, preceded by the abbreviated name of the icon library source.
|
|
65
|
+
* **Example**: `"md/MdRocket"`.
|
|
66
|
+
* **`type`**: `[str]` → The type of object displayed when the action is triggered.
|
|
67
|
+
* **Accepted Values**:
|
|
68
|
+
* `"session"`: The Session Pane
|
|
69
|
+
* `"settings"`: The Application Settings Pane
|
|
70
|
+
* `"button"`: A button that allows you to send a command to the CAVE API
|
|
71
|
+
* `"pane"`: A [custom pane][]
|
|
72
|
+
* `"page"`: A [page][]
|
|
73
|
+
* **`bar`**: `[str]` → The location of the action element.
|
|
74
|
+
* **Accepted Values**:
|
|
75
|
+
* `"upperLeft"`: Upper section of the left-side bar
|
|
76
|
+
* `"lowerLeft"`: Lower section of the left-side bar
|
|
77
|
+
* `"upperRight"`: Upper section of the right-side bar
|
|
78
|
+
* `"lowerRight"`: Lower section of the right-side bar
|
|
79
|
+
* **`variant`**: `[str]` = `None` → The variant of the button.
|
|
80
|
+
* **Accepted Values**:
|
|
81
|
+
* When **`type`** == `"pane"`:
|
|
82
|
+
* `"modal"`: A [modal pane][]
|
|
83
|
+
* `"wall"`: A [wall pane][]
|
|
84
|
+
* Otherwise:
|
|
85
|
+
* `None`
|
|
86
|
+
* **`color`**: `[str]` = `<system-default-value>` →
|
|
87
|
+
* The color of the button. If omitted, the default value is set by the system.
|
|
88
|
+
* **Note**: It must be a valid RGBA string.
|
|
89
|
+
* **Example**: `"rgba(255, 255, 255, 1)"`.
|
|
90
|
+
* **`apiCommand`**: `[str]` = `None` → The name of the [API command][] to trigger.
|
|
91
|
+
* **`apiCommandKeys`**: `[list]` = `None` →
|
|
92
|
+
* The root API keys to pass to your `execute_command` function if an
|
|
93
|
+
`apiCommand` is provided. If omitted, all API keys are
|
|
94
|
+
passed to `execute_command`.
|
|
95
|
+
|
|
96
|
+
[page]: pages.html
|
|
97
|
+
[pane]: panes.html
|
|
98
|
+
[modal pane]: panes.html
|
|
99
|
+
[wall pane]: panes.html
|
|
100
|
+
[API command]: #appBar_data_star.spec
|
|
101
|
+
[react-icons]: https://react-icons.github.io/react-icons/search
|
|
102
|
+
"""
|
|
103
|
+
return {
|
|
104
|
+
"kwargs": kwargs,
|
|
105
|
+
"accepted_values": {
|
|
106
|
+
"type": ["session", "settings", "button", "pane", "page"],
|
|
107
|
+
"variant": ["modal", "wall"] if type == "pane" else [],
|
|
108
|
+
"bar": ["upperLeft", "lowerLeft", "upperRight", "lowerRight"],
|
|
109
|
+
},
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
def __extend_spec__(self, **kwargs):
|
|
113
|
+
color = self.data.get("color")
|
|
114
|
+
if color:
|
|
115
|
+
self.__check_rgba_string_valid__(rgba_string=color, prepend_path=["color"])
|
|
116
|
+
# Validate pageIds
|
|
117
|
+
bar_type = self.data.get("type")
|
|
118
|
+
if bar_type == "page":
|
|
119
|
+
self.__check_subset_valid__(
|
|
120
|
+
subset=[kwargs.get("CustomKeyValidatorFieldId")],
|
|
121
|
+
valid_values=kwargs.get("page_validPageIds", []),
|
|
122
|
+
prepend_path=[],
|
|
123
|
+
)
|
|
124
|
+
if bar_type == "pane":
|
|
125
|
+
self.__check_subset_valid__(
|
|
126
|
+
subset=[kwargs.get("CustomKeyValidatorFieldId")],
|
|
127
|
+
valid_values=kwargs.get("pane_validPaneIds", []),
|
|
128
|
+
prepend_path=[],
|
|
129
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Optionally, pass special arguments to adjust some options related to
|
|
3
|
+
how the CAVE API server handles data.
|
|
4
|
+
"""
|
|
5
|
+
from cave_utils.api_utils.validator_utils import ApiValidator
|
|
6
|
+
import type_enforced
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@type_enforced.Enforcer
|
|
10
|
+
class extraKwargs(ApiValidator):
|
|
11
|
+
"""
|
|
12
|
+
The special arguments are located under the path **`extraKwargs`**.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
@staticmethod
|
|
16
|
+
def spec(wipeExisting: bool = False, **kwargs):
|
|
17
|
+
"""
|
|
18
|
+
Arguments:
|
|
19
|
+
|
|
20
|
+
* **`wipeExisting`**: `[bool]` = `False` →
|
|
21
|
+
* If set to `True`, all existing data will be deleted just
|
|
22
|
+
before session data updates are merged. By default (set to
|
|
23
|
+
`False`), the CAVE API will merge new data with existing
|
|
24
|
+
data.
|
|
25
|
+
* **Note**: The data is merged at the root level. In this
|
|
26
|
+
case, if you update an item in `settings`, the entire
|
|
27
|
+
`settings` object must be present when you return
|
|
28
|
+
`session_data`.
|
|
29
|
+
"""
|
|
30
|
+
return {
|
|
31
|
+
"kwargs": kwargs,
|
|
32
|
+
"accepted_values": {},
|
|
33
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""
|
|
2
|
-
|
|
3
|
-
These outputs should be general to the entire application and can be compared across sessions.
|
|
1
|
+
"""Create outputs that allow for simple charts and tables to present some totalization or global outcome of the data.
|
|
2
|
+
|
|
3
|
+
These outputs should be general to the entire application and they can be compared across sessions.
|
|
4
4
|
"""
|
|
5
5
|
from cave_utils.api_utils.validator_utils import ApiValidator, CustomKeyValidator
|
|
6
6
|
from cave_utils.api_utils.general import props, values, layout
|
|
@@ -10,34 +10,24 @@ import type_enforced
|
|
|
10
10
|
@type_enforced.Enforcer
|
|
11
11
|
class globalOutputs(ApiValidator):
|
|
12
12
|
"""
|
|
13
|
-
|
|
13
|
+
The global outputs data is located under the path **`globalOutputs`**.
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
16
|
@staticmethod
|
|
17
|
-
def spec(
|
|
18
|
-
props: dict, values: [dict, None] = None, layout: [dict, None] = None, **kwargs
|
|
19
|
-
):
|
|
17
|
+
def spec(props: dict, values: [dict, None] = None, layout: [dict, None] = None, **kwargs):
|
|
20
18
|
"""
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- `props`:
|
|
24
|
-
- Type: dict
|
|
25
|
-
- What: The props that will be rendered as global outputs.
|
|
26
|
-
- See: `cave_utils.api_utils.general.props`
|
|
27
|
-
- `values`:
|
|
28
|
-
- Type: dict
|
|
29
|
-
- What: The values that will be passed to the props.
|
|
30
|
-
- Required: False
|
|
31
|
-
- See: `cave_utils.api_utils.general.values`
|
|
19
|
+
Arguments:
|
|
32
20
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
* **`props`**: `[dict]` → The props that will be rendered as global outputs.
|
|
22
|
+
* **See**: `cave_utils.api_utils.general.props`
|
|
23
|
+
* **`values`**: `[dict]` = `None` →
|
|
24
|
+
* The values to be assigned to the respective props. Each value is associated with its corresponding prop based on the key name used in `props`.
|
|
25
|
+
* **See**: `cave_utils.api_utils.general.values`
|
|
26
|
+
* **`layout`**: `[dict]` =`{"type": "grid", "numColumns": "auto", "numRows": "auto"}` →
|
|
27
|
+
* The layout of the global outputs when the "Overview" chart is selected.
|
|
28
|
+
* **See**: `cave_utils.api_utils.general.layout`
|
|
40
29
|
"""
|
|
30
|
+
|
|
41
31
|
return {"kwargs": kwargs, "accepted_values": {}}
|
|
42
32
|
|
|
43
33
|
def __extend_spec__(self, **kwargs):
|
|
@@ -65,4 +55,4 @@ class globalOutputs(ApiValidator):
|
|
|
65
55
|
prepend_path=["layout"],
|
|
66
56
|
prop_id_list=list(props_data.keys()),
|
|
67
57
|
**kwargs,
|
|
68
|
-
)
|
|
58
|
+
)
|