sonolus.py 0.4.2__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 sonolus.py might be problematic. Click here for more details.
- sonolus/backend/optimize/constant_evaluation.py +2 -0
- sonolus/backend/visitor.py +27 -9
- sonolus/script/bucket.py +7 -0
- sonolus/script/internal/builtin_impls.py +7 -0
- sonolus/script/internal/impl.py +1 -0
- {sonolus_py-0.4.2.dist-info → sonolus_py-0.5.0.dist-info}/METADATA +1 -1
- {sonolus_py-0.4.2.dist-info → sonolus_py-0.5.0.dist-info}/RECORD +10 -10
- {sonolus_py-0.4.2.dist-info → sonolus_py-0.5.0.dist-info}/WHEEL +0 -0
- {sonolus_py-0.4.2.dist-info → sonolus_py-0.5.0.dist-info}/entry_points.txt +0 -0
- {sonolus_py-0.4.2.dist-info → sonolus_py-0.5.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -124,6 +124,8 @@ class SparseConditionalConstantPropagation(CompilerPass):
|
|
|
124
124
|
new_values.add(arg)
|
|
125
125
|
if len(new_values) == 1:
|
|
126
126
|
new_value = next(iter(new_values))
|
|
127
|
+
elif len(new_values) > 100:
|
|
128
|
+
new_value = NAC # Give up to save performance
|
|
127
129
|
else:
|
|
128
130
|
new_value = frozenset(new_values)
|
|
129
131
|
else:
|
sonolus/backend/visitor.py
CHANGED
|
@@ -13,7 +13,7 @@ from typing import Any, Never
|
|
|
13
13
|
from sonolus.backend.excepthook import install_excepthook
|
|
14
14
|
from sonolus.backend.utils import get_function, scan_writes
|
|
15
15
|
from sonolus.script.debug import assert_true
|
|
16
|
-
from sonolus.script.internal.builtin_impls import BUILTIN_IMPLS, _bool, _float, _int, _len
|
|
16
|
+
from sonolus.script.internal.builtin_impls import BUILTIN_IMPLS, _bool, _float, _int, _len, _super
|
|
17
17
|
from sonolus.script.internal.constant import ConstantValue
|
|
18
18
|
from sonolus.script.internal.context import Context, EmptyBinding, Scope, ValueBinding, ctx, set_ctx, using_ctx
|
|
19
19
|
from sonolus.script.internal.descriptor import SonolusDescriptor
|
|
@@ -1113,6 +1113,21 @@ class Visitor(ast.NodeVisitor):
|
|
|
1113
1113
|
kwargs.update(value.value)
|
|
1114
1114
|
else:
|
|
1115
1115
|
raise ValueError("Starred keyword arguments (**kwargs) must be dictionaries")
|
|
1116
|
+
if fn._is_py_() and fn._as_py_() is _super and not args and not kwargs and "__class__" in self.globals:
|
|
1117
|
+
class_value = self.get_name("__class__")
|
|
1118
|
+
first_param_name = next(
|
|
1119
|
+
(
|
|
1120
|
+
name
|
|
1121
|
+
for name, param in self.bound_args.signature.parameters.items()
|
|
1122
|
+
if param.kind in {inspect.Parameter.POSITIONAL_ONLY, inspect.Parameter.POSITIONAL_OR_KEYWORD}
|
|
1123
|
+
),
|
|
1124
|
+
None,
|
|
1125
|
+
)
|
|
1126
|
+
if first_param_name is not None:
|
|
1127
|
+
first_param_value = self.get_name(first_param_name)
|
|
1128
|
+
args = (validate_value(class_value), validate_value(first_param_value))
|
|
1129
|
+
else:
|
|
1130
|
+
args = (validate_value(class_value),)
|
|
1116
1131
|
return self.handle_call(node, fn, *args, **kwargs)
|
|
1117
1132
|
|
|
1118
1133
|
def visit_FormattedValue(self, node):
|
|
@@ -1136,23 +1151,26 @@ class Visitor(ast.NodeVisitor):
|
|
|
1136
1151
|
raise NotImplementedError("Starred expressions are not supported")
|
|
1137
1152
|
|
|
1138
1153
|
def visit_Name(self, node):
|
|
1139
|
-
|
|
1140
|
-
|
|
1154
|
+
return self.get_name(node.id)
|
|
1155
|
+
|
|
1156
|
+
def get_name(self, name: str):
|
|
1157
|
+
if name in self.used_parent_binding_values:
|
|
1158
|
+
return self.used_parent_binding_values[name]
|
|
1141
1159
|
self.active_ctx = ctx()
|
|
1142
1160
|
v = self
|
|
1143
1161
|
while v:
|
|
1144
|
-
if not isinstance(v.active_ctx.scope.get_binding(
|
|
1145
|
-
result = v.active_ctx.scope.get_value(
|
|
1162
|
+
if not isinstance(v.active_ctx.scope.get_binding(name), EmptyBinding):
|
|
1163
|
+
result = v.active_ctx.scope.get_value(name)
|
|
1146
1164
|
if v is not self:
|
|
1147
|
-
self.used_parent_binding_values[
|
|
1165
|
+
self.used_parent_binding_values[name] = result
|
|
1148
1166
|
return result
|
|
1149
1167
|
v = v.parent
|
|
1150
|
-
if
|
|
1151
|
-
value = self.globals[
|
|
1168
|
+
if name in self.globals:
|
|
1169
|
+
value = self.globals[name]
|
|
1152
1170
|
if value is ctx:
|
|
1153
1171
|
raise ValueError("Unexpected use of ctx in non meta-function")
|
|
1154
1172
|
return validate_value(BUILTIN_IMPLS.get(id(value), value))
|
|
1155
|
-
raise NameError(f"Name {
|
|
1173
|
+
raise NameError(f"Name {name} is not defined")
|
|
1156
1174
|
|
|
1157
1175
|
def visit_List(self, node):
|
|
1158
1176
|
raise NotImplementedError("List literals are not supported")
|
sonolus/script/bucket.py
CHANGED
|
@@ -103,9 +103,16 @@ class Judgment(IntEnum):
|
|
|
103
103
|
"""The judgment of a hit."""
|
|
104
104
|
|
|
105
105
|
MISS = 0
|
|
106
|
+
"""A miss. Breaks combo."""
|
|
107
|
+
|
|
106
108
|
PERFECT = 1
|
|
109
|
+
"""A perfect hit."""
|
|
110
|
+
|
|
107
111
|
GREAT = 2
|
|
112
|
+
"""A great hit."""
|
|
113
|
+
|
|
108
114
|
GOOD = 3
|
|
115
|
+
"""A good hit. Breaks combo."""
|
|
109
116
|
|
|
110
117
|
|
|
111
118
|
@native_function(Op.Judge)
|
|
@@ -377,6 +377,12 @@ def _iter(iterable):
|
|
|
377
377
|
return iterable.__iter__() # type: ignore # noqa: PLC2801
|
|
378
378
|
|
|
379
379
|
|
|
380
|
+
@meta_fn
|
|
381
|
+
def _super(*args):
|
|
382
|
+
"""Get the super class of a class or instance."""
|
|
383
|
+
return super(*(arg._as_py_() if arg._is_py_() else arg for arg in args))
|
|
384
|
+
|
|
385
|
+
|
|
380
386
|
# classmethod, property, staticmethod are supported as decorators, but not within functions
|
|
381
387
|
|
|
382
388
|
BUILTIN_IMPLS = {
|
|
@@ -399,6 +405,7 @@ BUILTIN_IMPLS = {
|
|
|
399
405
|
id(next): _next,
|
|
400
406
|
id(range): Range,
|
|
401
407
|
id(reversed): _reversed,
|
|
408
|
+
id(super): _super,
|
|
402
409
|
id(zip): _zip,
|
|
403
410
|
**MATH_BUILTIN_IMPLS, # Includes round
|
|
404
411
|
**RANDOM_BUILTIN_IMPLS,
|
sonolus/script/internal/impl.py
CHANGED
|
@@ -11,10 +11,10 @@ sonolus/backend/node.py,sha256=eEzPP14jzWJp2xrZCAaPlNtokxdoqg0bSM7xQiwx1j8,1254
|
|
|
11
11
|
sonolus/backend/ops.py,sha256=5weB_vIxbkwCSJuzYZyKUk7vVXsSIEDJYRlvE-2ke8A,10572
|
|
12
12
|
sonolus/backend/place.py,sha256=7qwV732hZ4WP-9GNN8FQSEKssPJZELip1wLXTWfop7Y,4717
|
|
13
13
|
sonolus/backend/utils.py,sha256=DDgYUVHh4h_eSY65v2KcxUaLSBYGYS6oHar5gTdV7QU,2356
|
|
14
|
-
sonolus/backend/visitor.py,sha256=
|
|
14
|
+
sonolus/backend/visitor.py,sha256=UAdp3Lg9kFVcFmBfn6rqpE9xM_CWBWlsB2o6OJiFqxQ,63193
|
|
15
15
|
sonolus/backend/optimize/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
sonolus/backend/optimize/allocate.py,sha256=CuumoMphkpQlGRNeKLHT4FBGE0XVj5pwhfNdrqiLFSs,7535
|
|
17
|
-
sonolus/backend/optimize/constant_evaluation.py,sha256=
|
|
17
|
+
sonolus/backend/optimize/constant_evaluation.py,sha256=U--9moGsXFzrgweWWwHIiEuuMzwetd1IOjjtrCscoNM,21450
|
|
18
18
|
sonolus/backend/optimize/copy_coalesce.py,sha256=45YL7QmRLL-FiQX4sDs56o4hyP7lX8KIJ0lIbyVw8h8,4549
|
|
19
19
|
sonolus/backend/optimize/dead_code.py,sha256=ZRJ95zJ49R-wZTzJtcSSbl5LYKHWI-byHM3n6jOyAqc,8307
|
|
20
20
|
sonolus/backend/optimize/dominance.py,sha256=3jAgXqXTbuYLpXvIm8UB06NkIOLtaoVp7pBVPcLb5vY,3259
|
|
@@ -37,7 +37,7 @@ sonolus/script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
37
37
|
sonolus/script/archetype.py,sha256=HJeKJ_vj7xUYaCAmNdGYO45rhFMSLMwOLyvpKjulfVY,42418
|
|
38
38
|
sonolus/script/array.py,sha256=9uOUHZIDMyMT9q3APcXJWXWt97yG-AZoRlxwrvSY6SU,12367
|
|
39
39
|
sonolus/script/array_like.py,sha256=jFOfXkniTLrIK4ER6HO_tUyKn_TvwjyM4B3SDd9cUS8,9678
|
|
40
|
-
sonolus/script/bucket.py,sha256=
|
|
40
|
+
sonolus/script/bucket.py,sha256=VxsSgHidYhY_Y5UXpBZY_tzjQff0TRgNJVj4Al8LVec,7654
|
|
41
41
|
sonolus/script/containers.py,sha256=WX0qRnr6gNtn3C0q7MwMyrzvY-C0Bd1tzLGxSkUwL9U,18680
|
|
42
42
|
sonolus/script/debug.py,sha256=_Hg1cXQJ8fBXMiwhmoPb2X9CKcQ8QO26WNa59K518og,4305
|
|
43
43
|
sonolus/script/easing.py,sha256=txf0OPFP5v7cOFDvJKCyKLK-d2uKIOu56ntLEHfD9QI,11377
|
|
@@ -68,7 +68,7 @@ sonolus/script/ui.py,sha256=DYPGWIjHj1IFPxW1zaEuIUQx0b32FJPXtiwCvrtJ6oo,7528
|
|
|
68
68
|
sonolus/script/values.py,sha256=6iJG6h4IDlbcK8FH4GENSHOQc7C_7fCGa34wM80qToA,1629
|
|
69
69
|
sonolus/script/vec.py,sha256=oVx5C5zGj8gX37F7y1FEJOrTYzb7EWfQWQuKU8KGLdc,7486
|
|
70
70
|
sonolus/script/internal/__init__.py,sha256=T6rzLoiOUaiSQtaHMZ88SNO-ijSjSSv33TKtUwu-Ms8,136
|
|
71
|
-
sonolus/script/internal/builtin_impls.py,sha256=
|
|
71
|
+
sonolus/script/internal/builtin_impls.py,sha256=POmWRyTQa-9mpQ_jATDYlFWo_n0a65vXAgqitkKYzGY,12870
|
|
72
72
|
sonolus/script/internal/callbacks.py,sha256=vWzJG8uiJoEtsNnbeZPqOHogCwoLpz2D1MnHY2wVV8s,2801
|
|
73
73
|
sonolus/script/internal/constant.py,sha256=3ycbGkDJVUwcrCZ96vLjAoAARgsvaqDM8rJ_YCrLrvo,4289
|
|
74
74
|
sonolus/script/internal/context.py,sha256=qn8xp5BB1C3IaUS8jsSUfkMUJgPzeaIV7K4FY9mHHQo,16903
|
|
@@ -76,7 +76,7 @@ sonolus/script/internal/descriptor.py,sha256=XRFey-EjiAm_--KsNl-8N0Mi_iyQwlPh68g
|
|
|
76
76
|
sonolus/script/internal/dict_impl.py,sha256=alu_wKGSk1kZajNf64qbe7t71shEzD4N5xNIATH8Swo,1885
|
|
77
77
|
sonolus/script/internal/error.py,sha256=ZNnsvQVQAnFKzcvsm6-sste2lo-tP5pPI8sD7XlAZWc,490
|
|
78
78
|
sonolus/script/internal/generic.py,sha256=F0-cCiRNGTaUJvYlpmkiOsU3Xge_XjoBpBwBhH_qS_s,7577
|
|
79
|
-
sonolus/script/internal/impl.py,sha256=
|
|
79
|
+
sonolus/script/internal/impl.py,sha256=alcFJs1yDx9ixEOxg-r_1IvWG2arMSUKSc-Eg9nAHOw,3255
|
|
80
80
|
sonolus/script/internal/introspection.py,sha256=MfdXo3GFHNZT2-vAKuvsE54V-5TOfbg4vU9dBI6sLqo,1032
|
|
81
81
|
sonolus/script/internal/math_impls.py,sha256=nHSLgA7Tcx7jY1p07mYBCeSRmVx713bwdNayCIcaXSE,2652
|
|
82
82
|
sonolus/script/internal/native.py,sha256=DQxmzxgLG_UsLpXhIEtBdO7eIeDFprU78UBDC4OZzw0,1597
|
|
@@ -86,8 +86,8 @@ sonolus/script/internal/simulation_context.py,sha256=LGxLTvxbqBIhoe1R-SfwGajNIDw
|
|
|
86
86
|
sonolus/script/internal/transient.py,sha256=y2AWABqF1aoaP6H4_2u4MMpNioC4OsZQCtPyNI0txqo,1634
|
|
87
87
|
sonolus/script/internal/tuple_impl.py,sha256=DPNdmmRmupU8Ah4_XKq6-PdT336l4nt15_uCJKQGkkk,3587
|
|
88
88
|
sonolus/script/internal/value.py,sha256=OngrCdmY_h6mV2Zgwqhuo4eYFad0kTk6263UAxctZcY,6963
|
|
89
|
-
sonolus_py-0.
|
|
90
|
-
sonolus_py-0.
|
|
91
|
-
sonolus_py-0.
|
|
92
|
-
sonolus_py-0.
|
|
93
|
-
sonolus_py-0.
|
|
89
|
+
sonolus_py-0.5.0.dist-info/METADATA,sha256=UCeZWEVfiGWGob4XES8cE9MgkmE44kD_6PJ-dVEQypI,302
|
|
90
|
+
sonolus_py-0.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
91
|
+
sonolus_py-0.5.0.dist-info/entry_points.txt,sha256=oTYspY_b7SA8TptEMTDxh4-Aj-ZVPnYC9f1lqH6s9G4,54
|
|
92
|
+
sonolus_py-0.5.0.dist-info/licenses/LICENSE,sha256=JEKpqVhQYfEc7zg3Mj462sKbKYmO1K7WmvX1qvg9IJk,1067
|
|
93
|
+
sonolus_py-0.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|