canvas 0.1.8__tar.gz → 0.1.10__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.
Potentially problematic release.
This version of canvas might be problematic. Click here for more details.
- {canvas-0.1.8 → canvas-0.1.10}/PKG-INFO +2 -5
- {canvas-0.1.8 → canvas-0.1.10}/README.md +0 -4
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/apps/logs/logs.py +13 -7
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/apps/plugin/plugin.py +25 -26
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/conftest.py +0 -1
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/main.py +2 -12
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/context/context.py +1 -25
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/print/print.py +1 -15
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/protocols/base.py +5 -1
- {canvas-0.1.8 → canvas-0.1.10}/pyproject.toml +2 -2
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/apps/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/apps/auth/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/apps/auth/tests.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/apps/auth/utils.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/apps/logs/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/apps/plugin/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/apps/plugin/tests.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/templates/plugins/default/cookiecutter.json +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/CANVAS_MANIFEST.json +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/README.md +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/protocols/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/protocols/my_protocol.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/tests.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/context/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/context/tests.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/print/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/print/tests.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/urls/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/urls/tests.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/urls/urls.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/validators/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/validators/manifest_schema.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/validators/tests.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_cli/utils/validators/validators.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/base.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/commands/assess.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/commands/diagnose.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/commands/goal.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/commands/history_present_illness.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/commands/medication_statement.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/commands/plan.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/commands/prescribe.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/commands/questionnaire.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/commands/reason_for_visit.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/commands/stop_medication.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/commands/update_goal.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/constants.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/tests/test_utils.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/commands/tests/tests.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/data/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/effects/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/effects/banner_alert/banner_alert.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/effects/banner_alert/constants.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/effects/base.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/events/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/protocols/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/tests/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/utils/__init__.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/utils/http.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/utils/tests.py +0 -0
- {canvas-0.1.8 → canvas-0.1.10}/canvas_sdk/views/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: canvas
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.10
|
|
4
4
|
Summary: SDK to customize event-driven actions in your Canvas instance
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Canvas Team
|
|
@@ -9,6 +9,7 @@ Requires-Python: >=3.11,<3.13
|
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
13
|
Requires-Dist: cookiecutter
|
|
13
14
|
Requires-Dist: grpcio (>=1.60.1,<2.0.0)
|
|
14
15
|
Requires-Dist: ipython (>=8.21.0,<9.0.0)
|
|
@@ -57,11 +58,7 @@ $ canvas [OPTIONS] COMMAND [ARGS]...
|
|
|
57
58
|
|
|
58
59
|
**Options**:
|
|
59
60
|
|
|
60
|
-
- `--no-ansi`: Disable colorized output
|
|
61
61
|
- `--version`
|
|
62
|
-
- `--verbose`: Show extra output
|
|
63
|
-
- `--install-completion`: Install completion for the current shell.
|
|
64
|
-
- `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
|
|
65
62
|
- `--help`: Show this message and exit.
|
|
66
63
|
|
|
67
64
|
**Commands**:
|
|
@@ -31,11 +31,7 @@ $ canvas [OPTIONS] COMMAND [ARGS]...
|
|
|
31
31
|
|
|
32
32
|
**Options**:
|
|
33
33
|
|
|
34
|
-
- `--no-ansi`: Disable colorized output
|
|
35
34
|
- `--version`
|
|
36
|
-
- `--verbose`: Show extra output
|
|
37
|
-
- `--install-completion`: Install completion for the current shell.
|
|
38
|
-
- `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
|
|
39
35
|
- `--help`: Show this message and exit.
|
|
40
36
|
|
|
41
37
|
**Commands**:
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import json
|
|
1
2
|
from typing import Optional
|
|
2
3
|
from urllib.parse import urlparse
|
|
3
4
|
|
|
@@ -5,23 +6,28 @@ import typer
|
|
|
5
6
|
import websocket
|
|
6
7
|
|
|
7
8
|
from canvas_cli.apps.auth.utils import get_default_host, get_or_request_api_token
|
|
8
|
-
from canvas_cli.utils.print import print
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def _on_message(ws: websocket.WebSocketApp, message: str) -> None:
|
|
12
|
-
|
|
12
|
+
message_to_print = message
|
|
13
|
+
try:
|
|
14
|
+
message_json = json.loads(message)
|
|
15
|
+
message_to_print = f"{message_json['timestamp']} | {message_json['message']}"
|
|
16
|
+
except ValueError:
|
|
17
|
+
pass
|
|
18
|
+
print(message_to_print)
|
|
13
19
|
|
|
14
20
|
|
|
15
21
|
def _on_error(ws: websocket.WebSocketApp, error: str) -> None:
|
|
16
|
-
print
|
|
22
|
+
print(f"Error: {error}")
|
|
17
23
|
|
|
18
24
|
|
|
19
25
|
def _on_close(ws: websocket.WebSocketApp, close_status_code: str, close_msg: str) -> None:
|
|
20
|
-
print
|
|
26
|
+
print(f"Connection closed with status code {close_status_code}: {close_msg}")
|
|
21
27
|
|
|
22
28
|
|
|
23
29
|
def _on_open(ws: websocket.WebSocketApp) -> None:
|
|
24
|
-
print
|
|
30
|
+
print("Connected to the logging service")
|
|
25
31
|
|
|
26
32
|
|
|
27
33
|
def logs(
|
|
@@ -40,8 +46,8 @@ def logs(
|
|
|
40
46
|
hostname = urlparse(host).hostname
|
|
41
47
|
instance = hostname.removesuffix(".canvasmedical.com")
|
|
42
48
|
|
|
43
|
-
print
|
|
44
|
-
|
|
49
|
+
print(
|
|
50
|
+
"Connecting to the log stream. Please be patient as there may be a delay before log messages appear."
|
|
45
51
|
)
|
|
46
52
|
websocket_uri = f"wss://logs.console.canvasmedical.com/{instance}?token={token}"
|
|
47
53
|
|
|
@@ -12,7 +12,6 @@ from cookiecutter.main import cookiecutter
|
|
|
12
12
|
|
|
13
13
|
from canvas_cli.apps.auth.utils import get_default_host, get_or_request_api_token
|
|
14
14
|
from canvas_cli.utils.context import context
|
|
15
|
-
from canvas_cli.utils.print import print
|
|
16
15
|
from canvas_cli.utils.validators import validate_manifest_file
|
|
17
16
|
|
|
18
17
|
|
|
@@ -59,11 +58,11 @@ def _get_name_from_metadata(host: str, token: str, package: Path) -> Optional[st
|
|
|
59
58
|
files={"package": open(package, "rb")},
|
|
60
59
|
)
|
|
61
60
|
except requests.exceptions.RequestException:
|
|
62
|
-
print
|
|
61
|
+
print(f"Failed to connect to {host}")
|
|
63
62
|
raise typer.Exit(1)
|
|
64
63
|
|
|
65
64
|
if metadata_response.status_code != requests.codes.ok:
|
|
66
|
-
print
|
|
65
|
+
print(f"Status code {metadata_response.status_code}: {metadata_response.text}")
|
|
67
66
|
raise typer.Exit(1)
|
|
68
67
|
|
|
69
68
|
metadata = metadata_response.json()
|
|
@@ -83,7 +82,7 @@ def init() -> None:
|
|
|
83
82
|
except OutputDirExistsException:
|
|
84
83
|
raise typer.BadParameter(f"The supplied directory already exists")
|
|
85
84
|
|
|
86
|
-
print
|
|
85
|
+
print(f"Project created in {project_dir}")
|
|
87
86
|
|
|
88
87
|
|
|
89
88
|
def install(
|
|
@@ -109,11 +108,11 @@ def install(
|
|
|
109
108
|
else:
|
|
110
109
|
raise typer.BadParameter(f"Plugin '{plugin_name}' needs to be a valid directory")
|
|
111
110
|
|
|
112
|
-
print
|
|
111
|
+
print(f"Installing plugin: {built_package_path} into {host}")
|
|
113
112
|
|
|
114
113
|
url = plugin_url(host)
|
|
115
114
|
|
|
116
|
-
print
|
|
115
|
+
print(f"Posting {built_package_path.absolute()} to {url}")
|
|
117
116
|
|
|
118
117
|
try:
|
|
119
118
|
r = requests.post(
|
|
@@ -123,11 +122,11 @@ def install(
|
|
|
123
122
|
headers={"Authorization": f"Bearer {token}"},
|
|
124
123
|
)
|
|
125
124
|
except requests.exceptions.RequestException:
|
|
126
|
-
print
|
|
125
|
+
print(f"Failed to connect to {host}")
|
|
127
126
|
raise typer.Exit(1)
|
|
128
127
|
|
|
129
128
|
if r.status_code == requests.codes.created:
|
|
130
|
-
print
|
|
129
|
+
print("Plugin successfully installed!")
|
|
131
130
|
|
|
132
131
|
# If we got a bad_request, means there's a duplicate plugin and install can't handle that.
|
|
133
132
|
# So we need to get the plugin-name from the package and call `update` directly
|
|
@@ -135,7 +134,7 @@ def install(
|
|
|
135
134
|
plugin_name = _get_name_from_metadata(host, token, built_package_path)
|
|
136
135
|
update(plugin_name, built_package_path, is_enabled=True, host=host)
|
|
137
136
|
else:
|
|
138
|
-
print
|
|
137
|
+
print(f"Status code {r.status_code}: {r.text}")
|
|
139
138
|
raise typer.Exit(1)
|
|
140
139
|
|
|
141
140
|
|
|
@@ -153,7 +152,7 @@ def uninstall(
|
|
|
153
152
|
|
|
154
153
|
url = plugin_url(host, name)
|
|
155
154
|
|
|
156
|
-
print
|
|
155
|
+
print(f"Uninstalling {name} using {url}")
|
|
157
156
|
|
|
158
157
|
token = get_or_request_api_token(host)
|
|
159
158
|
|
|
@@ -165,13 +164,13 @@ def uninstall(
|
|
|
165
164
|
},
|
|
166
165
|
)
|
|
167
166
|
except requests.exceptions.RequestException:
|
|
168
|
-
print
|
|
167
|
+
print(f"Failed to connect to {host}")
|
|
169
168
|
raise typer.Exit(1)
|
|
170
169
|
|
|
171
170
|
if r.status_code == requests.codes.no_content:
|
|
172
|
-
print
|
|
171
|
+
print(r.text)
|
|
173
172
|
else:
|
|
174
|
-
print
|
|
173
|
+
print(f"Status code {r.status_code}: {r.text}")
|
|
175
174
|
raise typer.Exit(1)
|
|
176
175
|
|
|
177
176
|
|
|
@@ -196,13 +195,16 @@ def list(
|
|
|
196
195
|
headers={"Authorization": f"Bearer {token}"},
|
|
197
196
|
)
|
|
198
197
|
except requests.exceptions.RequestException:
|
|
199
|
-
print
|
|
198
|
+
print(f"Failed to connect to {host}")
|
|
200
199
|
raise typer.Exit(1)
|
|
201
200
|
|
|
202
201
|
if r.status_code == requests.codes.ok:
|
|
203
|
-
|
|
202
|
+
for plugin in r.json().get("results", []):
|
|
203
|
+
print(
|
|
204
|
+
f"{plugin['name']}@{plugin['version']}\t{'enabled' if plugin['is_enabled'] else 'not enabled'}"
|
|
205
|
+
)
|
|
204
206
|
else:
|
|
205
|
-
print
|
|
207
|
+
print(f"Status code {r.status_code}: {r.text}")
|
|
206
208
|
raise typer.Exit(1)
|
|
207
209
|
|
|
208
210
|
|
|
@@ -226,16 +228,12 @@ def validate_manifest(
|
|
|
226
228
|
try:
|
|
227
229
|
manifest_json = json.loads(manifest.read_text())
|
|
228
230
|
except json.JSONDecodeError:
|
|
229
|
-
print
|
|
230
|
-
"There was a problem loading the manifest file, please ensure it's valid JSON",
|
|
231
|
-
success=False,
|
|
232
|
-
path=str(plugin_name),
|
|
233
|
-
)
|
|
231
|
+
print("There was a problem loading the manifest file, please ensure it's valid JSON")
|
|
234
232
|
raise typer.Abort()
|
|
235
233
|
|
|
236
234
|
validate_manifest_file(manifest_json)
|
|
237
235
|
|
|
238
|
-
print
|
|
236
|
+
print(f"Plugin '{plugin_name}' has a valid CANVAS_MANIFEST.json file")
|
|
239
237
|
|
|
240
238
|
|
|
241
239
|
def update(
|
|
@@ -262,7 +260,7 @@ def update(
|
|
|
262
260
|
|
|
263
261
|
token = get_or_request_api_token(host)
|
|
264
262
|
|
|
265
|
-
print
|
|
263
|
+
print(f"Updating plugin {name} from {host} with {is_enabled=}, {package=}")
|
|
266
264
|
|
|
267
265
|
binary_package = {"package": open(package, "rb")} if package else None
|
|
268
266
|
|
|
@@ -276,11 +274,12 @@ def update(
|
|
|
276
274
|
headers={"Authorization": f"Bearer {token}"},
|
|
277
275
|
)
|
|
278
276
|
except requests.exceptions.RequestException:
|
|
279
|
-
print
|
|
277
|
+
print(f"Failed to connect to {host}")
|
|
280
278
|
raise typer.Exit(1)
|
|
281
279
|
|
|
282
280
|
if r.status_code == requests.codes.ok:
|
|
283
|
-
print
|
|
281
|
+
print("Plugin successfully updated!")
|
|
282
|
+
|
|
284
283
|
else:
|
|
285
|
-
print
|
|
284
|
+
print(f"Status code {r.status_code}: {r.text}")
|
|
286
285
|
raise typer.Exit(1)
|
|
@@ -7,12 +7,11 @@ import typer
|
|
|
7
7
|
from canvas_cli.apps import plugin
|
|
8
8
|
from canvas_cli.apps.logs import logs as logs_command
|
|
9
9
|
from canvas_cli.utils.context import context
|
|
10
|
-
from canvas_cli.utils.print import print
|
|
11
10
|
|
|
12
11
|
APP_NAME = "canvas_cli"
|
|
13
12
|
|
|
14
13
|
# The main app
|
|
15
|
-
app = typer.Typer(no_args_is_help=True)
|
|
14
|
+
app = typer.Typer(no_args_is_help=True, rich_markup_mode=None, add_completion=False)
|
|
16
15
|
|
|
17
16
|
# Commands
|
|
18
17
|
app.command(short_help="Create a new plugin")(plugin.init)
|
|
@@ -29,7 +28,7 @@ __version__ = importlib.metadata.version("canvas")
|
|
|
29
28
|
def version_callback(value: bool) -> None:
|
|
30
29
|
"""Method called when the `--version` flag is set. Prints the version and exits the CLI."""
|
|
31
30
|
if value:
|
|
32
|
-
print
|
|
31
|
+
print(f"{APP_NAME} Version: {__version__}")
|
|
33
32
|
raise typer.Exit()
|
|
34
33
|
|
|
35
34
|
|
|
@@ -54,11 +53,9 @@ def get_or_create_config_file() -> Path:
|
|
|
54
53
|
|
|
55
54
|
@app.callback()
|
|
56
55
|
def main(
|
|
57
|
-
no_ansi: bool = typer.Option(False, "--no-ansi", help="Disable colorized output"),
|
|
58
56
|
version: Optional[bool] = typer.Option(
|
|
59
57
|
None, "--version", callback=version_callback, is_eager=True
|
|
60
58
|
),
|
|
61
|
-
verbose: bool = typer.Option(False, "--verbose", help="Show extra output"),
|
|
62
59
|
) -> None:
|
|
63
60
|
"""Canvas swiss army knife CLI tool."""
|
|
64
61
|
# Fetch the config file and load our context from it.
|
|
@@ -66,13 +63,6 @@ def main(
|
|
|
66
63
|
|
|
67
64
|
context.load_from_file(config_file)
|
|
68
65
|
|
|
69
|
-
context.no_ansi = no_ansi
|
|
70
|
-
|
|
71
|
-
# Set the --verbose flag
|
|
72
|
-
if verbose:
|
|
73
|
-
context.verbose = verbose
|
|
74
|
-
print.verbose("Verbose mode enabled")
|
|
75
|
-
|
|
76
66
|
|
|
77
67
|
if __name__ == "__main__":
|
|
78
68
|
app()
|
|
@@ -41,12 +41,6 @@ class CLIContext:
|
|
|
41
41
|
# The default host to use for requests
|
|
42
42
|
_default_host: str | None = None
|
|
43
43
|
|
|
44
|
-
# Print extra output
|
|
45
|
-
_verbose: bool = False
|
|
46
|
-
|
|
47
|
-
# If True no colored output is shown
|
|
48
|
-
_no_ansi: bool = False
|
|
49
|
-
|
|
50
44
|
# When the most recently requested api_token will expire
|
|
51
45
|
_token_expiration_date: str | None = None
|
|
52
46
|
|
|
@@ -60,7 +54,7 @@ class CLIContext:
|
|
|
60
54
|
fn(self, *args, **kwargs)
|
|
61
55
|
value = args[0]
|
|
62
56
|
|
|
63
|
-
print
|
|
57
|
+
print(f"Storing {fn.__name__}={value} in the config file")
|
|
64
58
|
|
|
65
59
|
self._config_file[fn.__name__] = value
|
|
66
60
|
with open(self._config_file_path, "w") as f:
|
|
@@ -100,24 +94,6 @@ class CLIContext:
|
|
|
100
94
|
def default_host(self, new_default_host: str | None) -> None:
|
|
101
95
|
self._default_host = new_default_host
|
|
102
96
|
|
|
103
|
-
@property
|
|
104
|
-
def verbose(self) -> bool:
|
|
105
|
-
"""Enable extra output."""
|
|
106
|
-
return self._verbose
|
|
107
|
-
|
|
108
|
-
@verbose.setter
|
|
109
|
-
def verbose(self, new_verbose: bool) -> None:
|
|
110
|
-
self._verbose = new_verbose
|
|
111
|
-
|
|
112
|
-
@property
|
|
113
|
-
def no_ansi(self) -> bool:
|
|
114
|
-
"""If set removes colorized output."""
|
|
115
|
-
return self._no_ansi
|
|
116
|
-
|
|
117
|
-
@no_ansi.setter
|
|
118
|
-
def no_ansi(self, new_no_ansi: bool) -> None:
|
|
119
|
-
self._no_ansi = new_no_ansi
|
|
120
|
-
|
|
121
97
|
@property
|
|
122
98
|
def token_expiration_date(self) -> str | None:
|
|
123
99
|
"""When the most recently requested api_token will expire."""
|
|
@@ -3,7 +3,6 @@ from builtins import print as builtin_print
|
|
|
3
3
|
from typing import Any
|
|
4
4
|
|
|
5
5
|
from requests import Response
|
|
6
|
-
from rich import print as rich_print
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
class Printer:
|
|
@@ -39,22 +38,9 @@ class Printer:
|
|
|
39
38
|
|
|
40
39
|
Printer._default_print(json.dumps(status))
|
|
41
40
|
|
|
42
|
-
@staticmethod
|
|
43
|
-
def verbose(*args: Any) -> None:
|
|
44
|
-
"""Print text only if `verbose` is set in context."""
|
|
45
|
-
from canvas_cli.utils.context import context
|
|
46
|
-
|
|
47
|
-
if context.verbose:
|
|
48
|
-
Printer._default_print(*args)
|
|
49
|
-
|
|
50
41
|
@staticmethod
|
|
51
42
|
def _default_print(*args: Any) -> None:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if context.no_ansi:
|
|
55
|
-
builtin_print(*args)
|
|
56
|
-
else:
|
|
57
|
-
rich_print(*args)
|
|
43
|
+
builtin_print(*args)
|
|
58
44
|
|
|
59
45
|
|
|
60
46
|
print = Printer()
|
|
@@ -8,5 +8,9 @@ class BaseProtocol:
|
|
|
8
8
|
|
|
9
9
|
def __init__(self, event, secrets=None) -> None:
|
|
10
10
|
self.event = event
|
|
11
|
-
|
|
11
|
+
try:
|
|
12
|
+
self.context = json.loads(event.context)
|
|
13
|
+
except ValueError:
|
|
14
|
+
self.context = {}
|
|
15
|
+
self.target = event.target
|
|
12
16
|
self.secrets = secrets or {}
|
|
@@ -37,7 +37,7 @@ license = "MIT"
|
|
|
37
37
|
name = "canvas"
|
|
38
38
|
packages = [{include = "canvas_cli"}, {include = "canvas_sdk"}]
|
|
39
39
|
readme = "README.md"
|
|
40
|
-
version = "0.1.
|
|
40
|
+
version = "0.1.10"
|
|
41
41
|
|
|
42
42
|
[tool.poetry.dependencies]
|
|
43
43
|
cookiecutter = "*"
|
|
@@ -48,12 +48,12 @@ keyring = "*"
|
|
|
48
48
|
pydantic = "^2.6.1"
|
|
49
49
|
python = ">=3.11,<3.13"
|
|
50
50
|
python-dotenv = "^1.0.1"
|
|
51
|
+
redis = "^5.0.4"
|
|
51
52
|
requests = "*"
|
|
52
53
|
restrictedpython = "^7.1"
|
|
53
54
|
statsd = "^4.0.1"
|
|
54
55
|
typer = {extras = ["all"], version = "*"}
|
|
55
56
|
websocket-client = "^1.7.0"
|
|
56
|
-
redis = "^5.0.4"
|
|
57
57
|
|
|
58
58
|
[tool.poetry.group.dev.dependencies]
|
|
59
59
|
grpcio-tools = "^1.60.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|