scratchattach 2.1.9__py3-none-any.whl → 2.1.10a0__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 (59) hide show
  1. scratchattach/__init__.py +28 -25
  2. scratchattach/cloud/__init__.py +2 -0
  3. scratchattach/cloud/_base.py +454 -282
  4. scratchattach/cloud/cloud.py +171 -168
  5. scratchattach/editor/__init__.py +21 -0
  6. scratchattach/editor/asset.py +199 -0
  7. scratchattach/editor/backpack_json.py +117 -0
  8. scratchattach/editor/base.py +142 -0
  9. scratchattach/editor/block.py +507 -0
  10. scratchattach/editor/blockshape.py +353 -0
  11. scratchattach/editor/build_defaulting.py +47 -0
  12. scratchattach/editor/comment.py +74 -0
  13. scratchattach/editor/commons.py +243 -0
  14. scratchattach/editor/extension.py +43 -0
  15. scratchattach/editor/field.py +90 -0
  16. scratchattach/editor/inputs.py +132 -0
  17. scratchattach/editor/meta.py +106 -0
  18. scratchattach/editor/monitor.py +175 -0
  19. scratchattach/editor/mutation.py +317 -0
  20. scratchattach/editor/pallete.py +91 -0
  21. scratchattach/editor/prim.py +170 -0
  22. scratchattach/editor/project.py +273 -0
  23. scratchattach/editor/sbuild.py +2837 -0
  24. scratchattach/editor/sprite.py +586 -0
  25. scratchattach/editor/twconfig.py +113 -0
  26. scratchattach/editor/vlb.py +134 -0
  27. scratchattach/eventhandlers/_base.py +99 -92
  28. scratchattach/eventhandlers/cloud_events.py +110 -103
  29. scratchattach/eventhandlers/cloud_recorder.py +26 -21
  30. scratchattach/eventhandlers/cloud_requests.py +460 -452
  31. scratchattach/eventhandlers/cloud_server.py +246 -244
  32. scratchattach/eventhandlers/cloud_storage.py +135 -134
  33. scratchattach/eventhandlers/combine.py +29 -27
  34. scratchattach/eventhandlers/filterbot.py +160 -159
  35. scratchattach/eventhandlers/message_events.py +41 -40
  36. scratchattach/other/other_apis.py +284 -212
  37. scratchattach/other/project_json_capabilities.py +475 -546
  38. scratchattach/site/_base.py +64 -46
  39. scratchattach/site/activity.py +414 -122
  40. scratchattach/site/backpack_asset.py +118 -84
  41. scratchattach/site/classroom.py +430 -142
  42. scratchattach/site/cloud_activity.py +107 -103
  43. scratchattach/site/comment.py +220 -190
  44. scratchattach/site/forum.py +400 -399
  45. scratchattach/site/project.py +806 -787
  46. scratchattach/site/session.py +1134 -867
  47. scratchattach/site/studio.py +611 -609
  48. scratchattach/site/user.py +835 -837
  49. scratchattach/utils/commons.py +243 -148
  50. scratchattach/utils/encoder.py +157 -156
  51. scratchattach/utils/enums.py +197 -190
  52. scratchattach/utils/exceptions.py +233 -206
  53. scratchattach/utils/requests.py +67 -59
  54. {scratchattach-2.1.9.dist-info → scratchattach-2.1.10a0.dist-info}/LICENSE +21 -21
  55. {scratchattach-2.1.9.dist-info → scratchattach-2.1.10a0.dist-info}/METADATA +154 -146
  56. scratchattach-2.1.10a0.dist-info/RECORD +62 -0
  57. {scratchattach-2.1.9.dist-info → scratchattach-2.1.10a0.dist-info}/WHEEL +1 -1
  58. scratchattach-2.1.9.dist-info/RECORD +0 -40
  59. {scratchattach-2.1.9.dist-info → scratchattach-2.1.10a0.dist-info}/top_level.txt +0 -0
