sonolus.py 0.6.1__py3-none-any.whl → 0.6.3__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/script/array_like.py +2 -2
- sonolus/script/containers.py +7 -5
- sonolus/script/effect.py +1 -0
- sonolus/script/globals.py +4 -1
- sonolus/script/internal/builtin_impls.py +1 -1
- sonolus/script/particle.py +1 -0
- {sonolus_py-0.6.1.dist-info → sonolus_py-0.6.3.dist-info}/METADATA +1 -1
- {sonolus_py-0.6.1.dist-info → sonolus_py-0.6.3.dist-info}/RECORD +11 -11
- {sonolus_py-0.6.1.dist-info → sonolus_py-0.6.3.dist-info}/WHEEL +0 -0
- {sonolus_py-0.6.1.dist-info → sonolus_py-0.6.3.dist-info}/entry_points.txt +0 -0
- {sonolus_py-0.6.1.dist-info → sonolus_py-0.6.3.dist-info}/licenses/LICENSE +0 -0
sonolus/script/array_like.py
CHANGED
|
@@ -16,7 +16,7 @@ from sonolus.script.values import copy
|
|
|
16
16
|
# Note: we don't use Range in this file because Range itself inherits from ArrayLike
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
class ArrayLike[T](Sequence):
|
|
19
|
+
class ArrayLike[T](Sequence[T]):
|
|
20
20
|
"""Mixin for array-like objects.
|
|
21
21
|
|
|
22
22
|
Inheritors must implement `__len__`, `__getitem__`, and `__setitem__`.
|
|
@@ -190,7 +190,7 @@ class ArrayLike[T](Sequence):
|
|
|
190
190
|
key: A one-argument ordering function to use for comparison.
|
|
191
191
|
reverse: If `True`, sort in descending order, otherwise sort in ascending order.
|
|
192
192
|
"""
|
|
193
|
-
if len(self) < 15
|
|
193
|
+
if key is not None or len(self) < 15:
|
|
194
194
|
if key is None:
|
|
195
195
|
key = _identity # type: ignore
|
|
196
196
|
# May be worth adding a block sort variant for better performance on large arrays in the future
|
sonolus/script/containers.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from typing import Self
|
|
4
|
+
|
|
3
5
|
from sonolus.backend.visitor import compile_and_call
|
|
4
6
|
from sonolus.script.array import Array
|
|
5
7
|
from sonolus.script.array_like import ArrayLike, get_positive_index
|
|
@@ -102,7 +104,7 @@ class VarArray[T, Capacity](Record, ArrayLike[T]):
|
|
|
102
104
|
_array: Array[T, Capacity]
|
|
103
105
|
|
|
104
106
|
@classmethod
|
|
105
|
-
def new(cls):
|
|
107
|
+
def new(cls) -> Self:
|
|
106
108
|
"""Create a new empty array."""
|
|
107
109
|
element_type = cls.type_var_value(T)
|
|
108
110
|
capacity = cls.type_var_value(Capacity)
|
|
@@ -380,7 +382,7 @@ class ArraySet[T, Capacity](Record):
|
|
|
380
382
|
_values: VarArray[T, Capacity]
|
|
381
383
|
|
|
382
384
|
@classmethod
|
|
383
|
-
def new(cls):
|
|
385
|
+
def new(cls) -> Self:
|
|
384
386
|
"""Create a new empty set."""
|
|
385
387
|
element_type = cls.type_var_value(T)
|
|
386
388
|
capacity = cls.type_var_value(Capacity)
|
|
@@ -394,7 +396,7 @@ class ArraySet[T, Capacity](Record):
|
|
|
394
396
|
"""Return whether the given value is present in the set."""
|
|
395
397
|
return value in self._values
|
|
396
398
|
|
|
397
|
-
def __iter__(self):
|
|
399
|
+
def __iter__(self) -> SonolusIterator[T]:
|
|
398
400
|
"""Return an iterator over the values in the set."""
|
|
399
401
|
return self._values.__iter__()
|
|
400
402
|
|
|
@@ -457,7 +459,7 @@ class ArrayMap[K, V, Capacity](Record):
|
|
|
457
459
|
_array: Array[_ArrayMapEntry[K, V], Capacity]
|
|
458
460
|
|
|
459
461
|
@classmethod
|
|
460
|
-
def new(cls):
|
|
462
|
+
def new(cls) -> Self:
|
|
461
463
|
"""Create a new empty map."""
|
|
462
464
|
key_type = cls.type_var_value(K)
|
|
463
465
|
value_type = cls.type_var_value(V)
|
|
@@ -489,7 +491,7 @@ class ArrayMap[K, V, Capacity](Record):
|
|
|
489
491
|
"""Return an iterator over the key-value pairs in the map."""
|
|
490
492
|
return _ArrayMapEntryIterator(self, 0)
|
|
491
493
|
|
|
492
|
-
def __iter__(self):
|
|
494
|
+
def __iter__(self) -> SonolusIterator[K]:
|
|
493
495
|
"""Return an iterator over the keys in the map."""
|
|
494
496
|
return self.keys()
|
|
495
497
|
|
sonolus/script/effect.py
CHANGED
sonolus/script/globals.py
CHANGED
|
@@ -239,6 +239,7 @@ def level_memory[T](cls: type[T]) -> T:
|
|
|
239
239
|
([`preprocess`][sonolus.script.archetype.PlayArchetype.preprocess],
|
|
240
240
|
[`update_sequential`][sonolus.script.archetype.PlayArchetype.update_sequential],
|
|
241
241
|
[`touch`][sonolus.script.archetype.PlayArchetype.touch]).
|
|
242
|
+
Compared to level data, it allows modification during gameplay, but prevents some optimizations.
|
|
242
243
|
|
|
243
244
|
Usage:
|
|
244
245
|
```python
|
|
@@ -246,7 +247,7 @@ def level_memory[T](cls: type[T]) -> T:
|
|
|
246
247
|
class LevelMemory:
|
|
247
248
|
variable: int
|
|
248
249
|
|
|
249
|
-
variable =
|
|
250
|
+
variable = level_memory(Array[int, 10])
|
|
250
251
|
|
|
251
252
|
def f():
|
|
252
253
|
LevelMemory.variable = 1
|
|
@@ -269,6 +270,8 @@ def level_data[T](cls: type[T]) -> T:
|
|
|
269
270
|
"""Define level data.
|
|
270
271
|
|
|
271
272
|
Level data may only be modified during [`preprocess`][sonolus.script.archetype.PlayArchetype.preprocess].
|
|
273
|
+
Compared to level memory, it enables some optimizations during gameplay, so it's recommended to use it
|
|
274
|
+
if mutation is only needed during preprocessing.
|
|
272
275
|
|
|
273
276
|
Usage:
|
|
274
277
|
```python
|
|
@@ -84,7 +84,7 @@ def _zip(*iterables, strict: bool = False):
|
|
|
84
84
|
from sonolus.backend.visitor import compile_and_call
|
|
85
85
|
from sonolus.script.containers import Pair
|
|
86
86
|
|
|
87
|
-
if validate_value(strict)._as_py_():
|
|
87
|
+
if validate_value(strict)._as_py_(): # type: ignore
|
|
88
88
|
raise NotImplementedError("Strict zipping is not supported")
|
|
89
89
|
|
|
90
90
|
if not iterables:
|
sonolus/script/particle.py
CHANGED
|
@@ -36,14 +36,14 @@ sonolus/build/project.py,sha256=eHh4ioOjaFtt26bcefUuDZhMhFw8NXnjRTYPiEInQV8,6505
|
|
|
36
36
|
sonolus/script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
37
|
sonolus/script/archetype.py,sha256=DMtg-wWId6UAoh1L_jbMq4EMwLuY6tPY29wVoB8oD6A,47279
|
|
38
38
|
sonolus/script/array.py,sha256=9uOUHZIDMyMT9q3APcXJWXWt97yG-AZoRlxwrvSY6SU,12367
|
|
39
|
-
sonolus/script/array_like.py,sha256=
|
|
39
|
+
sonolus/script/array_like.py,sha256=hUDdDaP306kflVv9YomdHIMXogrVjxsBXCrLvB9QpuE,9681
|
|
40
40
|
sonolus/script/bucket.py,sha256=SNqnfLGpnO_u-3LFFazdgzNk332OdDUIlmZHsuoVZuE,7674
|
|
41
|
-
sonolus/script/containers.py,sha256=
|
|
41
|
+
sonolus/script/containers.py,sha256=L3rzPfN1cDb2m02k9qRyjnGxJx07X3q3MccCaL5tNJ8,18773
|
|
42
42
|
sonolus/script/debug.py,sha256=Vi97opuk9fMB5bdpzPCBpa2oZeTff7FQ4WzdeDE5trk,4557
|
|
43
43
|
sonolus/script/easing.py,sha256=txf0OPFP5v7cOFDvJKCyKLK-d2uKIOu56ntLEHfD9QI,11377
|
|
44
|
-
sonolus/script/effect.py,sha256=
|
|
44
|
+
sonolus/script/effect.py,sha256=RQdsABqfi3sIku1jJDwyeD81devVyBhWQ47HIjfiMy0,5978
|
|
45
45
|
sonolus/script/engine.py,sha256=etI9dJsQ7V9YZICVNZg54WqpLijPxG8eTPHiV-_EiG8,10687
|
|
46
|
-
sonolus/script/globals.py,sha256=
|
|
46
|
+
sonolus/script/globals.py,sha256=nlXSNS4NRXsgQU2AJImVIs752h1WqsMnShSKgU011c4,10270
|
|
47
47
|
sonolus/script/instruction.py,sha256=Dd-14D5Amo8nhPBr6DNyg2lpYw_rqZkT8Kix3HkfE7k,6793
|
|
48
48
|
sonolus/script/interval.py,sha256=dj6F2wn5uP6I6_mcZn-wIREgRUQbsLzhvhzB0oEyAdU,11290
|
|
49
49
|
sonolus/script/iterator.py,sha256=_ICY_yX7FG0Zbgs3NhVnaIBdVDpAeXjxJ_CQtq30l7Y,3774
|
|
@@ -52,7 +52,7 @@ sonolus/script/maybe.py,sha256=VYvTWgEfPzoXqI3i3zXhc4dz0pWBVoHmW8FtWH0GQvM,8194
|
|
|
52
52
|
sonolus/script/metadata.py,sha256=ttRK27eojHf3So50KQJ-8yj3udZoN1bli5iD-knaeLw,753
|
|
53
53
|
sonolus/script/num.py,sha256=924kWWZusW7oaWuvtQzdAMzkb4ZItWSJwNj3W9XrqZU,16041
|
|
54
54
|
sonolus/script/options.py,sha256=XVN-mL7Rwhd2Tu9YysYq9YDGpH_LazdmhqzSYE6nR3Q,9455
|
|
55
|
-
sonolus/script/particle.py,sha256=
|
|
55
|
+
sonolus/script/particle.py,sha256=RTfamg_ZTq7-qJ6j9paduNVUHCkw3hzkBK1QUbwwN7I,8403
|
|
56
56
|
sonolus/script/pointer.py,sha256=FoOfyD93r0G5d_2BaKfeOT9SqkOP3hq6sqtOs_Rb0c8,1511
|
|
57
57
|
sonolus/script/printing.py,sha256=mNYu9QWiacBBGZrnePZQMVwbbguoelUps9GiOK_aVRU,2096
|
|
58
58
|
sonolus/script/project.py,sha256=BDGaae3lXWQqZgY3lF3_27VSSk_oGEA4sbN-gQFlhAM,4157
|
|
@@ -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=R1h3IOlWzolPfc9yoma2cBN0F5cBhj_JNP-TTdKoBlc,13186
|
|
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=jto68tBpmF3As_h22tNVNP7ctJjt4S0HySF_DbFhbok,17361
|
|
@@ -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.6.
|
|
90
|
-
sonolus_py-0.6.
|
|
91
|
-
sonolus_py-0.6.
|
|
92
|
-
sonolus_py-0.6.
|
|
93
|
-
sonolus_py-0.6.
|
|
89
|
+
sonolus_py-0.6.3.dist-info/METADATA,sha256=HQELwglqS5CrpBjb6LhWu_Me95xkfIPothRlru-QuWI,302
|
|
90
|
+
sonolus_py-0.6.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
91
|
+
sonolus_py-0.6.3.dist-info/entry_points.txt,sha256=oTYspY_b7SA8TptEMTDxh4-Aj-ZVPnYC9f1lqH6s9G4,54
|
|
92
|
+
sonolus_py-0.6.3.dist-info/licenses/LICENSE,sha256=JEKpqVhQYfEc7zg3Mj462sKbKYmO1K7WmvX1qvg9IJk,1067
|
|
93
|
+
sonolus_py-0.6.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|