jmux 0.0.1__tar.gz → 0.0.2__tar.gz

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.
Files changed (28) hide show
  1. {jmux-0.0.1/src/jmux.egg-info → jmux-0.0.2}/PKG-INFO +1 -1
  2. {jmux-0.0.1 → jmux-0.0.2}/src/jmux/demux.py +13 -8
  3. {jmux-0.0.1 → jmux-0.0.2/src/jmux.egg-info}/PKG-INFO +1 -1
  4. {jmux-0.0.1 → jmux-0.0.2}/tests/test_demux__parse.py +6 -0
  5. {jmux-0.0.1 → jmux-0.0.2}/.github/workflows/ci.yml +0 -0
  6. {jmux-0.0.1 → jmux-0.0.2}/.gitignore +0 -0
  7. {jmux-0.0.1 → jmux-0.0.2}/LICENSE +0 -0
  8. {jmux-0.0.1 → jmux-0.0.2}/README.md +0 -0
  9. {jmux-0.0.1 → jmux-0.0.2}/pyproject.toml +0 -0
  10. {jmux-0.0.1 → jmux-0.0.2}/setup.cfg +0 -0
  11. {jmux-0.0.1 → jmux-0.0.2}/src/jmux/__init__.py +0 -0
  12. {jmux-0.0.1 → jmux-0.0.2}/src/jmux/awaitable.py +0 -0
  13. {jmux-0.0.1 → jmux-0.0.2}/src/jmux/decoder.py +0 -0
  14. {jmux-0.0.1 → jmux-0.0.2}/src/jmux/error.py +0 -0
  15. {jmux-0.0.1 → jmux-0.0.2}/src/jmux/helpers.py +0 -0
  16. {jmux-0.0.1 → jmux-0.0.2}/src/jmux/pda.py +0 -0
  17. {jmux-0.0.1 → jmux-0.0.2}/src/jmux/types.py +0 -0
  18. {jmux-0.0.1 → jmux-0.0.2}/src/jmux.egg-info/SOURCES.txt +0 -0
  19. {jmux-0.0.1 → jmux-0.0.2}/src/jmux.egg-info/dependency_links.txt +0 -0
  20. {jmux-0.0.1 → jmux-0.0.2}/src/jmux.egg-info/requires.txt +0 -0
  21. {jmux-0.0.1 → jmux-0.0.2}/src/jmux.egg-info/top_level.txt +0 -0
  22. {jmux-0.0.1 → jmux-0.0.2}/tests/conftest.py +0 -0
  23. {jmux-0.0.1 → jmux-0.0.2}/tests/test_awaitables.py +0 -0
  24. {jmux-0.0.1 → jmux-0.0.2}/tests/test_decoder.py +0 -0
  25. {jmux-0.0.1 → jmux-0.0.2}/tests/test_demux__stream.py +0 -0
  26. {jmux-0.0.1 → jmux-0.0.2}/tests/test_demux__validate.py +0 -0
  27. {jmux-0.0.1 → jmux-0.0.2}/tests/test_helpers.py +0 -0
  28. {jmux-0.0.1 → jmux-0.0.2}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jmux
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: JMux: A Python package for demultiplexing a JSON string into multiple awaitable variables.
5
5
  Author-email: "Johannes A.I. Unruh" <johannes@unruh.ai>
6
6
  License: MIT License
@@ -421,7 +421,9 @@ class JMux(ABC):
421
421
  case None:
422
422
  match self._pda.state:
423
423
  case S.START:
424
- if ch in OBJECT_OPEN:
424
+ if is_json_whitespace(ch):
425
+ pass
426
+ elif ch in OBJECT_OPEN:
425
427
  self._pda.push(M.ROOT)
426
428
  self._pda.set_state(S.EXPECT_KEY)
427
429
  else:
@@ -432,13 +434,16 @@ class JMux(ABC):
432
434
  "JSON must start with '{' character.",
433
435
  )
434
436
  case S.END:
