auto-editor 28.0.2__py3-none-any.whl → 29.0.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.
Files changed (58) hide show
  1. {auto_editor-28.0.2.dist-info → auto_editor-29.0.0.dist-info}/METADATA +5 -4
  2. auto_editor-29.0.0.dist-info/RECORD +5 -0
  3. auto_editor-29.0.0.dist-info/top_level.txt +1 -0
  4. auto_editor/__init__.py +0 -1
  5. auto_editor/__main__.py +0 -503
  6. auto_editor/analyze.py +0 -393
  7. auto_editor/cmds/__init__.py +0 -0
  8. auto_editor/cmds/cache.py +0 -69
  9. auto_editor/cmds/desc.py +0 -32
  10. auto_editor/cmds/info.py +0 -213
  11. auto_editor/cmds/levels.py +0 -199
  12. auto_editor/cmds/palet.py +0 -29
  13. auto_editor/cmds/repl.py +0 -113
  14. auto_editor/cmds/subdump.py +0 -72
  15. auto_editor/cmds/test.py +0 -812
  16. auto_editor/edit.py +0 -548
  17. auto_editor/exports/__init__.py +0 -0
  18. auto_editor/exports/fcp11.py +0 -195
  19. auto_editor/exports/fcp7.py +0 -313
  20. auto_editor/exports/json.py +0 -63
  21. auto_editor/exports/shotcut.py +0 -147
  22. auto_editor/ffwrapper.py +0 -187
  23. auto_editor/help.py +0 -223
  24. auto_editor/imports/__init__.py +0 -0
  25. auto_editor/imports/fcp7.py +0 -275
  26. auto_editor/imports/json.py +0 -234
  27. auto_editor/json.py +0 -297
  28. auto_editor/lang/__init__.py +0 -0
  29. auto_editor/lang/libintrospection.py +0 -10
  30. auto_editor/lang/libmath.py +0 -23
  31. auto_editor/lang/palet.py +0 -724
  32. auto_editor/lang/stdenv.py +0 -1184
  33. auto_editor/lib/__init__.py +0 -0
  34. auto_editor/lib/contracts.py +0 -235
  35. auto_editor/lib/data_structs.py +0 -278
  36. auto_editor/lib/err.py +0 -2
  37. auto_editor/make_layers.py +0 -315
  38. auto_editor/preview.py +0 -93
  39. auto_editor/render/__init__.py +0 -0
  40. auto_editor/render/audio.py +0 -517
  41. auto_editor/render/subtitle.py +0 -205
  42. auto_editor/render/video.py +0 -312
  43. auto_editor/timeline.py +0 -331
  44. auto_editor/utils/__init__.py +0 -0
  45. auto_editor/utils/bar.py +0 -142
  46. auto_editor/utils/chunks.py +0 -2
  47. auto_editor/utils/cmdkw.py +0 -206
  48. auto_editor/utils/container.py +0 -102
  49. auto_editor/utils/func.py +0 -128
  50. auto_editor/utils/log.py +0 -124
  51. auto_editor/utils/types.py +0 -277
  52. auto_editor/vanparse.py +0 -313
  53. auto_editor-28.0.2.dist-info/RECORD +0 -56
  54. auto_editor-28.0.2.dist-info/entry_points.txt +0 -6
  55. auto_editor-28.0.2.dist-info/top_level.txt +0 -2
  56. docs/build.py +0 -70
  57. {auto_editor-28.0.2.dist-info → auto_editor-29.0.0.dist-info}/WHEEL +0 -0
  58. {auto_editor-28.0.2.dist-info → auto_editor-29.0.0.dist-info}/licenses/LICENSE +0 -0
