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

@@ -57,7 +57,8 @@ DETAILED_HELP_TEXT = [
57
57
  description=[
58
58
  (
59
59
  "Decode a debug message code to its original text with a stack trace. "
60
- "Message codes are generated by assert statements, debug.error(), and debug.notify() calls. "
60
+ "Message codes are generated by assert statements and certain debug-related functions such as "
61
+ "debug.error() and debug.notify(). "
61
62
  "The game is automatically paused when these are triggered in debug mode and the message code "
62
63
  "can be found in the debug log."
63
64
  ),
@@ -189,7 +190,13 @@ def parse_dev_command(command_line: str) -> Command | None:
189
190
  subparsers.add_parser("quit", aliases=["q"])
190
191
 
191
192
  try:
192
- args = parser.parse_args(shlex.split(command_line))
193
+ split_args = shlex.split(command_line)
194
+ except ValueError as e:
195
+ print(f"Error parsing command: {e}\n")
196
+ return None
197
+
198
+ try:
199
+ args = parser.parse_args(split_args)
193
200
  if args.cmd in {"rebuild", "r"}:
194
201
  return RebuildCommand()
195
202
  elif args.cmd in {"decode", "d"}:
@@ -223,11 +230,12 @@ def command_input_thread(command_queue: queue.Queue, prompt_event: threading.Eve
223
230
  print(f"Unknown command. Available commands:\n{HELP_TEXT}")
224
231
  # Show prompt again
225
232
  prompt_event.set()
233
+ else:
234
+ prompt_event.set()
226
235
  except EOFError:
227
236
  break
228
237
  except Exception as e:
229
- print(f"Error reading command: {e}")
230
- break
238
+ print(f"Error reading command: {e}\n")
231
239
 
232
240
 
233
241
  def get_local_ips():
@@ -311,12 +319,12 @@ def run_server(
311
319
 
312
320
  try:
313
321
  while True:
322
+ cmd = command_queue.get()
314
323
  try:
315
- cmd = command_queue.get(timeout=0.5)
316
324
  cmd.execute(server_state)
317
- prompt_event.set()
318
- except queue.Empty:
319
- continue
325
+ except Exception:
326
+ print(f"{traceback.format_exc()}\n")
327
+ prompt_event.set()
320
328
  except KeyboardInterrupt:
321
329
  print("Exiting...")
322
330
  sys.exit(0)
sonolus/script/array.py CHANGED
@@ -30,6 +30,8 @@ class ArrayMeta(ABCMeta):
30
30
  class Array[T, Size](GenericValue, ArrayLike[T], metaclass=ArrayMeta):
31
31
  """A fixed size array of values.
32
32
 
33
+ Supports negative indexes.
34
+
33
35
  Usage:
34
36
  ```python
35
37
  array_1 = Array(1, 2, 3)
@@ -87,6 +87,8 @@ class Pair[T, U](Record):
87
87
  class VarArray[T, Capacity](Record, ArrayLike[T]):
88
88
  """An array with a variable size and fixed maximum capacity.
89
89
 
90
+ Supports negative indexes.
91
+
90
92
  Usage:
91
93
  ```python
92
94
  VarArray[T, Capacity].new() # Create a new empty array
@@ -125,6 +127,8 @@ class VarArray[T, Capacity](Record, ArrayLike[T]):
125
127
  def __getitem__(self, item) -> T:
126
128
  """Return the element at the given index.
127
129
 
130
+ Supports negative indexes.
131
+
128
132
  The returned value continues to be part of the array.
129
133
  Future modifications to the array will affect the returned value.
130
134
 
@@ -310,6 +314,8 @@ class VarArray[T, Capacity](Record, ArrayLike[T]):
310
314
  class ArrayPointer[T](Record, ArrayLike[T]):
311
315
  """An array defined by a size and pointer to the first element.
312
316
 
317
+ Supports negative indexes.
318
+
313
319
  This is intended to be created internally and improper use may result in hard to debug issues.
314
320
 
315
321
  Usage:
sonolus/script/debug.py CHANGED
@@ -106,11 +106,10 @@ def notify(message: str):
106
106
  def require(value: int | float | bool, message: str | None = None):
107
107
  """Require a condition to be true, or raise an error.
108
108
 
109
- Similar to assert, but does not get stripped in non-dev builds.
109
+ Similar to assert, but will terminate the current callback even if runtime checks are set to none.
110
110
 
111
- If in a dev build, this function will log a message and pause the game if the condition is false.
112
-
113
- In non-dev builds, this function will terminate the current callback silently if the condition is false.
111
+ If runtime checks are set to notify (default in dev), this function will log a message and pause the game
112
+ before terminating.
114
113
 
115
114
  Args:
116
115
  value: The condition to check.
sonolus/script/effect.py CHANGED
@@ -98,6 +98,8 @@ class ScheduledLoopedEffectHandle(Record):
98
98
  class EffectGroup(Record, ArrayLike[Effect]):
99
99
  """A group of effect clips.
100
100
 
101
+ Does not support negative indexes.
102
+
101
103
  Usage:
102
104
  ```python
103
105
  EffectGroup(start_id: int, size: int)
@@ -58,6 +58,8 @@ class ParticleHandle(Record):
58
58
  class ParticleGroup(Record, ArrayLike[Particle]):
59
59
  """A group of particle effects.
60
60
 
61
+ Does not support negative indexes.
62
+
61
63
  Usage:
62
64
  ```python
63
65
  ParticleGroup(start_id: int, size: int)
sonolus/script/sprite.py CHANGED
@@ -126,6 +126,8 @@ class Sprite(Record):
126
126
  class SpriteGroup(Record, ArrayLike[Sprite]):
127
127
  """A group of sprites.
128
128
 
129
+ Does not support negative indexes.
130
+
129
131
  Usage:
130
132
  ```python
131
133
  SpriteGroup(start_id: int, size: int)
sonolus/script/stream.py CHANGED
@@ -470,6 +470,8 @@ class Stream[T](Record):
470
470
  class StreamGroup[T, Size](Record):
471
471
  """Represents a group of streams.
472
472
 
473
+ Does not support negative indexes.
474
+
473
475
  Most users should use [`@streams`][sonolus.script.stream.streams] to declare stream groups rather than using this
474
476
  class directly.
475
477
 
@@ -507,7 +509,10 @@ class StreamGroup[T, Size](Record):
507
509
  return 0 <= item < self.size()
508
510
 
509
511
  def __getitem__(self, index: int) -> Stream[T]:
510
- """Get the stream at the given index."""
512
+ """Get the stream at the given index.
513
+
514
+ Does not support negative indexes.
515
+ """
511
516
  _check_can_read_or_write_stream()
512
517
  check_positive_index(index, self.size())
513
518
  # Size 0 elements still need 1 stream to preserve the key.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sonolus.py
3
- Version: 0.10.3
3
+ Version: 0.10.5
4
4
  Summary: Sonolus engine development in Python
5
5
  Project-URL: Documentation, https://sonolus.py.qwewqa.xyz/
6
6
  Project-URL: Repository, https://github.com/qwewqa/sonolus.py
@@ -29,20 +29,20 @@ sonolus/build/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  sonolus/build/cli.py,sha256=t6oK0SGU6fkxXVbGu6OuRIHDKD6u4SqXAShdPtatZ-8,10060
30
30
  sonolus/build/collection.py,sha256=6hniAzriPWBKUeGDkXabNXpbdHiHnqiK9shs6U1OExM,12748
31
31
  sonolus/build/compile.py,sha256=KOmncDKmGfgzC_FWB_LTxAl0s9w4wnaDe-luACMlCVs,8397
32
- sonolus/build/dev_server.py,sha256=tn6xzW2PqsKyc7k9p5hRzoFn4gavIWQwpF0MBcGIPnU,9936
32
+ sonolus/build/dev_server.py,sha256=N2MaBaChiVnAPZJzlXRFGEIAHhELj4vDBAtuvgAF1qo,10172
33
33
  sonolus/build/engine.py,sha256=jMymxbBXu-ekv71uU8TF2KbFaHs3yGjyJAztd1SoRDs,14808
34
34
  sonolus/build/level.py,sha256=KLqUAtxIuIqrzeFURJA97rdqjA5pcvYSmwNZQhElaMQ,702
35
35
  sonolus/build/node.py,sha256=gnX71RYDUOK_gYMpinQi-bLWO4csqcfiG5gFmhxzSec,1330
36
36
  sonolus/build/project.py,sha256=Uuz82QtTNFdklrVJ_i7EPp8hSjyOxLU1xAeOloa6G00,8579
37
37
  sonolus/script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  sonolus/script/archetype.py,sha256=ck_LR8z0ipVq3T9b735VwvQI2mxVUyjHylr4BFagXT8,49631
39
- sonolus/script/array.py,sha256=0ZUI0alrwKztpQOpZodZPSPafu5cGwaiffBGQbY19LQ,13316
39
+ sonolus/script/array.py,sha256=EbrNwl_WuJ0JjjkX0s_VJNXWqvYdm_ljTbyrDEMLGUY,13348
40
40
  sonolus/script/array_like.py,sha256=E6S4TW2muXgcyVkhUASQVt7JSYUkpvdJPgHz6YiSHNo,14708
41
41
  sonolus/script/bucket.py,sha256=yIod3DgX7Hv7RLe-4Cn81FcydvbkbdMt26FzpRj7oUI,7794
42
- sonolus/script/containers.py,sha256=Zomn9H0QJjWNAcbe17fj1c4zbM4D0s3vlIY1R0zf8rg,19317
43
- sonolus/script/debug.py,sha256=-Xbt1wYCwCgQOyRFdG73A8LxJLIw9qLs1N6B5FLbZYQ,7790
42
+ sonolus/script/containers.py,sha256=nPjyyLmGnTxndMipqdfJ9CxmIT09wNLRQM7efagtZHI,19417
43
+ sonolus/script/debug.py,sha256=yYg6EZt3NUOUeph1pu_5cA_2lxs8SZ91v76eOC1Sw-8,7747
44
44
  sonolus/script/easing.py,sha256=2FUJI_nfp990P_armCcRqHm2329O985glJAhSC6tnxs,11379
45
- sonolus/script/effect.py,sha256=aOxhBmX6I8vUS-bE53YFNBEN3wwdmpraqZjLeCqbgIY,7920
45
+ sonolus/script/effect.py,sha256=SfJxSNF3RlPCRXnkt62ZlWhCXw3mmmRCsoMsvTErUP0,7960
46
46
  sonolus/script/engine.py,sha256=etI9dJsQ7V9YZICVNZg54WqpLijPxG8eTPHiV-_EiG8,10687
47
47
  sonolus/script/globals.py,sha256=nlXSNS4NRXsgQU2AJImVIs752h1WqsMnShSKgU011c4,10270
48
48
  sonolus/script/instruction.py,sha256=Dd-14D5Amo8nhPBr6DNyg2lpYw_rqZkT8Kix3HkfE7k,6793
@@ -53,15 +53,15 @@ sonolus/script/maybe.py,sha256=VYvTWgEfPzoXqI3i3zXhc4dz0pWBVoHmW8FtWH0GQvM,8194
53
53
  sonolus/script/metadata.py,sha256=ttRK27eojHf3So50KQJ-8yj3udZoN1bli5iD-knaeLw,753
54
54
  sonolus/script/num.py,sha256=9pahERQcIh16ytoDjJB3u3L6fH1Xh11Y99l8SYxkjMA,15927
55
55
  sonolus/script/options.py,sha256=05y_4j2kr8fzct5FLqmSp5ZAjnq6-slmNgtsh4fVEpg,9451
56
- sonolus/script/particle.py,sha256=BuBM7fvLAj79upLf9yI4FyZhVUK7-H2dFj0D7UiYS7I,10458
56
+ sonolus/script/particle.py,sha256=3HbxehuW7Fdri3s8NenGxiwxVU7tVDH8SQ4VyCc0wMk,10498
57
57
  sonolus/script/pointer.py,sha256=FoOfyD93r0G5d_2BaKfeOT9SqkOP3hq6sqtOs_Rb0c8,1511
58
58
  sonolus/script/printing.py,sha256=mNYu9QWiacBBGZrnePZQMVwbbguoelUps9GiOK_aVRU,2096
59
59
  sonolus/script/project.py,sha256=YouKKm6Z9PpwbO9aSA2syZqFv_j1DShVGlENUT565Js,4831
60
60
  sonolus/script/quad.py,sha256=8lZ_5-eWeqePldNGBkNZTuOgS_IRb41URgGwSW4h2T0,14445
61
61
  sonolus/script/record.py,sha256=BrQ8k-O4WX9FT_EfoRmNnKC1BZM9gWydZ4R4swh3chc,13051
62
62
  sonolus/script/runtime.py,sha256=TjxcfIIPRH6oxlEjWfLHDj1oo7fPfwTBdwETfnhN7h4,33331
63
- sonolus/script/sprite.py,sha256=d_wqUn7oMbkLZMdvnyDZVBykycTtiwegcarWXMcZMUI,18408
64
- sonolus/script/stream.py,sha256=mamVG7umEsb51D9Kh6xifhDB7QSDBQHU7xWhJIsQvYY,24786
63
+ sonolus/script/sprite.py,sha256=KhQNnq0wKm1tDMQTrlZIr0mL0jPCfojTORzsCK5qO1o,18448
64
+ sonolus/script/stream.py,sha256=Yot99RLKqJN1XK3x5s_qeV-50qEtuG2U6zbEPWLyvW8,24879
65
65
  sonolus/script/text.py,sha256=wxujIgKYcCfl2AD2_Im8g3vh0lDEHYwTSRZg9wsBPEU,13402
66
66
  sonolus/script/timing.py,sha256=DklMvuxcFg3MzXsecUo6Yhdk7pScOJ7STwXvAiTvLKM,3067
67
67
  sonolus/script/transform.py,sha256=4aS7-NNzX0v9KMXZ4gIGOaU1Cd-ok7DO_OvIBca0mGU,21418
@@ -87,8 +87,8 @@ sonolus/script/internal/simulation_context.py,sha256=LGxLTvxbqBIhoe1R-SfwGajNIDw
87
87
  sonolus/script/internal/transient.py,sha256=y2AWABqF1aoaP6H4_2u4MMpNioC4OsZQCtPyNI0txqo,1634
88
88
  sonolus/script/internal/tuple_impl.py,sha256=DPNdmmRmupU8Ah4_XKq6-PdT336l4nt15_uCJKQGkkk,3587
89
89
  sonolus/script/internal/value.py,sha256=OngrCdmY_h6mV2Zgwqhuo4eYFad0kTk6263UAxctZcY,6963
90
- sonolus_py-0.10.3.dist-info/METADATA,sha256=EWdFrM6pQ7bZHXSFjPqFHb22IJCR8wwuSoX46zS6MRU,554
91
- sonolus_py-0.10.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
92
- sonolus_py-0.10.3.dist-info/entry_points.txt,sha256=oTYspY_b7SA8TptEMTDxh4-Aj-ZVPnYC9f1lqH6s9G4,54
93
- sonolus_py-0.10.3.dist-info/licenses/LICENSE,sha256=JEKpqVhQYfEc7zg3Mj462sKbKYmO1K7WmvX1qvg9IJk,1067
94
- sonolus_py-0.10.3.dist-info/RECORD,,
90
+ sonolus_py-0.10.5.dist-info/METADATA,sha256=OQvnIBSfASxlv-XRLl2RWz4OyYvvO_4wRda1yDmh8h0,554
91
+ sonolus_py-0.10.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
92
+ sonolus_py-0.10.5.dist-info/entry_points.txt,sha256=oTYspY_b7SA8TptEMTDxh4-Aj-ZVPnYC9f1lqH6s9G4,54
93
+ sonolus_py-0.10.5.dist-info/licenses/LICENSE,sha256=JEKpqVhQYfEc7zg3Mj462sKbKYmO1K7WmvX1qvg9IJk,1067
94
+ sonolus_py-0.10.5.dist-info/RECORD,,