435
- raise ObjectAlreadyClosedError(
436
- object_name=self.__class__.__name__,
437
- message=(
438
- "Cannot feed more characters to closed JMux "
439
- f"object, got '{ch}'"
440
- ),
441
- )
437
+ if is_json_whitespace(ch):
438
+ pass
439
+ else:
440
+ raise ObjectAlreadyClosedError(
441
+ object_name=self.__class__.__name__,
442
+ message=(
443
+ "Cannot feed more characters to closed JMux "
444
+ f"object, got '{ch}'"
445
+ ),
446
+ )
442
447
  case _:
443
448
  raise UnexpectedStateError(
444
449
  self._pda.stack,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jmux
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: JMux: A Python package for demultiplexing a JSON string into multiple awaitable variables.
5
5
  Author-email: "Johannes A.I. Unruh" <johannes@unruh.ai>
6
6
  License: MIT License
@@ -149,6 +149,9 @@ async def test_json_demux__parse_correct_stream__assert_state(
149
149
  "stream,MaybeExpectedError",
150
150
  [
151
151
  ("b", UnexpectedCharacterError),
152
+ ("\n", None),
153
+ (" ", None),
154
+ ("\t", None),
152
155
  ("{", None),
153
156
  ("{p", UnexpectedCharacterError),
154
157
  ('{"', None),
@@ -256,6 +259,9 @@ async def test_json_demux__parse_correct_stream__assert_state(
256
259
  ('{"key_str": "val","key_int":42,"key_float":3.14,"key_bool":false,"key_none":null,"key_enum":"value1","key_nested":{"key_str":"nested"},"arr_str":["val1"],"arr_int":[42],"arr_float":[3.14],"arr_bool":[true],"arr_none":[null],"arr_enum":["value1","value2"],"arr_nested":[{"key_str":3', UnexpectedCharacterError),
257
260
  ('{"key_str": "val","key_int":42,"key_float":3.14,"key_bool":false,"key_none":null,"key_enum":"value1","key_nested":{"key_str":"nested"},"arr_str":["val1"],"arr_int":[42],"arr_float":[3.14],"arr_bool":[true],"arr_none":[null],"arr_enum":["value1","value2"],"arr_nested":[{"key_str":', None),
258
261
  ('{"key_str": "val","key_int":42,"key_float":3.14,"key_bool":false,"key_none":null,"key_enum":"value1","key_nested":{"key_str":"nested"},"arr_str":["val1"],"arr_int":[42],"arr_float":[3.14],"arr_bool":[true],"arr_none":[null],"arr_enum":["value1","value2"],"arr_nested":[{"key_str":"nested1"},{"key_str":"nested2"}]}', None),
262
+ ('{"key_str": "val","key_int":42,"key_float":3.14,"key_bool":false,"key_none":null,"key_enum":"value1","key_nested":{"key_str":"nested"},"arr_str":["val1"],"arr_int":[42],"arr_float":[3.14],"arr_bool":[true],"arr_none":[null],"arr_enum":["value1","value2"],"arr_nested":[{"key_str":"nested1"},{"key_str":"nested2"}]}\n', None),
263
+ ('{"key_str": "val","key_int":42,"key_float":3.14,"key_bool":false,"key_none":null,"key_enum":"value1","key_nested":{"key_str":"nested"},"arr_str":["val1"],"arr_int":[42],"arr_float":[3.14],"arr_bool":[true],"arr_none":[null],"arr_enum":["value1","value2"],"arr_nested":[{"key_str":"nested1"},{"key_str":"nested2"}]} ', None),
264
+ ('{"key_str": "val","key_int":42,"key_float":3.14,"key_bool":false,"key_none":null,"key_enum":"value1","key_nested":{"key_str":"nested"},"arr_str":["val1"],"arr_int":[42],"arr_float":[3.14],"arr_bool":[true],"arr_none":[null],"arr_enum":["value1","value2"],"arr_nested":[{"key_str":"nested1"},{"key_str":"nested2"}]}\t', None),
259
265
  ('{"key_str": "val","key_int":42,"key_float":3.14,"key_bool":false,"key_none":null,"key_enum":"value1","key_nested":{"key_str":"nested"},"arr_str":["val1"],"arr_int":[42],"arr_float":[3.14],"arr_bool":[true],"arr_none":[null],"arr_enum":["value1","value2"],"arr_nested":[{"key_str":"nested1"},{"key_str":"nested2"}]}}', ObjectAlreadyClosedError),
260
266
  ],
261
267
  )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes