PythonIota 1.7.0__tar.gz → 1.7.1__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 (47) hide show
  1. pythoniota-1.7.1/MANIFEST.in +1 -0
  2. {pythoniota-1.7.0/src/PythonIota.egg-info → pythoniota-1.7.1}/PKG-INFO +64 -8
  3. pythoniota-1.7.0/PKG-INFO → pythoniota-1.7.1/README.md +407 -368
  4. {pythoniota-1.7.0 → pythoniota-1.7.1}/pyproject.toml +1 -1
  5. pythoniota-1.7.0/README.md → pythoniota-1.7.1/src/PythonIota.egg-info/PKG-INFO +424 -351
  6. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/PythonIota.egg-info/SOURCES.txt +5 -0
  7. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/__init__.py +1 -1
  8. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/enum.py +2 -1
  9. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/regex/_pattern.py +4 -4
  10. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/regex/_vm.py +8 -2
  11. pythoniota-1.7.1/tests/__init__.py +0 -0
  12. pythoniota-1.7.1/tests/test_coverage_fill.py +250 -0
  13. pythoniota-1.7.1/tests/test_coverage_fill2.py +271 -0
  14. pythoniota-1.7.1/tests/test_coverage_fill3.py +136 -0
  15. pythoniota-1.7.1/tests/test_enum_enhanced.py +191 -0
  16. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_integration.py +1 -1
  17. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_regex.py +66 -0
  18. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_regex_extended.py +40 -0
  19. pythoniota-1.7.0/tests/test_enum_enhanced.py +0 -89
  20. {pythoniota-1.7.0 → pythoniota-1.7.1}/setup.cfg +0 -0
  21. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/PythonIota.egg-info/dependency_links.txt +0 -0
  22. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/PythonIota.egg-info/top_level.txt +0 -0
  23. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/_bitflag.py +0 -0
  24. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/_compat.py +0 -0
  25. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/_safe_eval.py +0 -0
  26. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/cli/__init__.py +0 -0
  27. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/cli/_argument.py +0 -0
  28. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/cli/_errors.py +0 -0
  29. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/cli/_formatter.py +0 -0
  30. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/cli/_namespace.py +0 -0
  31. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/cli/_parser.py +0 -0
  32. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/recipes.py +0 -0
  33. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/regex/__init__.py +0 -0
  34. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/regex/_compiler.py +0 -0
  35. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/regex/_parser.py +0 -0
  36. {pythoniota-1.7.0 → pythoniota-1.7.1}/src/pythoniota/sequence.py +0 -0
  37. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_advanced.py +0 -0
  38. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_bitflags.py +0 -0
  39. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_cli.py +0 -0
  40. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_compat.py +0 -0
  41. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_enum.py +0 -0
  42. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_new_features.py +0 -0
  43. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_recipes.py +0 -0
  44. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_safe_eval.py +0 -0
  45. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_sequence.py +0 -0
  46. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_serialization.py +0 -0
  47. {pythoniota-1.7.0 → pythoniota-1.7.1}/tests/test_string_enum.py +0 -0
@@ -0,0 +1 @@
1
+ recursive-include tests *.py
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.2
2
2
  Name: PythonIota
3
- Version: 1.7.0
3
+ Version: 1.7.1
4
4
  Summary: A zero-dependency Python toolkit: Go-style iota enums, sequence generators, a from-scratch regex engine, and an argparse-style CLI parser
5
5
  Author: Equinox
6
6
  License: MIT
@@ -26,11 +26,19 @@ pip install PythonIota
26
26
 
27
27
  Requires Python 3.10+.
28
28
 
29
+ ## 1.7.1 fixes
30
+
31
+ - Full matching now considers complete alternatives instead of rejecting a
32
+ valid match after selecting a shorter branch.
33
+ - Ordered enum members now hash consistently with equal numeric values and
34
+ equal members of other enums, preserving dictionary and set lookups.
35
+
29
36
  **What's inside**
30
37
 
31
38
  - **Enums** — Go-style `iota`, bit flags, string enums (`pythoniota.IotaEnum`, ...)
32
39
  - **Sequences** — lazy, chainable generators (`pythoniota.iota`)
33
40
  - **Regex** — a from-scratch NFA (Pike VM) engine, no catastrophic backtracking (`pythoniota.regex`)
