scratchattach 2.1.15b0__py3-none-any.whl → 3.0.0b1__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.
Files changed (87) hide show
  1. cli/__about__.py +1 -0
  2. cli/__init__.py +26 -0
  3. cli/cmd/__init__.py +4 -0
  4. cli/cmd/group.py +127 -0
  5. cli/cmd/login.py +60 -0
  6. cli/cmd/profile.py +7 -0
  7. cli/cmd/sessions.py +5 -0
  8. cli/context.py +142 -0
  9. cli/db.py +66 -0
  10. cli/namespace.py +14 -0
  11. {scratchattach/cloud → cloud}/_base.py +112 -87
  12. {scratchattach/cloud → cloud}/cloud.py +16 -16
  13. {scratchattach/editor → editor}/__init__.py +2 -1
  14. {scratchattach/editor → editor}/asset.py +26 -14
  15. {scratchattach/editor → editor}/backpack_json.py +3 -5
  16. {scratchattach/editor → editor}/base.py +2 -4
  17. {scratchattach/editor → editor}/block.py +27 -22
  18. {scratchattach/editor → editor}/blockshape.py +1 -1
  19. {scratchattach/editor → editor}/build_defaulting.py +2 -2
  20. editor/commons.py +145 -0
  21. {scratchattach/editor → editor}/field.py +1 -1
  22. {scratchattach/editor → editor}/inputs.py +6 -3
  23. {scratchattach/editor → editor}/meta.py +10 -7
  24. {scratchattach/editor → editor}/monitor.py +10 -8
  25. {scratchattach/editor → editor}/mutation.py +68 -11
  26. {scratchattach/editor → editor}/pallete.py +1 -3
  27. {scratchattach/editor → editor}/prim.py +4 -0
  28. {scratchattach/editor → editor}/project.py +118 -16
  29. {scratchattach/editor → editor}/sprite.py +25 -15
  30. {scratchattach/editor → editor}/vlb.py +2 -2
  31. {scratchattach/eventhandlers → eventhandlers}/_base.py +1 -0
  32. {scratchattach/eventhandlers → eventhandlers}/cloud_events.py +26 -6
  33. {scratchattach/eventhandlers → eventhandlers}/cloud_recorder.py +4 -4
  34. {scratchattach/eventhandlers → eventhandlers}/cloud_requests.py +139 -54
  35. {scratchattach/eventhandlers → eventhandlers}/cloud_server.py +6 -3
  36. {scratchattach/eventhandlers → eventhandlers}/cloud_storage.py +1 -2
  37. eventhandlers/filterbot.py +163 -0
  38. other/other_apis.py +598 -0
  39. {scratchattach-2.1.15b0.dist-info → scratchattach-3.0.0b1.dist-info}/METADATA +7 -11
  40. scratchattach-3.0.0b1.dist-info/RECORD +79 -0
  41. {scratchattach-2.1.15b0.dist-info → scratchattach-3.0.0b1.dist-info}/WHEEL +1 -1
  42. scratchattach-3.0.0b1.dist-info/entry_points.txt +2 -0
  43. scratchattach-3.0.0b1.dist-info/top_level.txt +7 -0
  44. {scratchattach/site → site}/_base.py +32 -5
  45. site/activity.py +426 -0
  46. {scratchattach/site → site}/alert.py +4 -5
  47. {scratchattach/site → site}/backpack_asset.py +2 -1
  48. {scratchattach/site → site}/classroom.py +80 -73
  49. {scratchattach/site → site}/cloud_activity.py +43 -29
  50. {scratchattach/site → site}/comment.py +86 -100
  51. {scratchattach/site → site}/forum.py +8 -4
  52. site/placeholder.py +132 -0
  53. {scratchattach/site → site}/project.py +228 -122
  54. {scratchattach/site → site}/session.py +156 -71
  55. {scratchattach/site → site}/studio.py +139 -46
  56. site/typed_dicts.py +151 -0
  57. {scratchattach/site → site}/user.py +511 -215
  58. {scratchattach/utils → utils}/commons.py +12 -4
  59. {scratchattach/utils → utils}/encoder.py +7 -4
  60. {scratchattach/utils → utils}/enums.py +1 -0
  61. {scratchattach/utils → utils}/exceptions.py +36 -2
  62. utils/optional_async.py +154 -0
  63. utils/requests.py +306 -0
  64. scratchattach/__init__.py +0 -29
  65. scratchattach/editor/commons.py +0 -273
  66. scratchattach/eventhandlers/filterbot.py +0 -161
  67. scratchattach/other/other_apis.py +0 -284
  68. scratchattach/site/activity.py +0 -382
  69. scratchattach/utils/requests.py +0 -93
  70. scratchattach-2.1.15b0.dist-info/RECORD +0 -66
  71. scratchattach-2.1.15b0.dist-info/top_level.txt +0 -1
  72. {scratchattach/cloud → cloud}/__init__.py +0 -0
  73. {scratchattach/editor → editor}/code_translation/__init__.py +0 -0
  74. {scratchattach/editor → editor}/code_translation/parse.py +0 -0
  75. {scratchattach/editor → editor}/comment.py +0 -0
  76. {scratchattach/editor → editor}/extension.py +0 -0
  77. {scratchattach/editor → editor}/twconfig.py +0 -0
  78. {scratchattach/eventhandlers → eventhandlers}/__init__.py +0 -0
  79. {scratchattach/eventhandlers → eventhandlers}/combine.py +0 -0
  80. {scratchattach/eventhandlers → eventhandlers}/message_events.py +0 -0
  81. {scratchattach/other → other}/__init__.py +0 -0
  82. {scratchattach/other → other}/project_json_capabilities.py +0 -0
  83. {scratchattach-2.1.15b0.dist-info → scratchattach-3.0.0b1.dist-info}/licenses/LICENSE +0 -0
  84. {scratchattach/site → site}/__init__.py +0 -0
  85. {scratchattach/site → site}/browser_cookie3_stub.py +0 -0
  86. {scratchattach/site → site}/browser_cookies.py +0 -0
  87. {scratchattach/utils → utils}/__init__.py +0 -0