File without changes
@@ -1,235 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from dataclasses import dataclass
4
- from fractions import Fraction
5
- from typing import TYPE_CHECKING
6
-
7
- from numpy import float64
8
-
9
- from .data_structs import Sym, print_str
10
- from .err import MyError
11
-
12
- if TYPE_CHECKING:
13
- from collections.abc import Callable
14
- from typing import Any
15
-
16
-
17
- @dataclass(slots=True)
18
- class Contract:
19
- # Convenient flat contract class
20
- name: str
21
- c: Callable[[object], bool]
22
-
23
- def __call__(self, *v: object) -> bool:
24
- if len(v) != 1:
25
- o = self.name
26
- raise MyError(f"`{o}` has an arity mismatch. Expected 1, got {len(v)}")
27
- return self.c(v[0])
28
-
29
- def __str__(self) -> str:
30
- return self.name
31
-
32
- def __repr__(self) -> str:
33
- return f"#<proc:{self.name} (1 1)>"
34
-
35
-
36
- def check_contract(c: object, val: object) -> bool:
37
- if type(c) is Contract:
38
- return c(val)
39
- if (
40
- isinstance(c, Proc)
41
- and c.arity[0] < 2
42
- and (c.arity[1] is None or c.arity[1] > 0)
43
- ):
44
- return c(val)
45
- if c is True:
46
- return val is True
47
- if c is False:
48
- return val is False
49
- if type(c) in (int, float, float64, Fraction, str, Sym):
50
- return val == c
51
- raise MyError(f"Invalid contract, got: {print_str(c)}")
52
-
53
-
54
- def check_args(
55
- name: str,
56
- values: list | tuple,
57
- arity: tuple[int, int | None],
58
- cont: tuple[Any, ...],
59
- ) -> None:
60
- lower, upper = arity
61
- amount = len(values)
62
-
63
- assert not (upper is not None and lower > upper)
64
- base = f"`{name}` has an arity mismatch. Expected "
65
-
66
- if lower == upper and len(values) != lower:
67
- raise MyError(f"{base}{lower}, got {amount}")
68
- if upper is None and amount < lower:
69
- raise MyError(f"{base}at least {lower}, got {amount}")
70
- if upper is not None and (amount > upper or amount < lower):
71
- raise MyError(f"{base}between {lower} and {upper}, got {amount}")
72
-
73
- if not cont:
74
- return
75
-
76
- for i, val in enumerate(values):
77
- check = cont[-1] if i >= len(cont) else cont[i]
78
- if not check_contract(check, val):
79
- exp = f"{check}" if callable(check) else print_str(check)
80
- raise MyError(f"`{name}` expected {exp}, but got {print_str(val)}")
81
-
82
-
83
- class Proc:
84
- __slots__ = ("name", "proc", "arity", "contracts", "kw_contracts")
85
-
86
- def __init__(
87
- self, n: str, p: Callable, a: tuple[int, int | None] = (1, None), *c: Any
88
- ):
89
- self.name = n
90
- self.proc = p
91
- self.arity = a
92
-
93
- if c and type(c[-1]) is dict:
94
- self.kw_contracts: dict[str, int] | None = c[-1]
95
- self.contracts: tuple[Any, ...] = c[:-1]
96
- else:
97
- self.kw_contracts = None
98
- self.contracts = c
99
-
100
- def __call__(self, *args: Any, **kwargs: Any) -> Any:
101
- lower, upper = self.arity
102
- amount = len(args)
103
- cont = self.contracts
104
- kws = self.kw_contracts
105
-
106
- assert not (upper is not None and lower > upper)
107
- base = f"`{self.name}` has an arity mismatch. Expected "
108
-
109
- if lower == upper and len(args) != lower:
110
- raise MyError(f"{base}{lower}, got {amount}")
111
- if upper is None and amount < lower:
112
- raise MyError(f"{base}at least {lower}, got {amount}")
113
- if upper is not None and (amount > upper or amount < lower):
114
- raise MyError(f"{base}between {lower} and {upper}, got {amount}")
115
-
116
- if not cont:
117
- return self.proc(*args)
118
-
119
- if kws is not None:
120
- for key, val in kwargs.items():
121
- if key not in kws:
122
- raise MyError(
123
- f"{self.name} got an unexpected keyword argument: {key}"
124
- )
125
- check = cont[-1] if kws[key] >= len(cont) else cont[kws[key]]
126
- if not check_contract(check, val):
127
- exp = f"{check}" if callable(check) else print_str(check)
128
- raise MyError(
129
- f"`{self.name} #:{key}` expected {exp}, but got {print_str(val)}"
130
- )
131
-
132
- elif len(kwargs) > 0:
133
- raise MyError("Keyword arguments are not allowed here")
134
-
135
- for i, val in enumerate(args):
136
- check = cont[-1] if i >= len(cont) else cont[i]
137
- if not check_contract(check, val):
138
- exp = f"{check}" if callable(check) else print_str(check)
139
- raise MyError(f"`{self.name}` expected {exp}, but got {print_str(val)}")
140
-
141
- return self.proc(*args, **kwargs)
142
-
143
- def __str__(self) -> str:
144
- return self.name
145
-
146
- def __repr__(self) -> str:
147
- n = "inf" if self.arity[1] is None else f"{self.arity[1]}"
148
-
149
- if self.contracts is None:
150
- c = ""
151
- else:
152
- c = " (" + " ".join([f"{c}" for c in self.contracts]) + ")"
153
- return f"#<proc:{self.name} ({self.arity[0]} {n}){c}>"
154
-
155
-
156
- def is_contract(c: object) -> bool:
157
- if type(c) is Contract:
158
- return True
159
- if (
160
- isinstance(c, Proc)
161
- and c.arity[0] < 2
162
- and (c.arity[1] is None or c.arity[1] > 0)
163
- ):
164
- return True
165
- if c is True or c is False:
166
- return True
167
- return type(c) in (int, float, Fraction, str, Sym)
168
-
169
-
170
- is_bool = Contract("bool?", lambda v: type(v) is bool)
171
- is_int = Contract("int?", lambda v: type(v) is int)
172
- is_nat = Contract("nat?", lambda v: type(v) is int and v > -1)
173
- is_nat1 = Contract("nat1?", lambda v: type(v) is int and v > 0)
174
- int_not_zero = Contract("(or/c (not/c 0) int?)", lambda v: v != 0 and is_int(v))
175
- is_real = Contract("real?", lambda v: type(v) in (int, float, float64, Fraction))
176
- is_num = is_real
177
- is_float = Contract("float?", lambda v: type(v) in (float, float64))
178
- is_frac = Contract("frac?", lambda v: type(v) is Fraction)
179
- is_str = Contract("string?", lambda v: type(v) is str)
180
- any_p = Contract("any", lambda v: True)
181
- is_void = Contract("void?", lambda v: v is None)
182
- is_int_or_float = Contract(
183
- "(or/c int? float?)", lambda v: type(v) in (int, float, float64)
184
- )
185
- is_threshold = Contract(
186
- "threshold?",
187
- lambda v: type(v) in (int, float, float64) and v >= 0 and v <= 1, # type: ignore
188
- )
189
- is_proc = Contract("procedure?", lambda v: isinstance(v, Proc | Contract))
190
-
191
-
192
- def contract_printer(cs) -> str:
193
- return " ".join(
194
- c.name if isinstance(c, Proc | Contract) else print_str(c) for c in cs
195
- )
196
-
197
-
198
- def andc(*cs: object) -> Proc:
199
- name = f"(and/c {contract_printer(cs)})"
200
- return Proc(name, lambda v: all(check_contract(c, v) for c in cs), (1, 1), any_p)
201
-
202
-
203
- def orc(*cs: object) -> Proc:
204
- name = f"(or/c {contract_printer(cs)})"
205
- return Proc(name, lambda v: any(check_contract(c, v) for c in cs), (1, 1), any_p)
206
-
207
-
208
- def notc(c: object) -> Proc:
209
- return Proc("flat-not/c", lambda v: not check_contract(c, v), (1, 1), any_p)
210
-
211
-
212
- def gte_c(n: int | float | Fraction) -> Proc:
213
- return Proc(f"(>=/c {n})", lambda i: i >= n, (1, 1), is_real)
214
-
215
-
216
- def gt_c(n: int | float | Fraction) -> Proc:
217
- return Proc(f"(>/c {n})", lambda i: i > n, (1, 1), is_real)
218
-
219
-
220
- def lte_c(n: int | float | Fraction) -> Proc:
221
- return Proc(f"(<=/c {n})", lambda i: i <= n, (1, 1), is_real)
222
-
223
-
224
- def lt_c(n: int | float | Fraction) -> Proc:
225
- return Proc(f"(</c {n})", lambda i: i < n, (1, 1), is_real)
226
-
227
-
228
- def between_c(n: Any, m: Any) -> Proc:
229
- if m > n:
230
- return Proc(
231
- f"(between/c {n} {m})", lambda i: is_real(i) and i <= m and i >= n, (1, 1)
232
- )
233
- return Proc(
234
- f"(between/c {n} {m})", lambda i: is_real(i) and i <= n and i >= m, (1, 1)
235
- )
@@ -1,278 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from collections.abc import Iterator
4
- from dataclasses import dataclass
5
- from fractions import Fraction
6
- from io import StringIO
7
- from typing import Any
8
-
9
- import numpy as np
10
-
11
-
12
- class NotFound:
13
- pass
14
-
15
-
16
- class Env:
17
- __slots__ = ("data", "outer")
18
-
19
- def __init__(self, data: dict[str, Any], outer: Env | None = None) -> None:
20
- self.data = data
21
- self.outer = outer
22
-
23
- def __getitem__(self, key: str) -> Any:
24
- if key in self.data:
25
- return self.data[key]
26
- if self.outer is not None:
27
- return self.outer[key]
28
-
29
- def __setitem__(self, key: str, val: Any) -> None:
30
- self.data[key] = val
31
-
32
- def __delitem__(self, key: str) -> None:
33
- if key in self.data:
34
- del self.data[key]
35
- elif self.outer is not None:
36
- del self.outer[key]
37
-
38
- def __contains__(self, key: str) -> bool:
39
- if key in self.data:
40
- return True
41
- if self.outer is not None:
42
- return key in self.outer
43
- return False
44
-
45
- def update(self, my_dict: dict[str, Any]) -> None:
46
- self.data.update(my_dict)
47
-
48
- def get(self, key: str) -> Any:
49
- if key in self.data:
50
- return self.data[key]
51
- if self.outer is not None:
52
- return self.outer.get(key)
53
- return NotFound()
54
-
55
-
56
- class Sym:
57
- __slots__ = ("val", "hash", "lineno", "column")
58
-
59
- def __init__(self, val: str, lineno: int = -1, column: int = -1):
60
- assert isinstance(val, str)
61
- self.val = val
62
- self.hash = hash(val)
63
- self.lineno = lineno
64
- self.column = column
65
-
66
- def __str__(self) -> str:
67
- return self.val
68
-
69
- __repr__ = __str__
70
-
71
- def __hash__(self) -> int:
72
- return self.hash
73
-
74
- def __eq__(self, obj: object) -> bool:
75
- return type(obj) is Sym and self.hash == obj.hash
76
-
77
-
78
- class Keyword:
79
- __slots__ = "val"
80
-
81
- def __init__(self, val: str):
82
- self.val = val
83
-
84
- def __str__(self) -> str:
85
- return f"#:{self.val}"
86
-
87
- __repr__ = __str__
88
-
89
- def __eq__(self, obj: object) -> bool:
90
- return type(obj) is Keyword and self.val == obj.val
91
-
92
-
93
- class QuotedKeyword:
94
- __slots__ = "val"
95
-
96
- def __init__(self, val: Keyword | str):
97
- self.val = val if isinstance(val, Keyword) else Keyword(val)
98
-
99
- def __str__(self) -> str:
100
- return f"{self.val}"
101
-
102
- __repr__ = __str__
103
-
104
- def __eq__(self, obj: object) -> bool:
105
- return type(obj) is QuotedKeyword and self.val == obj.val
106
-
107
-
108
- class Quoted:
109
- __slots__ = "val"
110
-
111
- def __init__(self, val: tuple):
112
- self.val = val
113
-
114
- def __len__(self) -> int:
115
- return len(self.val)
116
-
117
- def __getitem__(self, key: int | slice) -> Any:
118
- if isinstance(key, slice) or type(self.val[key]) is tuple:
119
- return Quoted(self.val[key])
120
-
121
- return self.val[key]
122
-
123
- def __iter__(self) -> Iterator:
124
- return self.val.__iter__()
125
-
126
- def __contains__(self, item: object) -> bool:
127
- return item in self.val
128
-
129
- def __eq__(self, obj: object) -> bool:
130
- return type(obj) is Quoted and self.val == obj.val
131
-
132
-
133
- class Char:
134
- __slots__ = "val"
135
-
136
- def __init__(self, val: str | int):
137
- if type(val) is int:
138
- self.val: str = chr(val)
139
- else:
140
- assert type(val) is str and len(val) == 1
141
- self.val = val
142
-
143
- def __str__(self) -> str:
144
- return self.val
145
-
146
- def __repr__(self) -> str:
147
- names = {" ": "space", "\n": "newline", "\t": "tab"}
148
- return f"#\\{self.val}" if self.val not in names else f"#\\{names[self.val]}"
149
-
150
- def __eq__(self, obj: object) -> bool:
151
- return type(obj) is Char and self.val == obj.val
152
-
153
- def __radd__(self, obj2: str) -> str:
154
- return obj2 + self.val
155
-
156
-
157
- def display_dtype(dtype: np.dtype) -> str:
158
- if dtype.kind == "b":
159
- return "bool"
160
-
161
- if dtype.kind == "i":
162
- return f"int{dtype.itemsize * 8}"
163
-
164
- if dtype.kind == "u":
165
- return f"uint{dtype.itemsize * 8}"
166
-
167
- return f"float{dtype.itemsize * 8}"
168
-
169
-
170
- def display_str(val: object) -> str:
171
- if val is None:
172
- return "#<void>"
173
- if val is True:
174
- return "#t"
175
- if val is False:
176
- return "#f"
177
- if type(val) is Sym:
178
- return val.val
179
- if type(val) is str:
180
- return val
181
- if type(val) is Char:
182
- return f"{val}"
183
- if type(val) is range:
184
- return "#<range>"
185
- if type(val) is np.bool_:
186
- return "1" if val else "0"
187
- if type(val) is np.float64 or type(val) is np.float32:
188
- return f"{float(val)}"
189
- if type(val) is Fraction:
190
- return f"{val.numerator}/{val.denominator}"
191
- if type(val) is Quoted or type(val) is tuple:
192
- if not val:
193
- return "()"
194
- result = StringIO()
195
- result.write(f"({display_str(val[0])}")
196
- for item in val[1:]:
197
- result.write(f" {display_str(item)}")
198
- result.write(")")
199
- return result.getvalue()
200
- if type(val) is list:
201
- if not val:
202
- return "#()"
203
- result = StringIO()
204
- result.write(f"#({print_str(val[0])}")
205
- for item in val[1:]:
206
- result.write(f" {print_str(item)}")
207
- result.write(")")
208
- return result.getvalue()
209
- if isinstance(val, dict):
210
- result = StringIO()
211
- result.write("#hash(")
212
- is_first = True
213
- for k, v in val.items():
214
- if is_first:
215
- result.write(f"[{print_str(k)} {print_str(v)}]")
216
- is_first = False
217
- else:
218
- result.write(f" [{print_str(k)} {print_str(v)}]")
219
- result.write(")")
220
- return result.getvalue()
221
- if isinstance(val, np.ndarray):
222
- result = StringIO()
223
- result.write(f"(array '{display_dtype(val.dtype)}")
224
- if val.dtype.kind == "b":
225
- for item in val:
226
- result.write(" 1" if item else " 0")
227
- else:
228
- for item in val:
229
- result.write(f" {item}")
230
- result.write(")")
231
- return result.getvalue()
232
-
233
- return f"{val!r}"
234
-
235
-
236
- str_escape = {
237
- "\\": "\\\\",
238
- '"': '\\"',
239
- "\r": "\\r",
240
- "\f": "\\f",
241
- "\v": "\\v",
242
- "\n": "\\n",
243
- "\t": "\\t",
244
- "\b": "\\b",
245
- "\a": "\\a",
246
- }
247
-
248
-
249
- def print_str(val: object) -> str:
250
- if type(val) is str:
251
- for k, v in str_escape.items():
252
- val = val.replace(k, v)
253
- return f'"{val}"'
254
- if type(val) is Char:
255
- return f"{val!r}"
256
- if type(val) is Keyword:
257
- return f"'{val}"
258
- if type(val) in (Sym, Quoted, QuotedKeyword):
259
- return f"'{display_str(val)}"
260
-
261
- return display_str(val)
262
-
263
-
264
- @dataclass(slots=True)
265
- class PaletClass:
266
- name: str
267
- attrs: tuple
268
- values: list
269
-
270
- def __str__(self) -> str:
271
- result = StringIO()
272
- result.write(f"({self.name}")
273
- for i, val in enumerate(self.values):
274
- result.write(f" #:{self.attrs[i * 2]} {print_str(val)}")
275
- result.write(")")
276
- return result.getvalue()
277
-
278
- __repr__ = __str__
auto_editor/lib/err.py DELETED
@@ -1,2 +0,0 @@
1
- class MyError(Exception):
2
- pass