41
+ - **CLI** — a from-scratch `argparse`-style argument parser (`pythoniota.cli`)
34
42
 
35
43
  ---
36
44
 
@@ -340,12 +348,13 @@ named.groupdict() # {'user': 'user', 'host': 'host'}
340
348
 
341
349
  Supported: literals, `.`, `* + ?` and their lazy forms `*? +? ??`, alternation
342
350
  `|`, groups `(...)` / non-capturing `(?:...)` / named `(?P<name>...)`, lookahead
343
- `(?=...)` / `(?!...)`, character classes `[...]`, counted repeats `{m,n}`,
344
- shorthands `\d \w \s` (and `\D \W \S`), word boundaries `\b \B`, and anchors
345
- `^ $ \A \Z`. Flags: `IGNORECASE`, `MULTILINE`, `DOTALL`, `VERBOSE` (also inline
346
- `(?imsx)`). API mirrors `re`: `compile`, `match`, `fullmatch`, `search`,
347
- `findall`, `finditer`, `sub`, `split`, `escape`, with `Match.group` / `groups` /
348
- `span` / `groupdict`.
351
+ `(?=...)` / `(?!...)`, fixed-width lookbehind `(?<=...)` / `(?<!...)`, conditionals
352
+ `(?(id/name)yes|no)`, character classes `[...]`, counted repeats `{m,n}`,
353
+ shorthands `\d \w \s` (and `\D \W \S`), word boundaries `\b \B`, anchors
354
+ `^ $ \A \Z`, and hex escapes `\xHH` / `\uHHHH`. Flags: `IGNORECASE`, `MULTILINE`,
355
+ `DOTALL`, `VERBOSE` (also inline `(?imsx)`). API mirrors `re`: `compile`, `match`,
356
+ `fullmatch`, `search`, `findall`, `finditer`, `sub`, `subn`, `split`, `escape`,
357
+ with `Match.group` / `groups` / `span` / `groupdict` / `expand`.
349
358
 
350
359
  ```python
351
360
  regex.findall(r"[a-z]+", "AbCdEf", regex.IGNORECASE) # ['AbCdEf']
@@ -363,6 +372,53 @@ regex.search(r"(a+)+$", "a" * 40 + "!") # None, instantly
363
372
 
364
373
  ---
365
374
 
375
+ ## CLI
376
+
377
+ A faithful subset of the standard library's `argparse`, built from scratch:
378
+
379
+ ```python
380
+ from pythoniota import cli
381
+
382
+ p = cli.ArgumentParser(prog="greet", description="say hello")
383
+ p.add_argument("name")
384
+ p.add_argument("-n", "--times", type=int, default=1)
385
+ p.add_argument("-v", "--verbose", action="store_true")
386
+
387
+ args = p.parse_args(["world", "--times", "3", "-v"])
388
+ args.name, args.times, args.verbose # ('world', 3, True)
389
+ ```
390
+
391
+ Supported:
392
+
393
+ - positional & optional arguments, `nargs` (`N` / `?` / `*` / `+`)
394
+ - `type` / `choices` / `default` / `required`
395
+ - actions: `store`, `store_true`, `store_false`, `store_const`, `append`, `count`
396
+ - `--opt=value`, clustered short flags (`-abc`), the `--` end-of-options marker
397
+ - an auto-generated `-h/--help`, and sub-commands via `add_subparsers`
398
+
399
+ Bad input prints a usage line and raises `SystemExit(2)` — the same contract as
400
+ argparse, so it drops into scripts and tests unchanged. `parse_known_args`
401
+ returns `(namespace, extras)` instead of erroring on unknown tokens.
402
+
403
+ ### Sub-commands
404
+
405
+ ```python
406
+ p = cli.ArgumentParser(prog="git")
407
+ sub = p.add_subparsers(dest="cmd")
408
+
409
+ add = sub.add_parser("add", help="stage files")
410
+ add.add_argument("path")
411
+ add.add_argument("-f", "--force", action="store_true")
412
+
413
+ rm = sub.add_parser("rm", help="remove files")
414
+ rm.add_argument("path")
415
+
416
+ args = p.parse_args(["add", "README.md", "-f"])
417
+ args.cmd, args.path, args.force # ('add', 'README.md', True)
418
+ ```
419
+
420
+ ---
421
+
366
422
  ## License
367
423
 
368
424
  MIT