PythonIota 1.3.0__tar.gz → 1.7.0__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.
- {pythoniota-1.3.0/src/PythonIota.egg-info → pythoniota-1.7.0}/PKG-INFO +56 -3
- pythoniota-1.3.0/PKG-INFO → pythoniota-1.7.0/README.md +351 -315
- {pythoniota-1.3.0 → pythoniota-1.7.0}/pyproject.toml +2 -2
- pythoniota-1.3.0/README.md → pythoniota-1.7.0/src/PythonIota.egg-info/PKG-INFO +368 -298
- {pythoniota-1.3.0 → pythoniota-1.7.0}/src/PythonIota.egg-info/SOURCES.txt +14 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/src/pythoniota/__init__.py +5 -1
- pythoniota-1.7.0/src/pythoniota/cli/__init__.py +27 -0
- pythoniota-1.7.0/src/pythoniota/cli/_argument.py +70 -0
- pythoniota-1.7.0/src/pythoniota/cli/_errors.py +9 -0
- pythoniota-1.7.0/src/pythoniota/cli/_formatter.py +93 -0
- pythoniota-1.7.0/src/pythoniota/cli/_namespace.py +17 -0
- pythoniota-1.7.0/src/pythoniota/cli/_parser.py +321 -0
- pythoniota-1.7.0/src/pythoniota/regex/__init__.py +66 -0
- pythoniota-1.7.0/src/pythoniota/regex/_compiler.py +177 -0
- pythoniota-1.7.0/src/pythoniota/regex/_parser.py +463 -0
- pythoniota-1.7.0/src/pythoniota/regex/_pattern.py +210 -0
- pythoniota-1.7.0/src/pythoniota/regex/_vm.py +123 -0
- pythoniota-1.7.0/tests/test_cli.py +244 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/tests/test_integration.py +1 -1
- pythoniota-1.7.0/tests/test_regex.py +145 -0
- pythoniota-1.7.0/tests/test_regex_extended.py +200 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/setup.cfg +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/src/PythonIota.egg-info/dependency_links.txt +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/src/PythonIota.egg-info/top_level.txt +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/src/pythoniota/_bitflag.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/src/pythoniota/_compat.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/src/pythoniota/_safe_eval.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/src/pythoniota/enum.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/src/pythoniota/recipes.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/src/pythoniota/sequence.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/tests/test_advanced.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/tests/test_bitflags.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/tests/test_compat.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/tests/test_enum.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/tests/test_enum_enhanced.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/tests/test_new_features.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/tests/test_recipes.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/tests/test_safe_eval.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/tests/test_sequence.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/tests/test_serialization.py +0 -0
- {pythoniota-1.3.0 → pythoniota-1.7.0}/tests/test_string_enum.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PythonIota
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: Go-style iota
|
|
3
|
+
Version: 1.7.0
|
|
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
|
|
7
7
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -17,7 +17,8 @@ Description-Content-Type: text/markdown
|
|
|
17
17
|
|
|
18
18
|
# PythonIota
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
A **zero-dependency Python toolkit** of from-scratch building blocks — Go-style
|
|
21
|
+
`iota` enumerations, lazy sequence generators, and a linear-time regex engine.
|
|
21
22
|
|
|
22
23
|
```bash
|
|
23
24
|
pip install PythonIota
|
|
@@ -25,6 +26,12 @@ pip install PythonIota
|
|
|
25
26
|
|
|
26
27
|
Requires Python 3.10+.
|
|
27
28
|
|
|
29
|
+
**What's inside**
|
|
30
|
+
|
|
31
|
+
- **Enums** — Go-style `iota`, bit flags, string enums (`pythoniota.IotaEnum`, ...)
|
|
32
|
+
- **Sequences** — lazy, chainable generators (`pythoniota.iota`)
|
|
33
|
+
- **Regex** — a from-scratch NFA (Pike VM) engine, no catastrophic backtracking (`pythoniota.regex`)
|
|
34
|
+
|
|
28
35
|
---
|
|
29
36
|
|
|
30
37
|
## Enums
|
|
@@ -310,6 +317,52 @@ safe_eval("a * b + 1", {"a": 3, "b": 4}) # 13
|
|
|
310
317
|
|
|
311
318
|
---
|
|
312
319
|
|
|
320
|
+
## Regex
|
|
321
|
+
|
|
322
|
+
A from-scratch regular-expression engine. Unlike Python's backtracking `re`, it
|
|
323
|
+
compiles the pattern to a tiny bytecode and runs it with a **Pike VM** (a
|
|
324
|
+
thread-list NFA simulation), so matching is linear in `len(text) × len(program)`
|
|
325
|
+
— pathological patterns like `(a+)+$` finish instantly instead of hanging.
|
|
326
|
+
|
|
327
|
+
```python
|
|
328
|
+
from pythoniota import regex
|
|
329
|
+
|
|
330
|
+
m = regex.match(r"(\d{4})-(\d{2})-(\d{2})", "2026-08-02")
|
|
331
|
+
m.groups() # ('2026', '08', '02')
|
|
332
|
+
|
|
333
|
+
regex.findall(r"\w+", "hello world") # ['hello', 'world']
|
|
334
|
+
regex.sub(r"\s+", "_", "a b c") # 'a_b_c'
|
|
335
|
+
regex.split(r"[,;]\s*", "a, b; c,d") # ['a', 'b', 'c', 'd']
|
|
336
|
+
|
|
337
|
+
named = regex.search(r"(?P<user>\w+)@(?P<host>\w+)", "user@host")
|
|
338
|
+
named.groupdict() # {'user': 'user', 'host': 'host'}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Supported: literals, `.`, `* + ?` and their lazy forms `*? +? ??`, alternation
|
|
342
|
+
`|`, 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`.
|
|
349
|
+
|
|
350
|
+
```python
|
|
351
|
+
regex.findall(r"[a-z]+", "AbCdEf", regex.IGNORECASE) # ['AbCdEf']
|
|
352
|
+
regex.findall(r"\d+(?=px)", "10px 20em 30px") # ['10', '30'] (lookahead)
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Backreferences (`\1`) are intentionally *not* supported: they can't be matched
|
|
356
|
+
by a finite automaton in linear time — that's the price of the no-backtracking
|
|
357
|
+
guarantee (the same trade-off Go's `regexp` and RE2 make).
|
|
358
|
+
|
|
359
|
+
```python
|
|
360
|
+
# no ReDoS: this returns in microseconds, where re takes ~13s at length 28
|
|
361
|
+
regex.search(r"(a+)+$", "a" * 40 + "!") # None, instantly
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
313
366
|
## License
|
|
314
367
|
|
|
315
368
|
MIT
|