@@ -1,157 +1,158 @@
1
- import math
2
- from . import exceptions
3
-
4
- letters = [
5
- None,
6
- None,
7
- None,
8
- None,
9
- None,
10
- None,
11
- None,
12
- None,
13
- None,
14
- None,
15
- "1",
16
- "2",
17
- "3",
18
- "4",
19
- "5",
20
- "6",
21
- "7",
22
- "8",
23
- "9",
24
- "0",
25
- " ",
26
- "a",
27
- "A",
28
- "b",
29
- "B",
30
- "c",
31
- "C",
32
- "d",
33
- "D",
34
- "e",
35
- "E",
36
- "f",
37
- "F",
38
- "g",
39
- "G",
40
- "h",
41
- "H",
42
- "i",
43
- "I",
44
- "j",
45
- "J",
46
- "k",
47
- "K",
48
- "l",
49
- "L",
50
- "m",
51
- "M",
52
- "n",
53
- "N",
54
- "o",
55
- "O",
56
- "p",
57
- "P",
58
- "q",
59
- "Q",
60
- "r",
61
- "R",
62
- "s",
63
- "S",
64
- "t",
65
- "T",
66
- "u",
67
- "U",
68
- "v",
69
- "V",
70
- "w",
71
- "W",
72
- "x",
73
- "X",
74
- "y",
75
- "Y",
76
- "z",
77
- "Z",
78
- "*",
79
- "/",
80
- ".",
81
- ",",
82
- "!",
83
- '"',
84
- "§",
85
- "$",
86
- "%",
87
- "_",
88
- "-",
89
- "(",
90
- "´",
91
- ")",
92
- "`",
93
- "?",
94
- "new line",
95
- "@",
96
- "#",
97
- "~",
98
- ";",
99
- ":",
100
- "+",
101
- "&",
102
- "|",
103
- "^",
104
- "'"
105
- ]
106
-
107
-
108
- class Encoding:
109
- """
110
- Class that contains tools for encoding / decoding strings. The strings encoded / decoded with these functions can be decoded / encoded with Scratch using this sprite: https://scratch3-assets.1tim.repl.co/Encoder.sprite3
111
- """
112
- @staticmethod
113
- def decode(inp):
114
- """
115
- Args:
116
- inp (str): The encoded input.
117
-
118
- Returns:
119
- str: The decoded output.
120
- """
121
- try:
122
- inp = str(inp)
123
- except Exception:
124
- raise(exceptions.InvalidDecodeInput)
125
- outp = ""
126
- for i in range(0, math.floor(len(inp) / 2)):
127
- letter = letters[int(f"{inp[i*2]}{inp[(i*2)+1]}")]
128
- outp = f"{outp}{letter}"
129
- return outp
130
-
131
- @staticmethod
132
- def encode(inp):
133
- """
134
- Args:
135
- inp (str): The decoded input.
136
-
137
- Returns:
138
- str: The encoded output.
139
- """
140
- inp = str(inp)
141
- outp = ""
142
- for i in inp:
143
- if i in letters:
144
- outp = f"{outp}{letters.index(i)}"
145
- else:
146
- outp += str(letters.index(" "))
147
- return outp
148
-
149
- @staticmethod
150
- def replace_char(old_char, new_char):
151
- """
152
- Replaces a character in the list that the encoder uses to encode / decode values.
153
- You can access this list using `scratchattach.encoder.letters`
154
- """
155
- i = letters.index(old_char)
156
- letters[i] = new_char
1
+ from __future__ import annotations
2
+ import math
3
+ from . import exceptions
4
+
5
+ letters = [
6
+ None,
7
+ None,
8
+ None,
9
+ None,
10
+ None,
11
+ None,
12
+ None,
13
+ None,
14
+ None,
15
+ None,
16
+ "1",
17
+ "2",
18
+ "3",
19
+ "4",
20
+ "5",
21
+ "6",
22
+ "7",
23
+ "8",
24
+ "9",
25
+ "0",
26
+ " ",
27
+ "a",
28
+ "A",
29
+ "b",
30
+ "B",
31
+ "c",
32
+ "C",
33
+ "d",
34
+ "D",
35
+ "e",
36
+ "E",
37
+ "f",
38
+ "F",
39
+ "g",
40
+ "G",
41
+ "h",
42
+ "H",
43
+ "i",
44
+ "I",
45
+ "j",
46
+ "J",
47
+ "k",
48
+ "K",
49
+ "l",
50
+ "L",
51
+ "m",
52
+ "M",
53
+ "n",
54
+ "N",
55
+ "o",
56
+ "O",
57
+ "p",
58
+ "P",
59
+ "q",
60
+ "Q",
61
+ "r",
62
+ "R",
63
+ "s",
64
+ "S",
65
+ "t",
66
+ "T",
67
+ "u",
68
+ "U",
69
+ "v",
70
+ "V",
71
+ "w",
72
+ "W",
73
+ "x",
74
+ "X",
75
+ "y",
76
+ "Y",
77
+ "z",
78
+ "Z",
79
+ "*",
80
+ "/",
81
+ ".",
82
+ ",",
83
+ "!",
84
+ '"',
85
+ "§",
86
+ "$",
87
+ "%",
88
+ "_",
89
+ "-",
90
+ "(",
91
+ "´",
92
+ ")",
93
+ "`",
94
+ "?",
95
+ "new line",
96
+ "@",
97
+ "#",
98
+ "~",
99
+ ";",
100
+ ":",
101
+ "+",
102
+ "&",
103
+ "|",
104
+ "^",
105
+ "'"
106
+ ]
107
+
108
+
109
+ class Encoding:
110
+ """
111
+ Class that contains tools for encoding / decoding strings. The strings encoded / decoded with these functions can be decoded / encoded with Scratch using this sprite: https://scratch3-assets.1tim.repl.co/Encoder.sprite3
112
+ """
113
+ @staticmethod
114
+ def decode(inp):
115
+ """
116
+ Args:
117
+ inp (str): The encoded input.
118
+
119
+ Returns:
120
+ str: The decoded output.
121
+ """
122
+ try:
123
+ inp = str(inp)
124
+ except Exception:
125
+ raise(exceptions.InvalidDecodeInput)
126
+ outp = ""
127
+ for i in range(0, math.floor(len(inp) / 2)):
128
+ letter = letters[int(f"{inp[i*2]}{inp[(i*2)+1]}")]
129
+ outp = f"{outp}{letter}"
130
+ return outp
131
+
132
+ @staticmethod
133
+ def encode(inp):
134
+ """
135
+ Args:
136
+ inp (str): The decoded input.
137
+
138
+ Returns:
139
+ str: The encoded output.
140
+ """
141
+ inp = str(inp)
142
+ outp = ""
143
+ for i in inp:
144
+ if i in letters:
145
+ outp = f"{outp}{letters.index(i)}"
146
+ else:
147
+ outp += str(letters.index(" "))
148
+ return outp
149
+
150
+ @staticmethod
151
+ def replace_char(old_char, new_char):
152
+ """
153
+ Replaces a character in the list that the encoder uses to encode / decode values.
154
+ You can access this list using `scratchattach.encoder.letters`
155
+ """
156
+ i = letters.index(old_char)
157
+ letters[i] = new_char
157
158