sonolus.py 0.6.4__py3-none-any.whl → 0.6.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.

@@ -1,4 +1,3 @@
1
- # type: ignore
2
1
  from __future__ import annotations
3
2
 
4
3
  import inspect
@@ -120,7 +119,7 @@ class _ArchetypeField(SonolusDescriptor):
120
119
  if ctx():
121
120
  return result._get_readonly_()
122
121
  else:
123
- return result._as_py_()
122
+ return result._as_py_() # type: ignore
124
123
 
125
124
  def __set__(self, instance: _BaseArchetype, value):
126
125
  if instance is None:
@@ -362,37 +361,6 @@ _annotation_defaults: dict[Callable, _ArchetypeFieldInfo] = {
362
361
  }
363
362
 
364
363
 
365
- class StandardImport:
366
- """Standard import annotations for Archetype fields.
367
-
368
- Usage:
369
- ```python
370
- class MyArchetype(WatchArchetype):
371
- judgment: StandardImport.JUDGMENT
372
- ```
373
- """
374
-
375
- BEAT = Annotated[float, imported(name="#BEAT")]
376
- """The beat of the entity."""
377
-
378
- BPM = Annotated[float, imported(name="#BPM")]
379
- """The bpm, for bpm change markers."""
380
-
381
- TIMESCALE = Annotated[float, imported(name="#TIMESCALE")]
382
- """The timescale, for timescale change markers."""
383
-
384
- JUDGMENT = Annotated[int, imported(name="#JUDGMENT")]
385
- """The judgment of the entity.
386
-
387
- Automatically supported in watch mode for archetypes with a corresponding scored play mode archetype.
388
- """
389
- ACCURACY = Annotated[float, imported(name="#ACCURACY")]
390
- """The accuracy of the entity.
391
-
392
- Automatically supported in watch mode for archetypes with a corresponding scored play mode archetype.
393
- """
394
-
395
-
396
364
  def callback[T: Callable](*, order: int = 0) -> Callable[[T], T]:
397
365
  """Annotate a callback with its order.
398
366
 
@@ -844,12 +812,14 @@ class PlayArchetype(_BaseArchetype):
844
812
 
845
813
  Runs when the level is loaded after [`preprocess`][sonolus.script.archetype.PlayArchetype.preprocess].
846
814
  """
815
+ return 0.0
847
816
 
848
817
  def should_spawn(self) -> bool:
849
818
  """Return whether the entity should be spawned.
850
819
 
851
820
  Runs each frame while the entity is the first entity in the spawn queue.
852
821
  """
822
+ return True
853
823
 
854
824
  def initialize(self):
855
825
  """Initialize this entity.
@@ -997,9 +967,11 @@ class WatchArchetype(_BaseArchetype):
997
967
 
998
968
  def spawn_time(self) -> float:
999
969
  """Return the spawn time of the entity."""
970
+ return 0.0
1000
971
 
1001
972
  def despawn_time(self) -> float:
1002
973
  """Return the despawn time of the entity."""
974
+ return 0.0
1003
975
 
1004
976
  def initialize(self):
1005
977
  """Initialize this entity.
@@ -1136,16 +1108,16 @@ def get_archetype_by_name(name: str) -> AnyArchetype:
1136
1108
  """Return the archetype with the given name in the current mode."""
1137
1109
  if not ctx():
1138
1110
  raise RuntimeError("Archetypes by name are only available during compilation.")
1139
- name = validate_value(name)
1140
- if not name._is_py_():
1111
+ name = validate_value(name) # type: ignore
1112
+ if not name._is_py_(): # type: ignore
1141
1113
  raise TypeError(f"Invalid name: '{name}'")
1142
- name = name._as_py_()
1114
+ name = name._as_py_() # type: ignore
1143
1115
  if not isinstance(name, str):
1144
1116
  raise TypeError(f"Invalid name: '{name}'")
1145
1117
  archetypes_by_name = ctx().global_state.archetypes_by_name
1146
1118
  if name not in archetypes_by_name:
1147
1119
  raise KeyError(f"Unknown archetype: '{name}'")
1148
- return archetypes_by_name[name]
1120
+ return archetypes_by_name[name] # type: ignore
1149
1121
 
1150
1122
 
1151
1123
  @meta_fn
@@ -1315,6 +1287,84 @@ class StandardArchetypeName(StrEnum):
1315
1287
  TIMESCALE_CHANGE = "#TIMESCALE_CHANGE"
1316
1288
  """Timescale change marker"""
1317
1289
 
1290
+ TIMESCALE_GROUP = "#TIMESCALE_GROUP"
1291
+ """Entity referenced by the timescale changes in a group"""
1292
+
1318
1293
 
1319
1294
  type AnyArchetype = PlayArchetype | WatchArchetype | PreviewArchetype
1320
1295
  """Union of all archetype types."""
1296
+
1297
+
1298
+ class StandardImportName:
1299
+ """Standard import names for Archetype fields.
1300
+
1301
+ Usage:
1302
+ ```python
1303
+ class MyArchetype(WatchArchetype):
1304
+ judgment: int = imported(name=StandardImportName.JUDGMENT)
1305
+ ```
1306
+ """
1307
+
1308
+ BEAT = "#BEAT"
1309
+ """The beat of the entity."""
1310
+
1311
+ BPM = "#BPM"
1312
+ """The bpm, for bpm change markers."""
1313
+
1314
+ TIMESCALE = "#TIMESCALE"
1315
+ """The timescale, for timescale change markers."""
1316
+
1317
+ TIMESCALE_SKIP = "#TIMESCALE_SKIP"
1318
+ """The scaled time to skip, for timescale change markers."""
1319
+
1320
+ TIMESCALE_GROUP = "#TIMESCALE_GROUP"
1321
+ """The timescale group, for timescale change markers."""
1322
+
1323
+ JUDGMENT = "#JUDGMENT"
1324
+ """The judgment of the entity.
1325
+
1326
+ Automatically set in watch mode for archetypes with a corresponding scored play mode archetype.
1327
+ """
1328
+
1329
+ ACCURACY = "#ACCURACY"
1330
+ """The accuracy of the entity.
1331
+
1332
+ Automatically set in watch mode for archetypes with a corresponding scored play mode archetype.
1333
+ """
1334
+
1335
+
1336
+ class StandardImport:
1337
+ """Standard import annotations for Archetype fields.
1338
+
1339
+ Usage:
1340
+ ```python
1341
+ class MyArchetype(WatchArchetype):
1342
+ judgment: StandardImport.JUDGMENT
1343
+ ```
1344
+ """
1345
+
1346
+ BEAT = Annotated[float, imported(name=StandardImportName.BEAT)]
1347
+ """The beat of the entity."""
1348
+
1349
+ BPM = Annotated[float, imported(name=StandardImportName.BPM)]
1350
+ """The bpm, for bpm change markers."""
1351
+
1352
+ TIMESCALE = Annotated[float, imported(name=StandardImportName.TIMESCALE)]
1353
+ """The timescale, for timescale change markers."""
1354
+
1355
+ TIMESCALE_SKIP = Annotated[float, imported(name=StandardImportName.TIMESCALE_SKIP)]
1356
+ """The scaled time to skip, for timescale change markers."""
1357
+
1358
+ TIMESCALE_GROUP = Annotated[EntityRef[Any], imported(name=StandardImportName.TIMESCALE_GROUP)]
1359
+ """The timescale group, for timescale change markers."""
1360
+
1361
+ JUDGMENT = Annotated[int, imported(name=StandardImportName.JUDGMENT)]
1362
+ """The judgment of the entity.
1363
+
1364
+ Automatically set in watch mode for archetypes with a corresponding scored play mode archetype.
1365
+ """
1366
+ ACCURACY = Annotated[float, imported(name=StandardImportName.ACCURACY)]
1367
+ """The accuracy of the entity.
1368
+
1369
+ Automatically set in watch mode for archetypes with a corresponding scored play mode archetype.
1370
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sonolus.py
3
- Version: 0.6.4
3
+ Version: 0.6.5
4
4
  Summary: Sonolus engine development in Python
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -34,7 +34,7 @@ sonolus/build/level.py,sha256=yXsQtnabkJK0vuVmZ_Wr1jx37jFLgInCS7lTlXjkv9Q,706
34
34
  sonolus/build/node.py,sha256=gnX71RYDUOK_gYMpinQi-bLWO4csqcfiG5gFmhxzSec,1330
35
35
  sonolus/build/project.py,sha256=eHh4ioOjaFtt26bcefUuDZhMhFw8NXnjRTYPiEInQV8,6505
36
36
  sonolus/script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
- sonolus/script/archetype.py,sha256=sgPAbYD1jEPnQf2LhRaZn_ySVyzaogNEqGU-69teyIs,47331
37
+ sonolus/script/archetype.py,sha256=HBg2cS6ZDy0zBbHH8Ieke5QOWR71PwFCmtJie8zDXiI,48957
38
38
  sonolus/script/array.py,sha256=9uOUHZIDMyMT9q3APcXJWXWt97yG-AZoRlxwrvSY6SU,12367
39
39
  sonolus/script/array_like.py,sha256=hUDdDaP306kflVv9YomdHIMXogrVjxsBXCrLvB9QpuE,9681
40
40
  sonolus/script/bucket.py,sha256=SNqnfLGpnO_u-3LFFazdgzNk332OdDUIlmZHsuoVZuE,7674
@@ -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.4.dist-info/METADATA,sha256=0snzpKah3Osilgz5MfftDE9jFV6ydvWIJ4YroK54eBQ,302
90
- sonolus_py-0.6.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
91
- sonolus_py-0.6.4.dist-info/entry_points.txt,sha256=oTYspY_b7SA8TptEMTDxh4-Aj-ZVPnYC9f1lqH6s9G4,54
92
- sonolus_py-0.6.4.dist-info/licenses/LICENSE,sha256=JEKpqVhQYfEc7zg3Mj462sKbKYmO1K7WmvX1qvg9IJk,1067
93
- sonolus_py-0.6.4.dist-info/RECORD,,
89
+ sonolus_py-0.6.5.dist-info/METADATA,sha256=cU1Ruyl2Nt__z5kalCBRw6jvSiIyq-WcShZvUyM8KgY,302
90
+ sonolus_py-0.6.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
91
+ sonolus_py-0.6.5.dist-info/entry_points.txt,sha256=oTYspY_b7SA8TptEMTDxh4-Aj-ZVPnYC9f1lqH6s9G4,54
92
+ sonolus_py-0.6.5.dist-info/licenses/LICENSE,sha256=JEKpqVhQYfEc7zg3Mj462sKbKYmO1K7WmvX1qvg9IJk,1067
93
+ sonolus_py-0.6.5.dist-info/RECORD,,