canvas 0.3.1__py3-none-any.whl → 0.5.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.

Potentially problematic release.


This version of canvas might be problematic. Click here for more details.

Files changed (76) hide show
  1. {canvas-0.3.1.dist-info → canvas-0.5.0.dist-info}/METADATA +4 -2
  2. {canvas-0.3.1.dist-info → canvas-0.5.0.dist-info}/RECORD +76 -37
  3. canvas_cli/apps/emit/emit.py +1 -1
  4. canvas_cli/apps/logs/logs.py +6 -6
  5. canvas_cli/apps/plugin/plugin.py +11 -7
  6. canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/protocols/my_protocol.py +3 -7
  7. canvas_cli/tests.py +12 -5
  8. canvas_cli/utils/context/context.py +2 -2
  9. canvas_cli/utils/context/tests.py +5 -4
  10. canvas_cli/utils/print/print.py +1 -1
  11. canvas_cli/utils/print/tests.py +2 -3
  12. canvas_generated/messages/events_pb2.py +2 -2
  13. canvas_generated/messages/events_pb2.pyi +112 -0
  14. canvas_sdk/base.py +2 -1
  15. canvas_sdk/commands/base.py +25 -25
  16. canvas_sdk/commands/tests/protocol/tests.py +5 -3
  17. canvas_sdk/commands/tests/test_utils.py +8 -44
  18. canvas_sdk/commands/tests/unit/tests.py +3 -3
  19. canvas_sdk/data/client.py +1 -1
  20. canvas_sdk/effects/banner_alert/tests.py +12 -4
  21. canvas_sdk/effects/patient_chart_summary_configuration.py +1 -0
  22. canvas_sdk/effects/protocol_card/protocol_card.py +1 -1
  23. canvas_sdk/effects/protocol_card/tests.py +2 -2
  24. canvas_sdk/protocols/clinical_quality_measure.py +1 -0
  25. canvas_sdk/utils/http.py +2 -2
  26. canvas_sdk/v1/data/common.py +46 -0
  27. canvas_sdk/v1/data/detected_issue.py +52 -0
  28. canvas_sdk/v1/data/imaging.py +102 -0
  29. canvas_sdk/v1/data/lab.py +182 -10
  30. canvas_sdk/v1/data/patient.py +4 -1
  31. canvas_sdk/v1/data/protocol_override.py +58 -0
  32. canvas_sdk/v1/data/questionnaire.py +4 -2
  33. canvas_sdk/value_set/__init__.py +0 -0
  34. canvas_sdk/value_set/tests/test_value_sets.py +9 -6
  35. canvas_sdk/value_set/v2022/__init__.py +0 -0
  36. canvas_sdk/value_set/v2022/intervention.py +0 -24
  37. canvas_sdk/value_set/value_set.py +24 -21
  38. plugin_runner/authentication.py +3 -7
  39. plugin_runner/plugin_runner.py +106 -33
  40. plugin_runner/sandbox.py +23 -9
  41. plugin_runner/tests/__init__.py +0 -0
  42. plugin_runner/tests/data/plugins/.gitkeep +0 -0
  43. plugin_runner/tests/fixtures/plugins/example_plugin/CANVAS_MANIFEST.json +29 -0
  44. plugin_runner/tests/fixtures/plugins/example_plugin/README.md +12 -0
  45. plugin_runner/tests/fixtures/plugins/example_plugin/__init__.py +0 -0
  46. plugin_runner/tests/fixtures/plugins/example_plugin/protocols/__init__.py +0 -0
  47. plugin_runner/tests/fixtures/plugins/example_plugin/protocols/my_protocol.py +18 -0
  48. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/CANVAS_MANIFEST.json +29 -0
  49. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/README.md +12 -0
  50. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/other_module/__init__.py +0 -0
  51. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/other_module/base.py +3 -0
  52. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/protocols/__init__.py +0 -0
  53. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/protocols/my_protocol.py +18 -0
  54. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/CANVAS_MANIFEST.json +29 -0
  55. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/README.md +12 -0
  56. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/other_module/__init__.py +0 -0
  57. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/other_module/base.py +6 -0
  58. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/protocols/__init__.py +0 -0
  59. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/protocols/my_protocol.py +18 -0
  60. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/CANVAS_MANIFEST.json +29 -0
  61. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/README.md +12 -0
  62. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/other_module/__init__.py +0 -0
  63. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/other_module/base.py +8 -0
  64. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/protocols/__init__.py +0 -0
  65. plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/protocols/my_protocol.py +18 -0
  66. plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/CANVAS_MANIFEST.json +29 -0
  67. plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/README.md +12 -0
  68. plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/other_module/__init__.py +0 -0
  69. plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/other_module/base.py +3 -0
  70. plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/protocols/__init__.py +0 -0
  71. plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/protocols/my_protocol.py +18 -0
  72. plugin_runner/tests/test_plugin_runner.py +208 -0
  73. plugin_runner/tests/test_sandbox.py +113 -0
  74. settings.py +23 -0
  75. {canvas-0.3.1.dist-info → canvas-0.5.0.dist-info}/WHEEL +0 -0
  76. {canvas-0.3.1.dist-info → canvas-0.5.0.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: canvas
3
- Version: 0.3.1
3
+ Version: 0.5.0
4
4
  Summary: SDK to customize event-driven actions in your Canvas instance
5
5
  License: MIT
6
6
  Author: Canvas Team
@@ -13,6 +13,8 @@ Classifier: Programming Language :: Python :: 3.12
13
13
  Requires-Dist: cookiecutter
14
14
  Requires-Dist: cron-converter (>=1.2.1,<2.0.0)
15
15
  Requires-Dist: django (>=5.1.1,<6.0.0)
16
+ Requires-Dist: django-stubs[compatible-mypy] (>=5.1.1,<6.0.0)
17
+ Requires-Dist: env-tools (>=2.2.0,<3.0.0)
16
18
  Requires-Dist: gql[all] (>=3.5.0,<4.0.0)
17
19
  Requires-Dist: grpcio (>=1.60.1,<2.0.0)
18
20
  Requires-Dist: ipython (>=8.21.0,<9.0.0)
@@ -21,7 +23,7 @@ Requires-Dist: keyring
21
23
  Requires-Dist: protobuf (>=4.25.3,<5.0.0)
22
24
  Requires-Dist: psycopg[binary] (>=3.2.2,<4.0.0)
23
25
  Requires-Dist: pydantic (>=2.6.1,<3.0.0)
24
- Requires-Dist: pyjwt (==2.9.0)
26
+ Requires-Dist: pyjwt (==2.10.0)
25
27
  Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
26
28
  Requires-Dist: redis (>=5.0.4,<6.0.0)
27
29
  Requires-Dist: requests
@@ -4,7 +4,7 @@ canvas_cli/apps/auth/__init__.py,sha256=gIwJ2qWvRlLqbiRkudrGqTKV-orlb8OTkG487qoR
4
4
  canvas_cli/apps/auth/tests.py,sha256=WK7hSLTK95gEweMRaj3RdPC-qSwjnuulxMUg6D0bY_k,4528
5
5
  canvas_cli/apps/auth/utils.py,sha256=IH5oZB3pdlb4_FRfCZKkNTncx_kdKagpiBqlhtM8h2U,5434
6
6
  canvas_cli/apps/emit/__init__.py,sha256=Fvv6SIbeGV2S5NkigQtamcRwJXIT1n7UcM-wrQoYsRQ,64
7
- canvas_cli/apps/emit/emit.py,sha256=zM0mRimaaU7zqUZvIGFoyPmiljKcsxsNIHRRGyUxnss,2652
7
+ canvas_cli/apps/emit/emit.py,sha256=Dj6k9uzL9fF1CbZ_4UYj_bIqCJn_hPBh9iWj2GG2fho,2623
8
8
  canvas_cli/apps/emit/event_fixtures/ALLERGY_INTOLERANCE_CREATED.ndjson,sha256=C0mKBU_zP19WAn3EVRArQ7Pl3FBCyHXOmE9x7ZIKTss,110
9
9
  canvas_cli/apps/emit/event_fixtures/ALLERGY_INTOLERANCE_UPDATED.ndjson,sha256=P2TpFVC13fgg9fFPjfY-NX-hYdXLN-jOE0fmwDY9aMk,110
10
10
  canvas_cli/apps/emit/event_fixtures/APPOINTMENT_CANCELED.ndjson,sha256=5E0JNrfdJfVlW24xkwanHkxUvbMukcdmYpv4OvLqRkI,103
@@ -63,9 +63,9 @@ canvas_cli/apps/emit/event_fixtures/TASK_UPDATED.ndjson,sha256=5K0x5fjO7fwDVvvpp
63
63
  canvas_cli/apps/emit/event_fixtures/VITAL_SIGN_CREATED.ndjson,sha256=p5XQozktqGA9-C6HDXJ3cxDmrYe4p705WdrWE-2R9Dk,1414
64
64
  canvas_cli/apps/emit/event_fixtures/VITAL_SIGN_UPDATED.ndjson,sha256=Er0aUWIYkqbL9JdCaiNBuzizuHiOmFQr5Q2uYTtWj8I,36764
65
65
  canvas_cli/apps/logs/__init__.py,sha256=ehY9SRb6nBw81xZF50yyBlUZJtNR2VeVSNI5sFuWJ7o,64
66
- canvas_cli/apps/logs/logs.py,sha256=Ixue8Z1wgxABunVIx6TzmsH6oZ0FPf2H51Sd3nFUnAI,1969
66
+ canvas_cli/apps/logs/logs.py,sha256=ISKRGtphc-fXlLwwsti48rJNs-R9GFjosihao_B29g4,1974
67
67
  canvas_cli/apps/plugin/__init__.py,sha256=G_nLsu6cdko5OjatnbqUyEboGcNlGGLwpZmCBxMKdfo,236
68
- canvas_cli/apps/plugin/plugin.py,sha256=9U-lvAVdPbHdUKkOaYO2OwjwY-XHDB9oHFjkTkJyV38,14228
68
+ canvas_cli/apps/plugin/plugin.py,sha256=srH8hUQ_i5TFTQnvNw2-Btkvg7UvTjVZSMRB0LlgkLA,14352
69
69
  canvas_cli/apps/plugin/tests.py,sha256=nH-LunSfkpFIvcONVeJxr8JQ-z5vZmuZFaZJanB2m2s,2661
70
70
  canvas_cli/apps/run_plugins/__init__.py,sha256=iAMgX_6D3CdjQodGx_azwhSjouaxquOm8Z8QVXnlTFE,117
71
71
  canvas_cli/apps/run_plugins/run_plugins.py,sha256=qsf6-UhFAZpIL-1C50fzSoIwXMsZISxg2fxzM46UHTA,384
@@ -75,15 +75,15 @@ canvas_cli/templates/plugins/default/cookiecutter.json,sha256=dWEB3wJ8U4bko8jX26
75
75
  canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/CANVAS_MANIFEST.json,sha256=9N0u5hN0GqjPvUh_B3YHtvyntEvxUGbInbQeprU0TS0,787
76
76
  canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/README.md,sha256=3QKoJQq3YmdplGnDOBMsLCJ3Ya1_aKjoz-QiWc4QfjA,291
77
77
  canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
- canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/protocols/my_protocol.py,sha256=liFrvx-5NRfeODOBbRNB1Cg0P04UvxpAkkLtAiEmckQ,2252
79
- canvas_cli/tests.py,sha256=64aAOgHrC09UeWqsFo__K3zmSHrXHCtMJAc1rE7ziTc,5916
78
+ canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/protocols/my_protocol.py,sha256=vVV2P59dLZGdWUmkxgeepAjTWOVgag1jSqP9EYLB24I,2240
79
+ canvas_cli/tests.py,sha256=2TlU3a6JOdZ-IZ3pO2JLiG2NL8MxGL8kpaSeySoozIg,6162
80
80
  canvas_cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
81
81
  canvas_cli/utils/context/__init__.py,sha256=HhYvI-hydP0mV18nJiU7uo5gk0yN7EYNgouxieoGDOE,102
82
- canvas_cli/utils/context/context.py,sha256=Q-MniBuvzDKhLODOOrOVdaRTLz9Lp0m7cAz-i6YRRpA,5138
83
- canvas_cli/utils/context/tests.py,sha256=aNmAggwvjKV-1WrgIvp66M46EX2QCbbHmity3bSCBTg,4211
82
+ canvas_cli/utils/context/context.py,sha256=RIDGCQPLLtelzhXperboouSwYXSNBjLDtq18kH4nr1c,5153
83
+ canvas_cli/utils/context/tests.py,sha256=fbnNm_4ZpzFdBGZtzR90mjHa5tMosEE6VLHrwcfl4-k,4266
84
84
  canvas_cli/utils/print/__init__.py,sha256=zkRiQCUhPIB3wNGeJ1Hwfd12zJyvbRRiWqequJORvdE,88
85
- canvas_cli/utils/print/print.py,sha256=GejLUtC5hfWuKHUBapyEwVHNIaIILxW60_xBQchiGpI,1420
86
- canvas_cli/utils/print/tests.py,sha256=4kqp_uMpUUjSXokD_Hxs2aMyx50_JzGABAQoNC4XTrM,2376
85
+ canvas_cli/utils/print/print.py,sha256=p3Z47LphrV1-lI3RbU_0P8dtUgs9EJjZLDwv-hbwLG8,1401
86
+ canvas_cli/utils/print/tests.py,sha256=rJnMlpMOMVkPHiFE2mJ_KNbpLKDK5qA8ZdwUvYxaIAU,2367
87
87
  canvas_cli/utils/urls/__init__.py,sha256=08hlrQhQ1pKBjlIRaC0j53IkgK723jfK8-j3djvR0ko,81
88
88
  canvas_cli/utils/urls/tests.py,sha256=opXDF2i3lXTdsKJ7ywIRzWDDzZ5KAO0JbGIR3hbJdoE,407
89
89
  canvas_cli/utils/urls/urls.py,sha256=KwWTh5ERrEsZEvdBrZpZB71xtyWkDuglpXUbycWmBOo,798
@@ -94,8 +94,8 @@ canvas_cli/utils/validators/validators.py,sha256=lrUBQ0sF7seTe_pNGsNgASdr2BGp6g-
94
94
  canvas_generated/messages/effects_pb2.py,sha256=2ie5j_MhD4boYsIZiDIWE30xSCXl4nunXcuQcMUkzTY,7800
95
95
  canvas_generated/messages/effects_pb2.pyi,sha256=ecDvQX8UYu0rb-4g6QVSgNWMT9v2WOJwiBdJ0JpU-IU,13349
96
96
  canvas_generated/messages/effects_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
97
- canvas_generated/messages/events_pb2.py,sha256=lI_tOobXO_vzNq9pH1AK1t-sAzV5HYzxdeP3p_3WcJA,33380
98
- canvas_generated/messages/events_pb2.pyi,sha256=O-43KWoy8NwWkwUZu9CBbYhlnTaPtwk41dKUkHiOU3Q,59296
97
+ canvas_generated/messages/events_pb2.py,sha256=VVjlxGu30IiOAUGXDkA3soJKH9DJ09z4N_3FkrPuPK8,36992
98
+ canvas_generated/messages/events_pb2.pyi,sha256=OA8NI0WQrr8qOWjWtwjyIj1m90-HHwUwlNGwUKwS6Ho,65868
99
99
  canvas_generated/messages/events_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
100
100
  canvas_generated/messages/plugins_pb2.py,sha256=j2yt9uoSlVMtWg-cAoOmxiT-XWbBrqqCBZXOxEz7z4g,1271
101
101
  canvas_generated/messages/plugins_pb2.pyi,sha256=G1seqytP8GlJJh-AL2CJ0VyUNlReEvK61C-Oh8QuGiE,501
@@ -104,9 +104,9 @@ canvas_generated/services/plugin_runner_pb2.py,sha256=RfAo_imYoSuoexq-1IHhMhXZgQ
104
104
  canvas_generated/services/plugin_runner_pb2.pyi,sha256=1w-Pa4k7HtlmQAr7B6sgV64zdZplBKQKHN-S8bjwO3w,265
105
105
  canvas_generated/services/plugin_runner_pb2_grpc.py,sha256=EzJJVkP_AZ3dwBA7OxUito0NSalRmjjg8q9TZ_P18ww,4549
106
106
  canvas_sdk/__init__.py,sha256=d7V1Qsp4hSqp8opmvqp-0J33uibArUjwENMfzSDAdZg,102
107
- canvas_sdk/base.py,sha256=DvkCWdeSEFKJGtYmbI1CCGGovGBdOrXz5XnZ88HeR3g,1811
107
+ canvas_sdk/base.py,sha256=tcmP3zxp24kAoplT-jqrIlSpiYsJ6qRMNY-HiuJYFGc,1834
108
108
  canvas_sdk/commands/__init__.py,sha256=ApJy2i8IRCL2YFUumk1q-YihLL2YcmLYKKiWFK04evY,2365
109
- canvas_sdk/commands/base.py,sha256=Z5JN793VSoLvaVqSmyHs4extxIMoKB5XR3jG38wx2BE,5147
109
+ canvas_sdk/commands/base.py,sha256=lc6OizuXTB5mDzGVpYGx9nz_OrJUKBaffmmCPxs2B0s,5155
110
110
  canvas_sdk/commands/commands/allergy.py,sha256=_S0tY43sErRlTeUGCC6Thb8gMSD_JiOmRSFdLaDlr48,1296
111
111
  canvas_sdk/commands/commands/assess.py,sha256=IjsvkhzKinRaykMRzbnk6G4JAkzDhyqGG6ZvjDhNAuE,1723
112
112
  canvas_sdk/commands/commands/close_goal.py,sha256=RTmi8fGPEEag8YSrlsPn7sy9Y-WymVuU8IWpXRKgNjg,792
@@ -133,15 +133,15 @@ canvas_sdk/commands/commands/update_goal.py,sha256=ddvxlDnoTm5k-G5aJ-pW2fMIC-s5K
133
133
  canvas_sdk/commands/commands/vitals.py,sha256=ZmAok_oMy5Txv52cEmwnLWi0ET9BLmRIMgpbjtMTa4c,3155
134
134
  canvas_sdk/commands/constants.py,sha256=eYzVI3wKBQUfRbfDm8CoGaKWmkBOwtDeeL91znK6a5A,341
135
135
  canvas_sdk/commands/tests/protocol/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
136
- canvas_sdk/commands/tests/protocol/tests.py,sha256=Pke6UTH3hLXUevWsG0U2KKH3wWxY1KKrZ4-5iFCdCws,1464
136
+ canvas_sdk/commands/tests/protocol/tests.py,sha256=AZrN5vk082ZfZzoJtY-ckezC4acofKL5CJZ_EXg3l9s,1506
137
137
  canvas_sdk/commands/tests/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
138
138
  canvas_sdk/commands/tests/schema/tests.py,sha256=ggegssIRQK1ACn7oFp31tCsq19reUfsAvM9OL7mh67s,3505
139
- canvas_sdk/commands/tests/test_utils.py,sha256=6fXsyZt9eyHNgOKoW3kpAxJA62WnrBA0_WmMc1SlByc,10411
139
+ canvas_sdk/commands/tests/test_utils.py,sha256=0ulIUaIx-srwA_Pbuyx8--XW85Enc9oPlqchutt56UU,9622
140
140
  canvas_sdk/commands/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
141
- canvas_sdk/commands/tests/unit/tests.py,sha256=2AG_YRjFIcgTwLBnWv4OJzsxJmVTXm51APAxP-qIffk,9673
141
+ canvas_sdk/commands/tests/unit/tests.py,sha256=SAgB_gaO3ah69RKgMjp4XzO6WnQjeNR9awOE8BR7IkA,9697
142
142
  canvas_sdk/data/__init__.py,sha256=dmqlcw11-0DCbH2lOebwBCq6njSQ6BDhxygmncUgZRs,28
143
143
  canvas_sdk/data/base.py,sha256=XgVAOoT_sOZtavJn0Q5WxRmeZWborvpAuSP2ZbV9cbI,868
144
- canvas_sdk/data/client.py,sha256=hLOVEDd4NAZsOLBcFQIZ_nttWo7EDRWtgNnZAuOzAyA,2105
144
+ canvas_sdk/data/client.py,sha256=bsmBBORvbFzdwRtzhd7zxKPZo3VJn4Fsnw2isCPivP0,2094
145
145
  canvas_sdk/data/patient.py,sha256=dkfv59VIOyDfHr2tdFcwFikPDDGjrIm1XrVtEh82XyQ,167
146
146
  canvas_sdk/data/staff.py,sha256=Po-NH2UdGTTP4LnUzfItfzriJKdul-2Cd31oq9uFHQE,210
147
147
  canvas_sdk/data/task.py,sha256=UpjWjB1QqClR83zeqFcM7b7gg2w0NjfzNKsWrgShN_s,1995
@@ -149,23 +149,23 @@ canvas_sdk/effects/__init__.py,sha256=oChQi5y_8mK2zDiNMwWYp6CaQX1_zbmwXILPF7iSt-
149
149
  canvas_sdk/effects/banner_alert/__init__.py,sha256=8z5l9rwonKEcRkvD5q4DWvHPYhKJzwyGuUYoUNKYwX4,158
150
150
  canvas_sdk/effects/banner_alert/add_banner_alert.py,sha256=RhMEIc62T5rLO_FltGvOq0XVU_wXIdCcBpxfaQeqCJY,1497
151
151
  canvas_sdk/effects/banner_alert/remove_banner_alert.py,sha256=9oLetlX_22B3iRwVZqB4IpA9e9YqZ_1cmWV4vJRNDmE,559
152
- canvas_sdk/effects/banner_alert/tests.py,sha256=t0SrJGeW1WpCXFIdA7AzslqGR-4iU0ohbi7hzD9lmGg,7472
152
+ canvas_sdk/effects/banner_alert/tests.py,sha256=idaXkAAUm_pnquXn1ZbWAPmoTf16MsbXrnM6cpaJZDQ,7712
153
153
  canvas_sdk/effects/base.py,sha256=cyTEQ4p3IxZ3mPu6Ancr4Y7RcrVirWBbNUs9V6g7Odc,674
154
- canvas_sdk/effects/patient_chart_summary_configuration.py,sha256=VdrQgfTJpfqM1ll0nLJisVRQ5HZ-D9F70lHfZOOSeCI,1148
154
+ canvas_sdk/effects/patient_chart_summary_configuration.py,sha256=_Gx7UIp4NLaSYYLLcBSOjtOD4Skqot_kt_x8zI3Ccwo,1184
155
155
  canvas_sdk/effects/protocol_card/__init__.py,sha256=ESzUYajBBmcTAad2PIwHuV3SgGj4B9JHtf9uop_V4YA,88
156
- canvas_sdk/effects/protocol_card/protocol_card.py,sha256=vGqwGGDLmftnIAgLqrhGaMUPg1VX6LWUBoNoVMsvaPc,2443
157
- canvas_sdk/effects/protocol_card/tests.py,sha256=KQhGFWcAlOzEyGYnlRgloMiutdGAv39SITKmcc6WtRg,6413
156
+ canvas_sdk/effects/protocol_card/protocol_card.py,sha256=gn-ArEiYWoSG4IDE-at2oaPCbSIrNxz_wpucYaMNC5M,2427
157
+ canvas_sdk/effects/protocol_card/tests.py,sha256=fdFPkORW7e_0FpSlxBQWUPQwF6-JQeBG1g3R7MKj9Jc,6419
158
158
  canvas_sdk/events/__init__.py,sha256=JGZ-3uf0Luzr4kg5UqduupD4w6B2WVEgQ9WlcoMaPwE,81
159
159
  canvas_sdk/handlers/__init__.py,sha256=VVz2_Xyb9720R2MZmSbGPG0T8u2a5u6zSDkWlwiJZv4,49
160
160
  canvas_sdk/handlers/base.py,sha256=7kw95-nYOsphP2_dVoJxBvi2RsuUpwBo5RcKvo924Yw,599
161
161
  canvas_sdk/handlers/cron_task.py,sha256=Q4_D3bDKE5hyEpCf0JnGSgZlnLh_g9RSP3oEfIuLJ9Y,945
162
162
  canvas_sdk/protocols/__init__.py,sha256=t9PD9lCQbWPT1tW6s8w8J5nK-Hb4i5MLCSKnX2Q3eow,132
163
163
  canvas_sdk/protocols/base.py,sha256=Tn2PrQrP-idp8qGx6HAVhaal0FEKcf7x31zDPpBAl1s,571
164
- canvas_sdk/protocols/clinical_quality_measure.py,sha256=3uA3gQBGcLNfg0GpBsS5_RIC4fzoaUkMKwklHjMys0s,1183
164
+ canvas_sdk/protocols/clinical_quality_measure.py,sha256=--X78dgGKrHz29GZlFypKYa2vwykHLg6kAwBpQgpJoE,1219
165
165
  canvas_sdk/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
166
166
  canvas_sdk/utils/__init__.py,sha256=sFuhqcWvXb2-33FOuXZgWuUeC5jZL2MDoqjGoQZGwd8,60
167
167
  canvas_sdk/utils/db.py,sha256=0AO5bhu-k9OsAHpXe1RHzyDZnBGHUEzrv8-vYtTIoeA,592
168
- canvas_sdk/utils/http.py,sha256=1f50xdXdJp_DWIpb0uXKeCvLVS8-VDYWG5NVSXsYMxo,2225
168
+ canvas_sdk/utils/http.py,sha256=6t2h2ULHcX3eHCpUuHl7rqjLvHg794O6ubDxgzd_2Yg,2240
169
169
  canvas_sdk/utils/stats.py,sha256=sJhIW_IssUVefQN6rrUAt1P0KvVIUIYcnpZlMHLibNA,732
170
170
  canvas_sdk/utils/tests.py,sha256=t3MScbIfzXkQttMIvj0dRzJlFVS8LFU8WgWRrChM-H0,1931
171
171
  canvas_sdk/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -173,15 +173,21 @@ canvas_sdk/v1/data/__init__.py,sha256=LWAcICOx4fWea_lp_yNt0UIuhgjZMoNOaWx-7ZuM-d
173
173
  canvas_sdk/v1/data/allergy_intolerance.py,sha256=KJg7UR8BJMuASWL5zXZ57JTmC0TQT7FAnODPvdq2mFg,2093
174
174
  canvas_sdk/v1/data/base.py,sha256=6JgLZsl9NRRS6s9-jjJM8Opxk_SI_sGkyokKIGPCoWI,3504
175
175
  canvas_sdk/v1/data/command.py,sha256=z9LHw95Vq8efZE5y9r-Ei-Yzt8qj-o-BE3x9BBb4yPQ,945
176
+ canvas_sdk/v1/data/common.py,sha256=9PiJ6oCPsvCvKBHtShIg0cW5Sr8CrnM9te-m2DYJB-g,1590
176
177
  canvas_sdk/v1/data/condition.py,sha256=hJ3APJvRh-dKYwujujdo5kugnc6YXBES7YpUIKUTjhI,1525
178
+ canvas_sdk/v1/data/detected_issue.py,sha256=c1rKZuPV_tTp_1yDJJa88gIsixpPV_F-a3eooje8BW8,1710
177
179
  canvas_sdk/v1/data/device.py,sha256=uxeQRT8ljzBmDwsARFDB9MZKAVAKOA-pu4nAa6fcHeU,1655
178
- canvas_sdk/v1/data/lab.py,sha256=Ni_yTcye_GeDZGTVFU3ENHBA1LzOqrO1-B6Rd8Vk5Bw,3754
180
+ canvas_sdk/v1/data/imaging.py,sha256=z6CtVcBYv8EL7fxzT0pWPUuh1mt5XFPlRDNNbOjvLng,4303
181
+ canvas_sdk/v1/data/lab.py,sha256=nGV2FGDtnj7NcO8WS5LRXv5JUiLjuWMtm0i-PUNsKLk,10313
179
182
  canvas_sdk/v1/data/medication.py,sha256=XbV_iYgt40n8Q1IcVPtsinW2v-VJEms4T13cFNquBRE,1798
180
183
  canvas_sdk/v1/data/observation.py,sha256=BftaK7tOZaTlfUKoTH_A-X23J4DUFRVWpvZhkBJ1DJg,3710
181
- canvas_sdk/v1/data/patient.py,sha256=6tMNSpuzYCe_wZ-7rogz_pPVtT0KN3_nHW00_0LMPuI,1837
182
- canvas_sdk/v1/data/questionnaire.py,sha256=kG707mDOLbvpZYdK7WyVUlaGK_0XySi2sgRwAHvhdsE,6773
184
+ canvas_sdk/v1/data/patient.py,sha256=YGlp13cSNQHDtUJYTU37zisF94ZEKNYAlc2TJAmhdB8,1930
185
+ canvas_sdk/v1/data/protocol_override.py,sha256=mUEcA7_9VkGsDmxrOxJ1eT8XVG0j8PHkd8JmQN4P3zM,1837
186
+ canvas_sdk/v1/data/questionnaire.py,sha256=wZNj8wg5aEThrHvA6-Oq5USnViyoeYGlcD5cjNmiULM,6899
183
187
  canvas_sdk/v1/data/user.py,sha256=DmA8fNNGwiNOmuR-RYxQw1NpxN5yYhgwtRtRBRJ_22g,309
184
- canvas_sdk/value_set/tests/test_value_sets.py,sha256=fl-E1vJN_wnWcr88atoK83N_muX-HrZoRj_aZTl9GpY,2655
188
+ canvas_sdk/value_set/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
189
+ canvas_sdk/value_set/tests/test_value_sets.py,sha256=by9_pOl-8cvwBt_y1HSqf6sP8RBsh9XjRkLMVz7caWo,2804
190
+ canvas_sdk/value_set/v2022/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
185
191
  canvas_sdk/value_set/v2022/adverse_event.py,sha256=8zsNFBsLDRY0mrPomzogD-W15xyo2CFFkiEcT2ruGCg,1032
186
192
  canvas_sdk/value_set/v2022/allergy.py,sha256=n_P8Aqso5M6spTsatp4K4hzlbwaC3rjUBZs2bZsFVVg,11132
187
193
  canvas_sdk/value_set/v2022/assessment.py,sha256=a9hoSxz_VLhfWJp-QrvIUmzSf_cK7x5Da7JsNapg17U,8342
@@ -192,25 +198,58 @@ canvas_sdk/value_set/v2022/diagnostic_study.py,sha256=wo4AQu2p5X51HZ3RsbU5NhUpgv
192
198
  canvas_sdk/value_set/v2022/encounter.py,sha256=PxOkkob8ggpDxKfKG9EtmQQ2teGWCTOeX7_5IJqLiZI,370965
193
199
  canvas_sdk/value_set/v2022/immunization.py,sha256=dYPWL2Un1HTUrjKZTh_MBPVmU2ImtMXVaMqVRKP_7MA,13189
194
200
  canvas_sdk/value_set/v2022/individual_characteristic.py,sha256=1NZI2r4-9x2qTbYTkjUOAU9PgvMOBB3cpddHFr7msaU,13198
195
- canvas_sdk/value_set/v2022/intervention.py,sha256=ZULGA6OhrRv4jLDhTD2z1rB92TvjUHY43rp6tanq3hM,79792
201
+ canvas_sdk/value_set/v2022/intervention.py,sha256=1N0I6pE-RoBgqtQtlBWwTiVYk2ztobUK1TTl1EpKgH4,78653
196
202
  canvas_sdk/value_set/v2022/laboratory_test.py,sha256=x-o7SAjYw5sS9x8tGPcYUg03L_mKxxDu0b6LJsnjmQc,77876
197
203
  canvas_sdk/value_set/v2022/medication.py,sha256=L1yNzrwD2nUox8F6x8RSKhmFsn9VcFbFEy1nM7AHRis,316430
198
204
  canvas_sdk/value_set/v2022/physical_exam.py,sha256=C5PfLR4YB6pB_0wIy6Wfocyso5a9wuwGoKj84k_jR-U,7645
199
205
  canvas_sdk/value_set/v2022/procedure.py,sha256=MA1yBHJskzGyp0nypzTwrR6u4pxZTo20Iv25W4FOIjM,367721
200
206
  canvas_sdk/value_set/v2022/symptom.py,sha256=4-ouetYI8soAAZy9Gq8AXBiqTfJjdgfZgWZPhBE-Ing,9384
201
- canvas_sdk/value_set/value_set.py,sha256=1SID9g4M6BsfVLNawI-96Tu33mAFGOj4wwHOinPzXdM,3528
207
+ canvas_sdk/value_set/value_set.py,sha256=t5KqpDCZoHFT9UDqQ6uolZLQlOPHVPldbTwYyNcBiHQ,3788
202
208
  canvas_sdk/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
203
209
  logger/__init__.py,sha256=9o2iRCjzFEhfULgXvrrECRFK-4IslWJTqKKjTCEUbq8,61
204
210
  logger/logger.py,sha256=axf7UffBJtETjwDCtmi1IaaJKsvcFj8zaLfouGsq68A,1847
205
211
  plugin_runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
206
- plugin_runner/authentication.py,sha256=_lChLl8XMqDME6NlnXm6S6-9LUac4poE5XU1YTJWldg,1236
207
- plugin_runner/plugin_runner.py,sha256=YTxW9neu0YSGydXbONgNxMTtyAi-szbbPColdV71RVs,11389
212
+ plugin_runner/authentication.py,sha256=SDPso2AogtLAV_H0LuMDp99IMZuF3oTq-Q_AXAvJ8uc,1116
213
+ plugin_runner/plugin_runner.py,sha256=Ae7ApJLeV_wo431wfqXHdE1xEkOcGrnOQ8TvHKQ3mkw,13447
208
214
  plugin_runner/plugin_synchronizer.py,sha256=t3zzfDw-bDK_hvUDQ434qaQuKLGgBGndzaCRAnSpuTU,2554
209
- plugin_runner/sandbox.py,sha256=mBmd1tMKYm5Ji-MKavTIH13Yh76S-IOm8yrQiTAJbZA,8968
215
+ plugin_runner/sandbox.py,sha256=jEFIzpYHYW5pTSLXTUHjyK3vz6ZrSsAw6HqJOreRWT4,9511
216
+ plugin_runner/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
217
+ plugin_runner/tests/data/plugins/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
218
+ plugin_runner/tests/fixtures/plugins/example_plugin/CANVAS_MANIFEST.json,sha256=J9T_E5vqUX4HITHbFsd6JQpw3YvMS4wR_lhI5JL2KMk,749
219
+ plugin_runner/tests/fixtures/plugins/example_plugin/README.md,sha256=t9pKwFf8iQPASqdXwfkA5JXkAr8KcSDX6AeW3CMiKVY,246
220
+ plugin_runner/tests/fixtures/plugins/example_plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
221
+ plugin_runner/tests/fixtures/plugins/example_plugin/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
222
+ plugin_runner/tests/fixtures/plugins/example_plugin/protocols/my_protocol.py,sha256=1j5Z6s4xAZD7HtOCqa1hN99BYZ2Sz-Az4eLpJULL1Tc,633
223
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/CANVAS_MANIFEST.json,sha256=R0_TpAB_gAfu8089GV1DNqPUkBbQVPNB7Gz7sXwOq2k,795
224
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/README.md,sha256=z1YIUBNvlfG_gQf-tyXCzPnkVpxG_I6Lx1KsT_3foEg,293
225
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/other_module/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
226
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/other_module/base.py,sha256=tCBNAaKH8x-Ngyxru4Zzsiq7z3KSh9PUoKZ8EEKE5iU,83
227
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
228
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/protocols/my_protocol.py,sha256=V_6DPXsJaD12zGyKqGjYY2JFtKEk4E0eIAgBWax_MGc,629
229
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/CANVAS_MANIFEST.json,sha256=nVfTLcMcjUWSYy0C1hx4T-w6j7OEWutpjkJ5i_7IW08,795
230
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/README.md,sha256=311D0xFL7IUlCfprG4mnqX_CzpIypUKb7oMNpyXWrpw,293
231
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/other_module/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
232
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/other_module/base.py,sha256=F6XfHJXzfzTk22IgVpmXCC1MClFLD3g4WfB7Vn7dpq4,92
233
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
234
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/protocols/my_protocol.py,sha256=RAZJ-u5XgQ2TvXIweDB_8mBbe9wMSwS7hObqyA8sJgY,640
235
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/CANVAS_MANIFEST.json,sha256=PkCeL69Q-5rznECCBFk20haBNqE_PpXPDWAnFOHg7J4,795
236
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/README.md,sha256=BMr05kaEjJJttQATj_rrbua_PBS9yfbxAARynC-mGwk,293
237
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/other_module/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
238
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/other_module/base.py,sha256=rT14wT_F5B-torvQFaIKJJBG4kXCPWqdIxPtujXvFqM,207
239
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
240
+ plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/protocols/my_protocol.py,sha256=PcLfwqp4VWhB0xfsVKNeFEMBb5SkqX0_oEHZ8YIyf6w,640
241
+ plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/CANVAS_MANIFEST.json,sha256=Eyr65AJBlzJK8Q3OXvzBvBy0i6Jq5WoLohYcUBJ-7O4,773
242
+ plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/README.md,sha256=m0VdelxTNZOBV43RIRdI2_mpnnwZxLGmFIkGHDaaiH4,282
243
+ plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/other_module/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
244
+ plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/other_module/base.py,sha256=tCBNAaKH8x-Ngyxru4Zzsiq7z3KSh9PUoKZ8EEKE5iU,83
245
+ plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
246
+ plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/protocols/my_protocol.py,sha256=V_6DPXsJaD12zGyKqGjYY2JFtKEk4E0eIAgBWax_MGc,629
247
+ plugin_runner/tests/test_plugin_runner.py,sha256=KVTAE7jKbcKF2_5VUH4bkfPwemXpJeuA_kQA1nanDjQ,7514
248
+ plugin_runner/tests/test_sandbox.py,sha256=I44rz0sbxqtWm6mAG8fGhneE1yu9M-K3PMkE4zqHG0A,3438
210
249
  pubsub/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
211
250
  pubsub/pubsub.py,sha256=pyTW0JU8mtaqiAV6g6xjZwel1CVy2EonPMU-_vkmhUM,1044
212
- settings.py,sha256=aKySQIXYBQLu06zJKiGSln12w3th3mbB_11VFMGDsm8,1480
213
- canvas-0.3.1.dist-info/METADATA,sha256=jaAhqcRKlp_zCaX5LAIVwsLtVPwJ-wRvV1p_zv2Wf8M,4500
214
- canvas-0.3.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
215
- canvas-0.3.1.dist-info/entry_points.txt,sha256=VSmSo1IZ3aEfL7enmLmlWSraS_IIkoXNVeyXzgRxFiY,46
216
- canvas-0.3.1.dist-info/RECORD,,
251
+ settings.py,sha256=to4MXxHXTnDhhPpc8JbPuIMtxPX9cCZFuE5tfBwbROQ,2065
252
+ canvas-0.5.0.dist-info/METADATA,sha256=MQz_rKT4LndF75okGzCix01v0eWhWhQ-FAM_RIt8_7w,4605
253
+ canvas-0.5.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
254
+ canvas-0.5.0.dist-info/entry_points.txt,sha256=VSmSo1IZ3aEfL7enmLmlWSraS_IIkoXNVeyXzgRxFiY,46
255
+ canvas-0.5.0.dist-info/RECORD,,
@@ -43,7 +43,7 @@ def emit(
43
43
  myline = random.choice(lines)
44
44
  event_data = json.loads(myline)
45
45
  event = PluginRunnerEvent(
46
- type=PluginRunnerEventType.Value(event_data["EventType"]),
46
+ type=event_data["EventType"],
47
47
  target=event_data["target"],
48
48
  context=event_data["context"],
49
49
  )
@@ -1,5 +1,5 @@
1
1
  import json
2
- from typing import Optional
2
+ from typing import Optional, cast
3
3
  from urllib.parse import urlparse
4
4
 
5
5
  import typer
@@ -8,7 +8,7 @@ import websocket
8
8
  from canvas_cli.apps.auth.utils import get_default_host, get_or_request_api_token
9
9
 
10
10
 
11
- def _on_message(ws: websocket.WebSocketApp, message: str) -> None:
11
+ def _on_message(ws: websocket.WebSocket, message: str) -> None:
12
12
  message_to_print = message
13
13
  try:
14
14
  message_json = json.loads(message)
@@ -18,15 +18,15 @@ def _on_message(ws: websocket.WebSocketApp, message: str) -> None:
18
18
  print(message_to_print)
19
19
 
20
20
 
21
- def _on_error(ws: websocket.WebSocketApp, error: str) -> None:
21
+ def _on_error(ws: websocket.WebSocket, error: str) -> None:
22
22
  print(f"Error: {error}")
23
23
 
24
24
 
25
- def _on_close(ws: websocket.WebSocketApp, close_status_code: str, close_msg: str) -> None:
25
+ def _on_close(ws: websocket.WebSocket, close_status_code: str, close_msg: str) -> None:
26
26
  print(f"Connection closed with status code {close_status_code}: {close_msg}")
27
27
 
28
28
 
29
- def _on_open(ws: websocket.WebSocketApp) -> None:
29
+ def _on_open(ws: websocket.WebSocket) -> None:
30
30
  print("Connected to the logging service")
31
31
 
32
32
 
@@ -43,7 +43,7 @@ def logs(
43
43
 
44
44
  # Resolve the instance name from the Canvas host URL (e.g., extract
45
45
  # 'example' from 'https://example.canvasmedical.com/')
46
- hostname = urlparse(host).hostname
46
+ hostname = cast(str, urlparse(host).hostname)
47
47
  instance = hostname.removesuffix(".canvasmedical.com")
48
48
 
49
49
  print(
@@ -3,7 +3,7 @@ import json
3
3
  import tarfile
4
4
  import tempfile
5
5
  from pathlib import Path
6
- from typing import Any, List, Optional
6
+ from typing import Any, List, Optional, cast
7
7
  from urllib.parse import urljoin
8
8
 
9
9
  import requests
@@ -50,7 +50,7 @@ def _build_package(package: Path) -> Path:
50
50
  return Path(file.name)
51
51
 
52
52
 
53
- def _get_name_from_metadata(host: str, token: str, package: Path) -> Optional[str]:
53
+ def _get_name_from_metadata(host: str, token: str, package: Path) -> str | None:
54
54
  """Extract metadata from a provided package and return the package name if it exists in the metadata."""
55
55
  try:
56
56
  metadata_response = requests.post(
@@ -100,11 +100,14 @@ def _get_meta_properties(protocol_path: Path, classname: str) -> dict[str, str]:
100
100
  if isinstance(meta_b.value, ast.Constant):
101
101
  value = meta_b.value.value
102
102
  elif isinstance(meta_b.value, ast.List):
103
- value = [e.value for e in meta_b.value.elts]
103
+ value = [cast(ast.Constant, e).value for e in meta_b.value.elts]
104
104
  elif isinstance(meta_b.value, ast.Dict):
105
105
  keys = meta_b.value.keys
106
106
  values = meta_b.value.values
107
- value = {k.value: values[i].value for i, k in enumerate(keys)}
107
+ value = {
108
+ cast(ast.Constant, k).value: cast(ast.Constant, values[i]).value
109
+ for i, k in enumerate(keys)
110
+ }
108
111
  else:
109
112
  value = None
110
113
  meta[target_id] = value
@@ -193,9 +196,10 @@ def install(
193
196
 
194
197
  # If we got a bad_request, means there's a duplicate plugin and install can't handle that.
195
198
  # So we need to get the plugin-name from the package and call `update` directly
196
- elif r.status_code == requests.codes.bad_request:
197
- plugin_name = _get_name_from_metadata(host, token, built_package_path)
198
- update(plugin_name, built_package_path, is_enabled=True, host=host)
199
+ elif r.status_code == requests.codes.bad_request and (
200
+ package_name := _get_name_from_metadata(host, token, built_package_path)
201
+ ):
202
+ update(package_name, built_package_path, is_enabled=True, host=host)
199
203
  else:
200
204
  print(f"Status code {r.status_code}: {r.text}")
201
205
  raise typer.Exit(1)
@@ -8,19 +8,15 @@ from logger import log
8
8
 
9
9
  # Inherit from BaseProtocol to properly get registered for events
10
10
  class Protocol(BaseProtocol):
11
- """
12
- You should put a helpful description of this protocol's behavior here.
13
- """
11
+ """You should put a helpful description of this protocol's behavior here."""
14
12
 
15
13
  # Name the event type you wish to run in response to
16
14
  RESPONDS_TO = EventType.Name(EventType.ASSESS_COMMAND__CONDITION_SELECTED)
17
15
 
18
16
  NARRATIVE_STRING = "I was inserted from my plugin's protocol."
19
17
 
20
- def compute(self):
21
- """
22
- This method gets called when an event of the type RESPONDS_TO is fired.
23
- """
18
+ def compute(self) -> list[Effect]:
19
+ """This method gets called when an event of the type RESPONDS_TO is fired."""
24
20
  # This class is initialized with several pieces of information you can
25
21
  # access.
26
22
  #
canvas_cli/tests.py CHANGED
@@ -2,11 +2,12 @@ import os
2
2
  import shutil
3
3
  from datetime import datetime
4
4
  from pathlib import Path
5
- from typing import Any, Callable, Generator
5
+ from typing import Any, Callable, Generator, cast
6
6
  from unittest.mock import MagicMock, patch
7
7
  from urllib.parse import urlparse
8
8
 
9
9
  import pytest
10
+ from django.core.exceptions import ImproperlyConfigured
10
11
  from typer.testing import CliRunner
11
12
 
12
13
  import settings
@@ -23,11 +24,16 @@ def plugin_name() -> str:
23
24
  return f"cli-{datetime.now().timestamp()}".replace(".", "")
24
25
 
25
26
 
26
- @pytest.fixture(autouse=True, scope="session")
27
- def create_or_update_config_auth_file_for_testing(plugin_name: str) -> Generator[Any, Any, Any]:
27
+ @pytest.fixture(scope="session")
28
+ def create_or_update_config_auth_file_for_testing(plugin_name: str) -> Generator[None, None, None]:
28
29
  """Creates the necessary config file for auth before performing cli tests."""
29
30
 
30
- host = urlparse(settings.INTEGRATION_TEST_URL).hostname.replace(".canvasmedical.com", "")
31
+ if not settings.INTEGRATION_TEST_URL:
32
+ raise ImproperlyConfigured("INTEGRATION_TEST_URL is not set")
33
+
34
+ host = cast(str, urlparse(settings.INTEGRATION_TEST_URL).hostname).replace(
35
+ ".canvasmedical.com", ""
36
+ )
31
37
  client_id = settings.INTEGRATION_TEST_CLIENT_ID
32
38
  client_secret = settings.INTEGRATION_TEST_CLIENT_SECRET
33
39
 
@@ -162,9 +168,9 @@ def uninstall_disabled_plugin(plugin_name: str) -> tuple[str, int, list[str], li
162
168
  )
163
169
 
164
170
 
171
+ @pytest.mark.integtest
165
172
  @patch("keyring.get_password")
166
173
  @patch("keyring.set_password")
167
- @pytest.mark.integtest
168
174
  @pytest.mark.parametrize(
169
175
  "step",
170
176
  [
@@ -183,6 +189,7 @@ def test_canvas_list_install_disable_enable_uninstall(
183
189
  mock_get_password: MagicMock,
184
190
  mock_set_password: MagicMock,
185
191
  plugin_name: str,
192
+ create_or_update_config_auth_file_for_testing: None,
186
193
  step: Callable,
187
194
  ) -> None:
188
195
  """Tests that the Canvas CLI can list, install, disable, enable, and uninstall a plugin"""
@@ -1,7 +1,7 @@
1
1
  import functools
2
2
  import json
3
3
  from pathlib import Path
4
- from typing import Any, Callable, TypeVar
4
+ from typing import Any, Callable, TypeVar, cast
5
5
 
6
6
  import typer
7
7
 
@@ -60,7 +60,7 @@ class CLIContext:
60
60
  with open(self._config_file_path, "w") as f:
61
61
  json.dump(self._config_file, f)
62
62
 
63
- return wrapper
63
+ return cast(F, wrapper)
64
64
 
65
65
  return _decorator(fn) if fn else _decorator
66
66
 
@@ -1,6 +1,7 @@
1
1
  import json
2
2
  import os
3
3
  from pathlib import Path
4
+ from typing import Generator
4
5
 
5
6
  import pytest
6
7
  import typer
@@ -35,7 +36,7 @@ class CLIContextTestHelper(CLIContext):
35
36
 
36
37
 
37
38
  @pytest.fixture
38
- def config_file(tmp_path: Path) -> Path:
39
+ def config_file(tmp_path: Path) -> Generator[Path, None, None]:
39
40
  """Fixture that yields an empty config file and cleans up after itself."""
40
41
  config_file = tmp_path / "mock_config.json"
41
42
  yield config_file
@@ -51,7 +52,7 @@ def valid_mock_config_file(config_file: Path) -> Path:
51
52
  with open(config_file, "w") as f:
52
53
  json.dump(mock_config, f)
53
54
 
54
- yield config_file
55
+ return config_file
55
56
 
56
57
 
57
58
  @pytest.fixture
@@ -59,7 +60,7 @@ def invalid_json_mock_config_file(config_file: Path) -> Path:
59
60
  """Fixture that yields an invalid config file."""
60
61
  config_file.write_text("Absolutely invalid JSON")
61
62
 
62
- yield config_file
63
+ return config_file
63
64
 
64
65
 
65
66
  @pytest.fixture
@@ -71,7 +72,7 @@ def invalid_properties_mock_config_file(config_file: Path) -> Path:
71
72
  with open(config_file, "w") as f:
72
73
  json.dump(mock_config, f)
73
74
 
74
- yield config_file
75
+ return config_file
75
76
 
76
77
 
77
78
  def test_valid_load_from_file(valid_mock_config_file: Path) -> None:
@@ -23,7 +23,7 @@ class Printer:
23
23
  Printer.json(message=message, success=success, status_code=response.status_code)
24
24
 
25
25
  @staticmethod
26
- def json(message: str | list[str] | dict | None, success: bool = True, **kwargs: Any) -> None:
26
+ def json(message: str | None, success: bool = True, **kwargs: Any) -> None:
27
27
  """Print a message in json format regardless of the input."""
28
28
  status = {"success": success}
29
29
  if message:
@@ -1,4 +1,5 @@
1
1
  import json
2
+ from typing import Any
2
3
  from unittest.mock import Mock
3
4
 
4
5
  import pytest
@@ -10,9 +11,7 @@ from canvas_cli.utils.print import print
10
11
  @pytest.mark.parametrize(
11
12
  "message", ["a simple message", ["an array", "of messages"], {"one": "test"}]
12
13
  )
13
- def test_print_json_outputs_valid_json(
14
- message: str | list[str] | dict | None, capfd: pytest.CaptureFixture[str]
15
- ) -> None:
14
+ def test_print_json_outputs_valid_json(message: Any, capfd: pytest.CaptureFixture[str]) -> None:
16
15
  """Test the output of print is always valid json."""
17
16
  print.json(message)
18
17
  output, _ = capfd.readouterr()