sonolus.py 0.1.3__py3-none-any.whl → 0.1.5__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 sonolus.py might be problematic. Click here for more details.
- sonolus/backend/blocks.py +756 -756
- sonolus/backend/excepthook.py +37 -37
- sonolus/backend/finalize.py +77 -69
- sonolus/backend/interpret.py +7 -7
- sonolus/backend/ir.py +29 -3
- sonolus/backend/mode.py +24 -24
- sonolus/backend/node.py +40 -40
- sonolus/backend/ops.py +197 -197
- sonolus/backend/optimize/__init__.py +0 -0
- sonolus/backend/optimize/allocate.py +126 -0
- sonolus/backend/optimize/constant_evaluation.py +374 -0
- sonolus/backend/optimize/copy_coalesce.py +85 -0
- sonolus/backend/optimize/dead_code.py +185 -0
- sonolus/backend/optimize/dominance.py +96 -0
- sonolus/backend/{flow.py → optimize/flow.py} +122 -92
- sonolus/backend/optimize/inlining.py +137 -0
- sonolus/backend/optimize/liveness.py +177 -0
- sonolus/backend/optimize/optimize.py +44 -0
- sonolus/backend/optimize/passes.py +52 -0
- sonolus/backend/optimize/simplify.py +191 -0
- sonolus/backend/optimize/ssa.py +200 -0
- sonolus/backend/place.py +17 -25
- sonolus/backend/utils.py +58 -48
- sonolus/backend/visitor.py +1151 -882
- sonolus/build/cli.py +7 -1
- sonolus/build/compile.py +88 -90
- sonolus/build/engine.py +10 -5
- sonolus/build/level.py +24 -23
- sonolus/build/node.py +43 -43
- sonolus/script/archetype.py +438 -139
- sonolus/script/array.py +27 -10
- sonolus/script/array_like.py +297 -0
- sonolus/script/bucket.py +253 -191
- sonolus/script/containers.py +257 -51
- sonolus/script/debug.py +26 -10
- sonolus/script/easing.py +365 -0
- sonolus/script/effect.py +191 -131
- sonolus/script/engine.py +71 -4
- sonolus/script/globals.py +303 -269
- sonolus/script/instruction.py +205 -151
- sonolus/script/internal/__init__.py +5 -5
- sonolus/script/internal/builtin_impls.py +255 -144
- sonolus/script/{callbacks.py → internal/callbacks.py} +127 -127
- sonolus/script/internal/constant.py +139 -0
- sonolus/script/internal/context.py +26 -9
- sonolus/script/internal/descriptor.py +17 -17
- sonolus/script/internal/dict_impl.py +65 -0
- sonolus/script/internal/generic.py +6 -9
- sonolus/script/internal/impl.py +38 -13
- sonolus/script/internal/introspection.py +17 -14
- sonolus/script/internal/math_impls.py +121 -0
- sonolus/script/internal/native.py +40 -38
- sonolus/script/internal/random.py +67 -0
- sonolus/script/internal/range.py +81 -0
- sonolus/script/internal/transient.py +51 -0
- sonolus/script/internal/tuple_impl.py +113 -0
- sonolus/script/internal/value.py +3 -3
- sonolus/script/interval.py +338 -112
- sonolus/script/iterator.py +167 -214
- sonolus/script/level.py +24 -0
- sonolus/script/num.py +80 -48
- sonolus/script/options.py +257 -191
- sonolus/script/particle.py +190 -157
- sonolus/script/pointer.py +30 -30
- sonolus/script/print.py +102 -81
- sonolus/script/project.py +8 -0
- sonolus/script/quad.py +263 -0
- sonolus/script/record.py +47 -16
- sonolus/script/runtime.py +52 -1
- sonolus/script/sprite.py +418 -333
- sonolus/script/text.py +409 -407
- sonolus/script/timing.py +114 -42
- sonolus/script/transform.py +332 -48
- sonolus/script/ui.py +216 -160
- sonolus/script/values.py +6 -13
- sonolus/script/vec.py +196 -78
- {sonolus_py-0.1.3.dist-info → sonolus_py-0.1.5.dist-info}/METADATA +1 -1
- sonolus_py-0.1.5.dist-info/RECORD +89 -0
- {sonolus_py-0.1.3.dist-info → sonolus_py-0.1.5.dist-info}/WHEEL +1 -1
- {sonolus_py-0.1.3.dist-info → sonolus_py-0.1.5.dist-info}/licenses/LICENSE +21 -21
- sonolus/backend/allocate.py +0 -51
- sonolus/backend/optimize.py +0 -9
- sonolus/backend/passes.py +0 -6
- sonolus/backend/simplify.py +0 -30
- sonolus/script/comptime.py +0 -160
- sonolus/script/graphics.py +0 -150
- sonolus/script/math.py +0 -92
- sonolus/script/range.py +0 -58
- sonolus_py-0.1.3.dist-info/RECORD +0 -75
- {sonolus_py-0.1.3.dist-info → sonolus_py-0.1.5.dist-info}/entry_points.txt +0 -0
sonolus/script/comptime.py
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
from collections.abc import Iterable
|
|
2
|
-
from typing import TYPE_CHECKING, Any, Self, TypeVar, final
|
|
3
|
-
|
|
4
|
-
from sonolus.backend.place import BlockPlace
|
|
5
|
-
from sonolus.script.internal.generic import GenericValue
|
|
6
|
-
from sonolus.script.internal.impl import meta_fn, validate_value
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@final
|
|
10
|
-
class _Comptime[T, V](GenericValue):
|
|
11
|
-
_instance: Self | None = None
|
|
12
|
-
|
|
13
|
-
def __init__(self):
|
|
14
|
-
super().__init__()
|
|
15
|
-
raise TypeError("Comptime cannot be instantiated")
|
|
16
|
-
|
|
17
|
-
@classmethod
|
|
18
|
-
def value(cls):
|
|
19
|
-
_, value = cls._type_args_
|
|
20
|
-
if isinstance(value, Identity):
|
|
21
|
-
return value.value
|
|
22
|
-
return value
|
|
23
|
-
|
|
24
|
-
@classmethod
|
|
25
|
-
def _get_parameterized(cls, args: tuple[Any, ...]) -> type[Self]:
|
|
26
|
-
result = super()._get_parameterized(args)
|
|
27
|
-
result._instance = object.__new__(result)
|
|
28
|
-
return result
|
|
29
|
-
|
|
30
|
-
@classmethod
|
|
31
|
-
def _size_(cls) -> int:
|
|
32
|
-
return 0
|
|
33
|
-
|
|
34
|
-
@classmethod
|
|
35
|
-
def _is_value_type_(cls) -> bool:
|
|
36
|
-
return False
|
|
37
|
-
|
|
38
|
-
@classmethod
|
|
39
|
-
def _from_place_(cls, place: BlockPlace) -> Self:
|
|
40
|
-
return cls._instance
|
|
41
|
-
|
|
42
|
-
@classmethod
|
|
43
|
-
def _accepts_(cls, value: Any) -> bool:
|
|
44
|
-
from sonolus.script.internal.impl import validate_value
|
|
45
|
-
|
|
46
|
-
value = validate_value(value)
|
|
47
|
-
if not value._is_py_():
|
|
48
|
-
return False
|
|
49
|
-
if cls._type_args_ is None:
|
|
50
|
-
return True
|
|
51
|
-
return value._as_py_() == cls.value()
|
|
52
|
-
|
|
53
|
-
@classmethod
|
|
54
|
-
def _accept_(cls, value: Any) -> Self:
|
|
55
|
-
from sonolus.script.internal.impl import validate_value
|
|
56
|
-
|
|
57
|
-
if not cls._accepts_(value):
|
|
58
|
-
raise TypeError("Value does not match this Comptime instance")
|
|
59
|
-
# This might not actually return a Comptime instance, but it will be a compile-time constant
|
|
60
|
-
return validate_value(value)
|
|
61
|
-
|
|
62
|
-
def _is_py_(self) -> bool:
|
|
63
|
-
return True
|
|
64
|
-
|
|
65
|
-
def _as_py_(self) -> Any:
|
|
66
|
-
return self.value()
|
|
67
|
-
|
|
68
|
-
@classmethod
|
|
69
|
-
def _from_list_(cls, values: Iterable[float | BlockPlace]) -> Self:
|
|
70
|
-
return cls._instance
|
|
71
|
-
|
|
72
|
-
def _to_list_(self) -> list[float | BlockPlace]:
|
|
73
|
-
return []
|
|
74
|
-
|
|
75
|
-
@classmethod
|
|
76
|
-
def _flat_keys_(cls, prefix: str) -> list[str]:
|
|
77
|
-
return []
|
|
78
|
-
|
|
79
|
-
def _get_(self) -> Self:
|
|
80
|
-
from sonolus.script.internal.impl import validate_value
|
|
81
|
-
|
|
82
|
-
# Converts numbers out of comptime, although _accept_ may end up returning a non-comptime instance anyway
|
|
83
|
-
return validate_value(self.value())
|
|
84
|
-
|
|
85
|
-
def _set_(self, value: Self):
|
|
86
|
-
if value is not self:
|
|
87
|
-
raise TypeError("Comptime value cannot be changed")
|
|
88
|
-
|
|
89
|
-
def _copy_from_(self, value: Self):
|
|
90
|
-
if value is not self:
|
|
91
|
-
raise TypeError("Comptime value cannot be changed")
|
|
92
|
-
|
|
93
|
-
def _copy_(self) -> Self:
|
|
94
|
-
return self
|
|
95
|
-
|
|
96
|
-
@meta_fn
|
|
97
|
-
def __eq__(self, other):
|
|
98
|
-
other = validate_value(other)
|
|
99
|
-
match self.value():
|
|
100
|
-
case str():
|
|
101
|
-
return other._is_py_() and other._as_py_() == self.value()
|
|
102
|
-
case _:
|
|
103
|
-
raise TypeError("Unsupported comparison with comptime value")
|
|
104
|
-
|
|
105
|
-
@meta_fn
|
|
106
|
-
def __hash__(self):
|
|
107
|
-
return hash(self.value())
|
|
108
|
-
|
|
109
|
-
@classmethod
|
|
110
|
-
def _alloc_(cls) -> Self:
|
|
111
|
-
return cls._instance
|
|
112
|
-
|
|
113
|
-
@classmethod
|
|
114
|
-
def _validate__type_args_(cls, args: tuple[Any, ...]) -> tuple[Any, ...]:
|
|
115
|
-
if len(args) == 2:
|
|
116
|
-
_, value = args
|
|
117
|
-
# We want the type to be there for documentation,
|
|
118
|
-
# but not enforced since they might not match up, e.g. a Callable is really FunctionType
|
|
119
|
-
if isinstance(value, TypeVar):
|
|
120
|
-
args = Any, value
|
|
121
|
-
else:
|
|
122
|
-
args = type(value), value
|
|
123
|
-
return super()._validate__type_args_(args)
|
|
124
|
-
|
|
125
|
-
@classmethod
|
|
126
|
-
def accept_unchecked(cls, value: Any) -> Self:
|
|
127
|
-
if isinstance(value, dict | tuple):
|
|
128
|
-
args = type(value), Identity(value)
|
|
129
|
-
else:
|
|
130
|
-
args = type(value), value
|
|
131
|
-
if args not in cls._parameterized_:
|
|
132
|
-
cls._parameterized_[args] = cls._get_parameterized(args)
|
|
133
|
-
return cls._parameterized_[args]._instance
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
class Identity[T]: # This is to allow accepting potentially unhashable values by using identity comparison
|
|
137
|
-
value: T
|
|
138
|
-
|
|
139
|
-
def __init__(self, value: T):
|
|
140
|
-
self.value = value
|
|
141
|
-
|
|
142
|
-
def __eq__(self, other):
|
|
143
|
-
return self is other
|
|
144
|
-
|
|
145
|
-
def __hash__(self):
|
|
146
|
-
return id(self)
|
|
147
|
-
|
|
148
|
-
def __str__(self):
|
|
149
|
-
return f"{type(self).__name__}({self.value})"
|
|
150
|
-
|
|
151
|
-
def __repr__(self):
|
|
152
|
-
return f"{type(self).__name__}({self.value!r})"
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if TYPE_CHECKING:
|
|
156
|
-
type Comptime[T, V] = T | V
|
|
157
|
-
else:
|
|
158
|
-
_Comptime.__name__ = "Comptime"
|
|
159
|
-
_Comptime.__qualname__ = "Comptime"
|
|
160
|
-
globals()["Comptime"] = _Comptime
|
sonolus/script/graphics.py
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Protocol, Self
|
|
4
|
-
|
|
5
|
-
from sonolus.script.record import Record
|
|
6
|
-
from sonolus.script.vec import Vec2
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Quad(Record):
|
|
10
|
-
bl: Vec2
|
|
11
|
-
tl: Vec2
|
|
12
|
-
tr: Vec2
|
|
13
|
-
br: Vec2
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class Rect(Record):
|
|
17
|
-
t: float
|
|
18
|
-
r: float
|
|
19
|
-
b: float
|
|
20
|
-
l: float # noqa: E741
|
|
21
|
-
|
|
22
|
-
@classmethod
|
|
23
|
-
def from_center(cls, center: Vec2, dimensions: Vec2) -> Rect:
|
|
24
|
-
return cls(
|
|
25
|
-
t=center.y + dimensions.y / 2,
|
|
26
|
-
r=center.x + dimensions.x / 2,
|
|
27
|
-
b=center.y - dimensions.y / 2,
|
|
28
|
-
l=center.x - dimensions.x / 2,
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
@property
|
|
32
|
-
def x(self) -> float:
|
|
33
|
-
return self.l
|
|
34
|
-
|
|
35
|
-
@x.setter
|
|
36
|
-
def x(self, value: float):
|
|
37
|
-
self.r += value - self.l
|
|
38
|
-
self.l = value
|
|
39
|
-
|
|
40
|
-
@property
|
|
41
|
-
def y(self) -> float:
|
|
42
|
-
return self.t
|
|
43
|
-
|
|
44
|
-
@y.setter
|
|
45
|
-
def y(self, value: float):
|
|
46
|
-
self.b += value - self.t
|
|
47
|
-
self.t = value
|
|
48
|
-
|
|
49
|
-
@property
|
|
50
|
-
def w(self) -> float:
|
|
51
|
-
return self.r - self.l
|
|
52
|
-
|
|
53
|
-
@w.setter
|
|
54
|
-
def w(self, value: float):
|
|
55
|
-
self.r = self.l + value
|
|
56
|
-
|
|
57
|
-
@property
|
|
58
|
-
def h(self) -> float:
|
|
59
|
-
return self.t - self.b
|
|
60
|
-
|
|
61
|
-
@h.setter
|
|
62
|
-
def h(self, value: float):
|
|
63
|
-
self.t = self.b + value
|
|
64
|
-
|
|
65
|
-
@property
|
|
66
|
-
def bl(self) -> Vec2:
|
|
67
|
-
return Vec2(self.l, self.b)
|
|
68
|
-
|
|
69
|
-
@property
|
|
70
|
-
def tl(self) -> Vec2:
|
|
71
|
-
return Vec2(self.l, self.t)
|
|
72
|
-
|
|
73
|
-
@property
|
|
74
|
-
def tr(self) -> Vec2:
|
|
75
|
-
return Vec2(self.r, self.t)
|
|
76
|
-
|
|
77
|
-
@property
|
|
78
|
-
def br(self) -> Vec2:
|
|
79
|
-
return Vec2(self.r, self.b)
|
|
80
|
-
|
|
81
|
-
@property
|
|
82
|
-
def center(self) -> Vec2:
|
|
83
|
-
return Vec2((self.l + self.r) / 2, (self.t + self.b) / 2)
|
|
84
|
-
|
|
85
|
-
def as_quad(self) -> Quad:
|
|
86
|
-
return Quad(
|
|
87
|
-
bl=self.bl,
|
|
88
|
-
tl=self.tl,
|
|
89
|
-
tr=self.tr,
|
|
90
|
-
br=self.br,
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
def scale(self, factor: Vec2, /) -> Self:
|
|
94
|
-
return Rect(
|
|
95
|
-
t=self.t * factor.y,
|
|
96
|
-
r=self.r * factor.x,
|
|
97
|
-
b=self.b * factor.y,
|
|
98
|
-
l=self.l * factor.x,
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
def expand(self, expansion: Vec2, /) -> Self:
|
|
102
|
-
return Rect(
|
|
103
|
-
t=self.t + expansion.y,
|
|
104
|
-
r=self.r + expansion.x,
|
|
105
|
-
b=self.b - expansion.y,
|
|
106
|
-
l=self.l - expansion.x,
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
def shrink(self, shrinkage: Vec2, /) -> Self:
|
|
110
|
-
return Rect(
|
|
111
|
-
t=self.t - shrinkage.y,
|
|
112
|
-
r=self.r - shrinkage.x,
|
|
113
|
-
b=self.b + shrinkage.y,
|
|
114
|
-
l=self.l + shrinkage.x,
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
def translate(self, translation: Vec2, /) -> Self:
|
|
118
|
-
return Rect(
|
|
119
|
-
t=self.t + translation.y,
|
|
120
|
-
r=self.r + translation.x,
|
|
121
|
-
b=self.b + translation.y,
|
|
122
|
-
l=self.l + translation.x,
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
class QuadLike(Protocol):
|
|
127
|
-
@property
|
|
128
|
-
def bl(self) -> Vec2: ...
|
|
129
|
-
|
|
130
|
-
@property
|
|
131
|
-
def tl(self) -> Vec2: ...
|
|
132
|
-
|
|
133
|
-
@property
|
|
134
|
-
def tr(self) -> Vec2: ...
|
|
135
|
-
|
|
136
|
-
@property
|
|
137
|
-
def br(self) -> Vec2: ...
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
def flatten_quad(quad: QuadLike) -> tuple[float, float, float, float, float, float, float, float]:
|
|
141
|
-
return (
|
|
142
|
-
quad.bl.x,
|
|
143
|
-
quad.bl.y,
|
|
144
|
-
quad.tl.x,
|
|
145
|
-
quad.tl.y,
|
|
146
|
-
quad.tr.x,
|
|
147
|
-
quad.tr.y,
|
|
148
|
-
quad.br.x,
|
|
149
|
-
quad.br.y,
|
|
150
|
-
)
|
sonolus/script/math.py
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import math
|
|
2
|
-
|
|
3
|
-
from sonolus.backend.ops import Op
|
|
4
|
-
from sonolus.script.internal.native import native_function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@native_function(Op.Sin)
|
|
8
|
-
def sin(x: float) -> float:
|
|
9
|
-
return math.sin(x)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@native_function(Op.Cos)
|
|
13
|
-
def cos(x: float) -> float:
|
|
14
|
-
return math.cos(x)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@native_function(Op.Tan)
|
|
18
|
-
def tan(x: float) -> float:
|
|
19
|
-
return math.tan(x)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@native_function(Op.Arcsin)
|
|
23
|
-
def asin(x: float) -> float:
|
|
24
|
-
return math.asin(x)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@native_function(Op.Arccos)
|
|
28
|
-
def acos(x: float) -> float:
|
|
29
|
-
return math.acos(x)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@native_function(Op.Arctan)
|
|
33
|
-
def atan(x: float) -> float:
|
|
34
|
-
return math.atan(x)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
@native_function(Op.Arctan2)
|
|
38
|
-
def atan2(y: float, x: float) -> float:
|
|
39
|
-
return math.atan2(y, x)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
@native_function(Op.Sinh)
|
|
43
|
-
def sinh(x: float) -> float:
|
|
44
|
-
return math.sinh(x)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
@native_function(Op.Cosh)
|
|
48
|
-
def cosh(x: float) -> float:
|
|
49
|
-
return math.cosh(x)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
@native_function(Op.Tanh)
|
|
53
|
-
def tanh(x: float) -> float:
|
|
54
|
-
return math.tanh(x)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@native_function(Op.Floor)
|
|
58
|
-
def floor(x: float) -> float:
|
|
59
|
-
return math.floor(x)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
@native_function(Op.Ceil)
|
|
63
|
-
def ceil(x: float) -> float:
|
|
64
|
-
return math.ceil(x)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
@native_function(Op.Trunc)
|
|
68
|
-
def trunc(x: float) -> float:
|
|
69
|
-
return math.trunc(x)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
@native_function(Op.Round)
|
|
73
|
-
def _round(x: float) -> float:
|
|
74
|
-
return round(x)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
MATH_BUILTIN_IMPLS = {
|
|
78
|
-
id(math.sin): sin,
|
|
79
|
-
id(math.cos): cos,
|
|
80
|
-
id(math.tan): tan,
|
|
81
|
-
id(math.asin): asin,
|
|
82
|
-
id(math.acos): acos,
|
|
83
|
-
id(math.atan): atan,
|
|
84
|
-
id(math.atan2): atan2,
|
|
85
|
-
id(math.sinh): sinh,
|
|
86
|
-
id(math.cosh): cosh,
|
|
87
|
-
id(math.tanh): tanh,
|
|
88
|
-
id(math.floor): floor,
|
|
89
|
-
id(math.ceil): ceil,
|
|
90
|
-
id(math.trunc): trunc,
|
|
91
|
-
id(round): _round,
|
|
92
|
-
}
|
sonolus/script/range.py
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
from sonolus.script.iterator import ArrayLike, SonolusIterator
|
|
2
|
-
from sonolus.script.num import Num
|
|
3
|
-
from sonolus.script.record import Record
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Range(Record, ArrayLike[Num]):
|
|
7
|
-
start: int
|
|
8
|
-
end: int
|
|
9
|
-
step: int
|
|
10
|
-
|
|
11
|
-
def __new__(cls, start: Num, end: Num | None = None, step: Num = 1):
|
|
12
|
-
if end is None:
|
|
13
|
-
start, end = 0, start
|
|
14
|
-
return super().__new__(cls, start, end, step)
|
|
15
|
-
|
|
16
|
-
def __iter__(self) -> SonolusIterator:
|
|
17
|
-
return RangeIterator(self.start, self.end, self.step)
|
|
18
|
-
|
|
19
|
-
def __contains__(self, item):
|
|
20
|
-
if self.step > 0:
|
|
21
|
-
return self.start <= item < self.end and (item - self.start) % self.step == 0
|
|
22
|
-
else:
|
|
23
|
-
return self.end < item <= self.start and (self.start - item) % -self.step == 0
|
|
24
|
-
|
|
25
|
-
def size(self) -> int:
|
|
26
|
-
if self.step > 0:
|
|
27
|
-
diff = self.end - self.start
|
|
28
|
-
if diff <= 0:
|
|
29
|
-
return 0
|
|
30
|
-
return (diff + self.step - 1) // self.step
|
|
31
|
-
else:
|
|
32
|
-
diff = self.start - self.end
|
|
33
|
-
if diff <= 0:
|
|
34
|
-
return 0
|
|
35
|
-
return (diff - self.step - 1) // -self.step
|
|
36
|
-
|
|
37
|
-
def __getitem__(self, index: Num) -> Num:
|
|
38
|
-
return self.start + index * self.step
|
|
39
|
-
|
|
40
|
-
def __setitem__(self, index: Num, value: Num):
|
|
41
|
-
raise TypeError("Range does not support item assignment")
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class RangeIterator(Record, SonolusIterator):
|
|
45
|
-
value: int
|
|
46
|
-
end: int
|
|
47
|
-
step: int
|
|
48
|
-
|
|
49
|
-
def has_next(self) -> bool:
|
|
50
|
-
if self.step > 0:
|
|
51
|
-
return self.value < self.end
|
|
52
|
-
else:
|
|
53
|
-
return self.value > self.end
|
|
54
|
-
|
|
55
|
-
def next(self) -> Num:
|
|
56
|
-
value = self.value
|
|
57
|
-
self.value += self.step
|
|
58
|
-
return value
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
sonolus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
sonolus/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
sonolus/backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
sonolus/backend/allocate.py,sha256=3Y2UNGt9Nh3DLr88L1DLhvyavm6R_bg0sMN_d1XzANs,2154
|
|
5
|
-
sonolus/backend/blocks.py,sha256=LR1fAXUGcsVuh03YNUpcVzz8P9sNbhL1ki3Dq57mK8I,19287
|
|
6
|
-
sonolus/backend/excepthook.py,sha256=8tkzohxvkrUq_KbG48SuWdlEPNZKxcvYlwj7fXWFA1g,1031
|
|
7
|
-
sonolus/backend/finalize.py,sha256=4At9fA7zaZsrFSfz9uyYCZIFUb10u16o6d-3wfg2XLw,3399
|
|
8
|
-
sonolus/backend/flow.py,sha256=NtejFHC2LAmCwlYfyfnDZLnwvEyrVV_Dm4RGglBG6U0,3216
|
|
9
|
-
sonolus/backend/interpret.py,sha256=EDpkv3ASzteDhYjTkzoriGYHYepcoHKZusrU_FX0DS4,14247
|
|
10
|
-
sonolus/backend/ir.py,sha256=_D5CXsUxUX2VWkWU1z5ji8czrhTz0ieQ8L6VjtuxaKs,1994
|
|
11
|
-
sonolus/backend/mode.py,sha256=H2sjHaEtBxslUGdqBW-9AT444DuR6B6IzVdcHRlz_BE,637
|
|
12
|
-
sonolus/backend/node.py,sha256=BJqEaI_u8pdPNjgUZO9o8dGTn_vyo9x71AN5v4zJjdc,1039
|
|
13
|
-
sonolus/backend/ops.py,sha256=k2YPLSDl4RagJ2Hyz91nZKlrWflMoXovCRjcwyhWmY0,10319
|
|
14
|
-
sonolus/backend/optimize.py,sha256=qLOJ6XEZsOKOTQhzHWPNObsBKTHDHhVke9ZGmnukrhY,284
|
|
15
|
-
sonolus/backend/passes.py,sha256=3NiVnT0KQA1lVEuR9wzcGB6CccVe4A-C3D_JOnGsetI,137
|
|
16
|
-
sonolus/backend/place.py,sha256=61mWyPQ6i59bmV9RtQfUy6mJE0pMAmFoL1W-MyY79ug,2536
|
|
17
|
-
sonolus/backend/simplify.py,sha256=0SLsReWyxwpI2qyGn0JtQWyv3J-4DDyCkmiqP5ZvSV8,1122
|
|
18
|
-
sonolus/backend/utils.py,sha256=AVYidUYSp5H8pbPKEzAZ0Ccorb3nYDU6zFcc6JBtuLs,1430
|
|
19
|
-
sonolus/backend/visitor.py,sha256=XfqhPc421atro7RYDR7nrlETfRc8Uoi9l2feNO8o_FA,36515
|
|
20
|
-
sonolus/build/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
-
sonolus/build/cli.py,sha256=8PSn8h-UmYGCjE2LAFU_5J3tMapKxCw09kzRTBomSFs,5545
|
|
22
|
-
sonolus/build/collection.py,sha256=IsDgedsAJ-foHzQ4LnQ9zSVXSz5wVVt4sgqiUICBvCU,10573
|
|
23
|
-
sonolus/build/compile.py,sha256=a1NjzvjFT2y6x9fL9kaiZgIus3egY8gk_WBr7EeSS68,3679
|
|
24
|
-
sonolus/build/engine.py,sha256=C0xKUikTKETg2SaPGQpcq4MBhPK-JAkbD1dTPvT47Y0,6732
|
|
25
|
-
sonolus/build/level.py,sha256=Ko3XI3T8dpUmUOnxpAW27-1QCT2bkqXaW5GCiVKsfP0,546
|
|
26
|
-
sonolus/build/node.py,sha256=3217uAzOz1KZ9VjOkcGO_Tdarvqwvl-F4sKPwx42QQ0,1205
|
|
27
|
-
sonolus/build/project.py,sha256=x350tPcwKCYakdbrP796b545hVUaBwrzY0yEcQR7ut4,4023
|
|
28
|
-
sonolus/script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
|
-
sonolus/script/archetype.py,sha256=q2WXhKuVGWnbBf9EjCRVhVOx6_N8nW1IV1AQaGVWurE,24812
|
|
30
|
-
sonolus/script/array.py,sha256=ithYhBG69KTqooZlV7nVQXqrqKtgKL4KJKQ3ZzxTZwg,8914
|
|
31
|
-
sonolus/script/bucket.py,sha256=HD1DbthZbqvU_7Iy5nw0_Ua3Fm00QIQkx019CHBp--I,5547
|
|
32
|
-
sonolus/script/callbacks.py,sha256=dkBudnZKM0oBXwMtNtVsusa8B_N_70mjCYi1zSUlnzg,2928
|
|
33
|
-
sonolus/script/comptime.py,sha256=hR-rF9GXHcWBWIs9IsSr2V5ZZmHGotyzwEJqDJJGj10,4692
|
|
34
|
-
sonolus/script/containers.py,sha256=yl6PlX840Km4SQRPGqy95h9Ol32Z-dYEO3ZzJB14dKc,7093
|
|
35
|
-
sonolus/script/debug.py,sha256=WrfVFyQsirTu1q87_xhu3mPhFE1ZQXv9EbGCIhY4Hqs,1969
|
|
36
|
-
sonolus/script/effect.py,sha256=m_S--gubthQgoKHdMjZ4t4SAcjF72lxa614p9b1T7vE,4146
|
|
37
|
-
sonolus/script/engine.py,sha256=7BHzBJFYPxJYOIvR9k6X8FV1oQAGcLNBzqaz3O6v_8Y,4758
|
|
38
|
-
sonolus/script/globals.py,sha256=3lvPCy9bA_0dARkTy-xrpQUXTQfynojWWhveuRMdLyI,8666
|
|
39
|
-
sonolus/script/graphics.py,sha256=C82hg9cu7sgs0tuWeta7l_ki6pYhaKpnBBPGfwYXozY,3334
|
|
40
|
-
sonolus/script/instruction.py,sha256=lH3jHFamxLhvRPsw9E3sXSNa0X1nKsIw0sYzFv0SVrM,5549
|
|
41
|
-
sonolus/script/interval.py,sha256=KD3Rf8VGCTjVbt8aFUYRM46oJA3rpULhlZXYFhs-ECM,3194
|
|
42
|
-
sonolus/script/iterator.py,sha256=WlPmRGC2Xd1ugMIGDkBIkIQdLTpAOUrBTn11H7c_LSo,5513
|
|
43
|
-
sonolus/script/level.py,sha256=lcC6zHg3kp8Vm-pG96zASVPG16JeOp3ZR907snXdy18,1249
|
|
44
|
-
sonolus/script/math.py,sha256=2HNKoIN6CV8J_1jsnxItXWQn8eUjlfvbPbMEav9li10,1636
|
|
45
|
-
sonolus/script/num.py,sha256=RQv0VhX3nk69hh5sGsBaF_ZiNl9sr_xAnIt0Arjh_e4,12449
|
|
46
|
-
sonolus/script/options.py,sha256=qoY_IcwnchqUPaw9IE_-j1vNPC3j0yuGVUqitCdzSk0,5702
|
|
47
|
-
sonolus/script/particle.py,sha256=4ZLNymqORniHnczm3_yRPrVjy_tx4TXTpGO-BMfLmhg,7544
|
|
48
|
-
sonolus/script/pointer.py,sha256=bN4UzR7gwe3N_qJ0CXr9NLsuDKzgdkHJxKtOzNokAiE,1145
|
|
49
|
-
sonolus/script/print.py,sha256=s3yJ0jj9xxkkOg1PimO5PyIfD0WnSZkS8q9X8juSTTo,1645
|
|
50
|
-
sonolus/script/project.py,sha256=7K3iwUdSXAQyEAwcZvtfxgv3M0IaUaXSroUBEj4dnuA,416
|
|
51
|
-
sonolus/script/range.py,sha256=EgdEJYeoq2chD0xCJs2oZZhM_ubWHOzZZwvAZmXxQLs,1753
|
|
52
|
-
sonolus/script/record.py,sha256=l4h4mubPevUAW4oKQpz-ZNXea9EbsbSv9je_KV5CIPE,10381
|
|
53
|
-
sonolus/script/runtime.py,sha256=1eziaNIXGrtQIbi-Y5viV5lossCkkpRGVORFiO6UKBI,17020
|
|
54
|
-
sonolus/script/sprite.py,sha256=-tKIeOVkX1tIcAn0sgbuaURiFA_dKiHt3aDeDCgHY2Y,13322
|
|
55
|
-
sonolus/script/text.py,sha256=V2ijaTp9SJF-bThyZFn70M7wm6ZQrUtZv6uUprcZYBY,13396
|
|
56
|
-
sonolus/script/timing.py,sha256=qSkoU7bVNaCFPUwpVUMr44xP75h2bapPoIHDsGEReWU,1070
|
|
57
|
-
sonolus/script/transform.py,sha256=9c6DKd8SF1KwVLU7Q2M4rOup8QGSuCVIA8UA9SOzx08,3148
|
|
58
|
-
sonolus/script/ui.py,sha256=eOVqH-6BeRwMbe7ePQWjMIJEvrP1gKQMXhWt7v2OClo,4648
|
|
59
|
-
sonolus/script/values.py,sha256=TyRxHjuvtXlQpKGyVRg0T8fJgXMboKY4TZxQ3lFR4bs,1261
|
|
60
|
-
sonolus/script/vec.py,sha256=oOwTUOqAPsInoQzcoXm1eX7-o5ePTsYnmjJLbhqZ2_s,2086
|
|
61
|
-
sonolus/script/internal/__init__.py,sha256=ZMWLy_WIuYQv0HRquCLoeCidiOpar4J2GojnhBSrxGs,141
|
|
62
|
-
sonolus/script/internal/builtin_impls.py,sha256=tKg_iZoeGCSAL667_V3euZrf0K0wc4nY9__8Q0AIwYM,4156
|
|
63
|
-
sonolus/script/internal/context.py,sha256=r6Igx4rXT7_aBB04GJjJolDdCbyZX39qVKRl8vG_bjc,12650
|
|
64
|
-
sonolus/script/internal/descriptor.py,sha256=mlgUVKS2R4Nt1gpDH-Q1YyJHuZDR5i6TcjiszfY-yzE,409
|
|
65
|
-
sonolus/script/internal/error.py,sha256=ZNnsvQVQAnFKzcvsm6-sste2lo-tP5pPI8sD7XlAZWc,490
|
|
66
|
-
sonolus/script/internal/generic.py,sha256=-rhFatYZLrDE3RFgDWu_Zto3funHXmMr3QuyxajaWKU,7356
|
|
67
|
-
sonolus/script/internal/impl.py,sha256=tnIaQCmw0SlFpmnSJp2aEys9XVxoj0Vi8Yf6SP-oUAQ,2321
|
|
68
|
-
sonolus/script/internal/introspection.py,sha256=9e_flldywaB5g1FdLnfLfQcL3s4nQ50E5iFlA-5FF_w,558
|
|
69
|
-
sonolus/script/internal/native.py,sha256=af2YokZLtt30Jipo2dAY9PU9Fajz-12VoFOrnCgxSvk,1391
|
|
70
|
-
sonolus/script/internal/value.py,sha256=ftmxr228XRSt2KNsR8KsXMw7vDP1jdwKEMb1PE0bpCA,4214
|
|
71
|
-
sonolus_py-0.1.3.dist-info/METADATA,sha256=DQ-TskBD7EQZLQ26DYmrrvJ9Dg6VlfxWTd2529sd41U,216
|
|
72
|
-
sonolus_py-0.1.3.dist-info/WHEEL,sha256=3U_NnUcV_1B1kPkYaPzN-irRckL5VW_lytn0ytO_kRY,87
|
|
73
|
-
sonolus_py-0.1.3.dist-info/entry_points.txt,sha256=oTYspY_b7SA8TptEMTDxh4-Aj-ZVPnYC9f1lqH6s9G4,54
|
|
74
|
-
sonolus_py-0.1.3.dist-info/licenses/LICENSE,sha256=AhIgObMNjnAgjfJIea2c-0PDItKwP71hg4WFVAKh1ew,1088
|
|
75
|
-
sonolus_py-0.1.3.dist-info/RECORD,,
|
|
File without changes
|