@@ -1,93 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from collections.abc import MutableMapping, Iterator
4
- from typing import Optional
5
- from contextlib import contextmanager
6
-
7
- from typing_extensions import override
8
- from requests import Session as HTTPSession
9
- from requests import Response
10
-
11
- from . import exceptions
12
-
13
- proxies: Optional[MutableMapping[str, str]] = None
14
-
15
- class Requests(HTTPSession):
16
- """
17
- Centralized HTTP request handler (for better error handling and proxies)
18
- """
19
- error_handling: bool = True
20
-
21
- def check_response(self, r: Response):
22
- if r.status_code == 403 or r.status_code == 401:
23
- raise exceptions.Unauthorized(f"Request content: {r.content!r}")
24
- if r.status_code == 500:
25
- raise exceptions.APIError("Internal Scratch server error")
26
- if r.status_code == 429:
27
- raise exceptions.Response429("You are being rate-limited (or blocked) by Scratch")
28
- if r.json() == {"code":"BadRequest","message":""}:
29
- raise exceptions.BadRequest("Make sure all provided arguments are valid")
30
-
31
- @override
32
- def get(self, *args, **kwargs):
33
- kwargs.setdefault("proxies", proxies)
34
- try:
35
- r = super().get(*args, **kwargs)
36
- except Exception as e:
37
- raise exceptions.FetchError(e)
38
- if self.error_handling:
39
- self.check_response(r)
40
- return r
41
-
42
- @override
43
- def post(self, *args, **kwargs):
44
- kwargs.setdefault("proxies", proxies)
45
- try:
46
- r = super().post(*args, **kwargs)
47
- except Exception as e:
48
- raise exceptions.FetchError(e)
49
- if self.error_handling:
50
- self.check_response(r)
51
- return r
52
-
53
- @override
54
- def delete(self, *args, **kwargs):
55
- kwargs.setdefault("proxies", proxies)
56
- try:
57
- r = super().delete(*args, **kwargs)
58
- except Exception as e:
59
- raise exceptions.FetchError(e)
60
- if self.error_handling:
61
- self.check_response(r)
62
- return r
63
-
64
- @override
65
- def put(self, *args, **kwargs):
66
- kwargs.setdefault("proxies", proxies)
67
- try:
68
- r = super().put(*args, **kwargs)
69
- except Exception as e:
70
- raise exceptions.FetchError(e)
71
- if self.error_handling:
72
- self.check_response(r)
73
- return r
74
-
75
- @contextmanager
76
- def no_error_handling(self) -> Iterator[None]:
77
- val_before = self.error_handling
78
- self.error_handling = False
79
- try:
80
- yield
81
- finally:
82
- self.error_handling = val_before
83
-
84
- @contextmanager
85
- def yes_error_handling(self) -> Iterator[None]:
86
- val_before = self.error_handling
87
- self.error_handling = True
88
- try:
89
- yield
90
- finally:
91
- self.error_handling = val_before
92
-
93
- requests = Requests()
@@ -1,66 +0,0 @@
1
- scratchattach/__init__.py,sha256=2iiV0SghFUyJJrJYt668cSoDrxSjLCWNtzMdhttnMdA,1532
2
- scratchattach/cloud/__init__.py,sha256=MN7s4grQcciqUO7TiFjTbU2sC69m6XXlwOHNRbN3FKo,41
3
- scratchattach/cloud/_base.py,sha256=wQDBIjrEtGSleKnAghluvZGX1L7U0wpUry_3MD8-VkY,18060
4
- scratchattach/cloud/cloud.py,sha256=f3qGy7rhpyuhOlVfki3l8FdMpyFtcVTBg9ql6l0J-jI,8167
5
- scratchattach/editor/__init__.py,sha256=gfTQrtyQ-oZJBanp-5eNae72cwm4WoKHzNtZ4rn1dqg,727
6
- scratchattach/editor/asset.py,sha256=8rQmaZCO4tMjnohutfvVha2t5x_ct2Rxn_Q9Dz6DCYI,7734
7
- scratchattach/editor/backpack_json.py,sha256=PZGNIFNf0MS3hn8cKZEp9ZeQWdBE-xWq5PEwiN8IzWM,3900
8
- scratchattach/editor/base.py,sha256=AP_JktO6NLxpsh00twnKHkXmzLmATFabfmw1tmWh98c,5412
9
- scratchattach/editor/block.py,sha256=B7II4ICOLxdN_D_rn3LH4njRmkZLisxcPzg4WAyNIXA,18786
10
- scratchattach/editor/blockshape.py,sha256=luSl0AKBdkJH_TW_9RhJBiwtRny9_r3DKE99mPmMh9c,25309
11
- scratchattach/editor/build_defaulting.py,sha256=BkD81lTaR1LTv8HwwkxGtQ040G2Y6mh1R6fCZIkfkYM,1386
12
- scratchattach/editor/comment.py,sha256=G_eFxeaC_vKbCFpDfw4oZxIReUBoBUaCA5q35O-AW6Y,2403
13
- scratchattach/editor/commons.py,sha256=ghUuTo_1ATVxeqon5RtErbh5rcxsXwHESTBVhUjeiHY,6698
14
- scratchattach/editor/extension.py,sha256=PFVl5SrS66M4Md98I_dsfeL9BLeWwvyWezmhnTRseIQ,1541
15
- scratchattach/editor/field.py,sha256=3JUBwj-Mun36Yb7KDeQIWZcuj0e4kjkVAwk_9cKfQPY,3002
16
- scratchattach/editor/inputs.py,sha256=JGFKry9m8IHNw9zoyM6iViEbPp1VlHlVPI9fYoiTk3M,4391
17
- scratchattach/editor/meta.py,sha256=aTP5Imz2cFI_RDA4Lufa5UV64lgk3-TP3B4fd7t0zio,3202
18
- scratchattach/editor/monitor.py,sha256=q-RrycEpYa3rHZ0_9RZobIS8Sfbmpx7_cdUFEaoA7Yk,5788
19
- scratchattach/editor/mutation.py,sha256=NKLVae0A6J0CKl1Xm7jpdNNoyGFtwcmU-LiBfYpvtlU,10399
20
- scratchattach/editor/pallete.py,sha256=-CbTRHsgpiVomal1ohW0ouuSP-hCsPTApgRohfxRPfI,2348
21
- scratchattach/editor/prim.py,sha256=WAXMQ5C5FYIk-gNLwH1cnhsMQJpxH0yl_YH0Tcju9IU,5877
22
- scratchattach/editor/project.py,sha256=D6gtmfGu0y3_Wzyhq-bjPRzVERFGH_b1DCUVHS9HBtY,9138
23
- scratchattach/editor/sprite.py,sha256=BG8--SNvj2HYre3pGKEpvnq2Qpl3h_qDseKxIxfWL38,20862
24
- scratchattach/editor/twconfig.py,sha256=iE6ylAsZzniAfhL09GkZSFn1XacYtCQPzRCUSPIBzDA,3324
25
- scratchattach/editor/vlb.py,sha256=ZUlrA52ZoK5znGkBUw10UGejpvBlpkH635pTl9sUAmM,4170
26
- scratchattach/editor/code_translation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- scratchattach/editor/code_translation/parse.py,sha256=FjuHVg_tNzkGcGSNwgH6MzAHcf5YCvaEUSYukyJkwbk,4932
28
- scratchattach/eventhandlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- scratchattach/eventhandlers/_base.py,sha256=XGsGzsmUBy5IV3Cl0akEmwBsaSyfVNs0YbNS7lktxrw,3099
30
- scratchattach/eventhandlers/cloud_events.py,sha256=B0Ce0y8HKP2fOJ3zIUdJg8tHGYoGpc42e4ktuLL_bRw,4108
31
- scratchattach/eventhandlers/cloud_recorder.py,sha256=o4wcWJFCddpcSsPx5YU2DFFMFoKUknKM2RQ36HLpheQ,800
32
- scratchattach/eventhandlers/cloud_requests.py,sha256=B_ybgcQ3S861KUNIYv3kOc0siO8BP1Ez57zE1GypTJg,22121
33
- scratchattach/eventhandlers/cloud_server.py,sha256=rgY0lcXO-E_iAu4oVvbshIfG7eMw0Ekz4_GOLTxCzmM,12302
34
- scratchattach/eventhandlers/cloud_storage.py,sha256=9dvKPxbPZ_hBhw1HYlTl72YJmBo2OMwrSrMQ7kQwwOE,4660
35
- scratchattach/eventhandlers/combine.py,sha256=YiWI6WI1BySioXpfYaMv8noBM14EjZa7dtsJsMTshEU,894
36
- scratchattach/eventhandlers/filterbot.py,sha256=RvGCm-2iaC8SAC4nDMlDv0MPp80CsRr4CFGmnIuEfg8,7462
37
- scratchattach/eventhandlers/message_events.py,sha256=KvznXAeNGk1WWCxd7PI95yovX-58TyCBNDdXbrYgb8Q,1776
38
- scratchattach/other/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
- scratchattach/other/other_apis.py,sha256=iJXytVgAIARWQ_z7t99Lv2oB6DdwrFBmkFxiaHQRKLI,9095
40
- scratchattach/other/project_json_capabilities.py,sha256=07t1iMgWm4Qd06jHyQ3vK7tROguvc2RQCo78enrdSlA,22646
41
- scratchattach/site/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
- scratchattach/site/_base.py,sha256=v2U0V-2T5QnDGtUDVPR1e4qg9R7rpNYmO8YKA5fIXfg,2249
43
- scratchattach/site/activity.py,sha256=4fohsjeVJFaMnKE6_Ew8DcDpFfDzwPeZ7XGp5NnCMW8,13786
44
- scratchattach/site/alert.py,sha256=TX_Py5L7IKmXEPFGIOFIGvqlT8aSigywsR5nODkvwFY,9277
45
- scratchattach/site/backpack_asset.py,sha256=8AKvDTvaTvN2ntqE3Ygkl0mvu6-ZR-DbLkCszv2h70o,3298
46
- scratchattach/site/browser_cookie3_stub.py,sha256=codk0knOP5C0YThaRazvqsqX7X7WnrD2UwFd1nFG7mg,1422
47
- scratchattach/site/browser_cookies.py,sha256=uQyjJJ4HCu46R4tPWCcTUqDMXSXhQ4KQUobqCSxScSA,1864
48
- scratchattach/site/classroom.py,sha256=2IDLDljEDLp8Vj5ab94Ti_VVBCv8OPS7qNVr1zFBCME,16884
49
- scratchattach/site/cloud_activity.py,sha256=x0kbd9Zx1dI4s0lJXWNixQCJeKG1CchXK-9867RiK1A,4207
50
- scratchattach/site/comment.py,sha256=733CDTV7227MxrhRM0dQYF06aDbHVFK-_rECz--grvA,9135
51
- scratchattach/site/forum.py,sha256=Y7sh3-wcEjRBfKEHOcusudSudCJFe4MuQFd-EB4FccQ,16417
52
- scratchattach/site/project.py,sha256=kPbAppWTl9QG61C0DXN7MBM5DyjJacY8ooCctyBlHp0,31630
53
- scratchattach/site/session.py,sha256=XwEr4IF-Ei1nl-ZiMi-CGdV3Q8N7txLDlRDOESDE8zE,50877
54
- scratchattach/site/studio.py,sha256=a20fzNq2GGN0SbyC7_d6UqmCqDgofZjdiMucp9KHnYE,22942
55
- scratchattach/site/user.py,sha256=v6cLI1t465DHTT2xuWd-pXThL1QPDT7GGDcXgOBxaLE,39483
56
- scratchattach/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
- scratchattach/utils/commons.py,sha256=BKH-zz2A5e1d5qEtvZvAmK5fXyVq-FGRRw3Wx-StG5E,8213
58
- scratchattach/utils/encoder.py,sha256=rqJfQ5gmjf7s8aTiGhR0W1ejYN5tHbAgJlxv7JhGqZQ,2479
59
- scratchattach/utils/enums.py,sha256=GFLI3F0ZWGqicKV_QJwhyz4MiPDdstAJaUBxYDYT9to,11091
60
- scratchattach/utils/exceptions.py,sha256=AyM9lU009irxaJvMPB0N0kQaVAJeWHjlmQIS6Njgo78,6528
61
- scratchattach/utils/requests.py,sha256=vf7OaASbC9_qp4ygOGcU2PjWvf7dwgGbsluZiKGyRMg,2832
62
- scratchattach-2.1.15b0.dist-info/licenses/LICENSE,sha256=1PRKLhZU4wYt5M-C9f7q0W3go3u_ojnZMNOdR3g3J-E,1080
63
- scratchattach-2.1.15b0.dist-info/METADATA,sha256=ZW7mfiegAGFMu035-K0uhYTUQAs8bQaNdMJggcqd0eQ,5689
64
- scratchattach-2.1.15b0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
65
- scratchattach-2.1.15b0.dist-info/top_level.txt,sha256=gIwCwW39ohXn0JlnvSzAjV7VtL3qPlRnHiRqBbxsEUE,14
66
- scratchattach-2.1.15b0.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- scratchattach
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