glitchlings 0.4.1__cp312-cp312-win_amd64.whl → 0.4.2__cp312-cp312-win_amd64.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 glitchlings might be problematic. Click here for more details.

Files changed (39) hide show
  1. glitchlings/__init__.py +26 -17
  2. glitchlings/__main__.py +0 -1
  3. glitchlings/_zoo_rust.cp312-win_amd64.pyd +0 -0
  4. glitchlings/compat.py +215 -0
  5. glitchlings/config.py +136 -19
  6. glitchlings/dlc/_shared.py +68 -0
  7. glitchlings/dlc/huggingface.py +26 -41
  8. glitchlings/dlc/prime.py +64 -101
  9. glitchlings/lexicon/__init__.py +8 -19
  10. glitchlings/lexicon/_cache.py +0 -7
  11. glitchlings/lexicon/graph.py +4 -12
  12. glitchlings/lexicon/metrics.py +1 -8
  13. glitchlings/lexicon/vector.py +15 -34
  14. glitchlings/lexicon/wordnet.py +31 -32
  15. glitchlings/main.py +9 -13
  16. glitchlings/util/__init__.py +18 -4
  17. glitchlings/util/adapters.py +27 -0
  18. glitchlings/zoo/__init__.py +21 -14
  19. glitchlings/zoo/_ocr_confusions.py +1 -3
  20. glitchlings/zoo/_rate.py +1 -4
  21. glitchlings/zoo/_sampling.py +0 -1
  22. glitchlings/zoo/_text_utils.py +1 -5
  23. glitchlings/zoo/adjax.py +0 -2
  24. glitchlings/zoo/core.py +114 -75
  25. glitchlings/zoo/jargoyle.py +9 -14
  26. glitchlings/zoo/mim1c.py +11 -10
  27. glitchlings/zoo/redactyl.py +5 -8
  28. glitchlings/zoo/reduple.py +3 -1
  29. glitchlings/zoo/rushmore.py +2 -8
  30. glitchlings/zoo/scannequin.py +5 -4
  31. glitchlings/zoo/typogre.py +3 -7
  32. glitchlings/zoo/zeedub.py +2 -2
  33. {glitchlings-0.4.1.dist-info → glitchlings-0.4.2.dist-info}/METADATA +67 -3
  34. glitchlings-0.4.2.dist-info/RECORD +42 -0
  35. glitchlings-0.4.1.dist-info/RECORD +0 -39
  36. {glitchlings-0.4.1.dist-info → glitchlings-0.4.2.dist-info}/WHEEL +0 -0
  37. {glitchlings-0.4.1.dist-info → glitchlings-0.4.2.dist-info}/entry_points.txt +0 -0
  38. {glitchlings-0.4.1.dist-info → glitchlings-0.4.2.dist-info}/licenses/LICENSE +0 -0
  39. {glitchlings-0.4.1.dist-info → glitchlings-0.4.2.dist-info}/top_level.txt +0 -0
@@ -4,9 +4,9 @@ import math
4
4
  import random
5
5
  from typing import Any, Optional
6
6
 
7
- from .core import Glitchling, AttackWave, AttackOrder
8
- from ._rate import resolve_rate
9
7
  from ..util import KEYNEIGHBORS
8
+ from ._rate import resolve_rate
9
+ from .core import AttackOrder, AttackWave, Glitchling
10
10
 
11
11
  try:
12
12
  from glitchlings._zoo_rust import fatfinger as _fatfinger_rust
@@ -64,9 +64,7 @@ def _python_eligible_idx(s: str, i: int) -> bool:
64
64
  return left_ok and right_ok
65
65
 
66
66
 
67
- def _python_draw_eligible_index(
68
- rng: random.Random, s: str, max_tries: int = 16
69
- ) -> Optional[int]:
67
+ def _python_draw_eligible_index(rng: random.Random, s: str, max_tries: int = 16) -> Optional[int]:
70
68
  n = len(s)
71
69
  if n == 0:
72
70
  return None
@@ -151,7 +149,6 @@ def fatfinger(
151
149
  max_change_rate: float | None = None,
152
150
  ) -> str:
153
151
  """Introduce character-level "fat finger" edits with a Rust fast path."""
154
-
155
152
  effective_rate = resolve_rate(
156
153
  rate=rate,
157
154
  legacy_value=max_change_rate,
@@ -230,4 +227,3 @@ typogre = Typogre()
230
227
 
231
228
 
232
229
  __all__ = ["Typogre", "typogre"]
233
-
glitchlings/zoo/zeedub.py CHANGED
@@ -3,9 +3,10 @@ from __future__ import annotations
3
3
  import math
4
4
  import random
5
5
  from collections.abc import Sequence
6
+ from typing import Any
6
7
 
7
- from .core import Glitchling, AttackWave, AttackOrder
8
8
  from ._rate import resolve_rate
9
+ from .core import AttackOrder, AttackWave, Glitchling
9
10
 
10
11
  try:
11
12
  from glitchlings._zoo_rust import inject_zero_widths as _inject_zero_widths_rust
@@ -77,7 +78,6 @@ def insert_zero_widths(
77
78
  characters: Sequence[str] | None = None,
78
79
  ) -> str:
79
80
  """Inject zero-width characters between non-space character pairs."""
80
-
81
81
  effective_rate = resolve_rate(
82
82
  rate=rate,
83
83
  legacy_value=None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glitchlings
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Monsters for your language games.
5
5
  Author: osoleve
6
6
  License: Apache License
@@ -239,6 +239,16 @@ Provides-Extra: dev
239
239
  Requires-Dist: pytest>=8.0.0; extra == "dev"
240
240
  Requires-Dist: hypothesis>=6.140.0; extra == "dev"
241
241
  Requires-Dist: numpy<=2.0,>=1.24; extra == "dev"
242
+ Requires-Dist: mkdocs>=1.6.0; extra == "dev"
243
+ Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "dev"
244
+ Requires-Dist: mkdocs-material>=9.5.0; extra == "dev"
245
+ Requires-Dist: mkdocstrings-python>=1.10.0; extra == "dev"
246
+ Requires-Dist: interrogate>=1.5.0; extra == "dev"
247
+ Requires-Dist: black>=24.4.0; extra == "dev"
248
+ Requires-Dist: isort>=5.13.0; extra == "dev"
249
+ Requires-Dist: ruff>=0.6.0; extra == "dev"
250
+ Requires-Dist: mypy>=1.8.0; extra == "dev"
251
+ Requires-Dist: pre-commit>=3.8.0; extra == "dev"
242
252
  Dynamic: license-file
243
253
 
244
254
  #
@@ -338,10 +348,66 @@ They're horrible little gremlins, but they're not _unreasonable_.
338
348
 
339
349
  Keyboard warriors can challenge them directly via the `glitchlings` command:
340
350
 
351
+ <!-- BEGIN: CLI_USAGE -->
341
352
  ```bash
342
353
  # Discover which glitchlings are currently on the loose.
343
354
  glitchlings --list
355
+ ```
356
+
357
+ ```text
358
+ Typogre — scope: Character, order: early
359
+ Mim1c — scope: Character, order: last
360
+ Jargoyle — scope: Word, order: normal
361
+ Adjax — scope: Word, order: normal
362
+ Reduple — scope: Word, order: normal
363
+ Rushmore — scope: Word, order: normal
364
+ Redactyl — scope: Word, order: normal
365
+ Scannequin — scope: Character, order: late
366
+ Zeedub — scope: Character, order: last
367
+ ```
368
+
369
+ ```bash
370
+ # Review the full CLI contract.
371
+ glitchlings --help
372
+ ```
344
373
 
374
+ ```text
375
+ usage: glitchlings [-h] [-g SPEC] [-s SEED] [-f FILE] [--sample] [--diff]
376
+ [--list] [-c CONFIG]
377
+ [text]
378
+
379
+ Summon glitchlings to corrupt text. Provide input text as an argument, via
380
+ --file, or pipe it on stdin.
381
+
382
+ positional arguments:
383
+ text Text to corrupt. If omitted, stdin is used or --sample
384
+ provides fallback text.
385
+
386
+ options:
387
+ -h, --help show this help message and exit
388
+ -g SPEC, --glitchling SPEC
389
+ Glitchling to apply, optionally with parameters like
390
+ Typogre(rate=0.05). Repeat for multiples; defaults to
391
+ all built-ins.
392
+ -s SEED, --seed SEED Seed controlling deterministic corruption order
393
+ (default: 151).
394
+ -f FILE, --file FILE Read input text from a file instead of the command
395
+ line argument.
396
+ --sample Use the included SAMPLE_TEXT when no other input is
397
+ provided.
398
+ --diff Show a unified diff between the original and corrupted
399
+ text.
400
+ --list List available glitchlings and exit.
401
+ -c CONFIG, --config CONFIG
402
+ Load glitchlings from a YAML configuration file.
403
+ ```
404
+ <!-- END: CLI_USAGE -->
405
+
406
+ Run `python docs/build_cli_reference.py` whenever you tweak the CLI so the README stays in sync with the actual output. The script executes the commands above and replaces the block between the markers automatically.
407
+
408
+ Prefer inline tweaks? You can still configure glitchlings directly in the shell:
409
+
410
+ ```bash
345
411
  # Run Typogre against the contents of a file and inspect the diff.
346
412
  glitchlings -g typogre --file documents/report.txt --diff
347
413
 
@@ -355,8 +421,6 @@ echo "Beware LLM-written flavor-text" | glitchlings -g mim1c
355
421
  glitchlings --config experiments/chaos.yaml "Let slips the glitchlings of war"
356
422
  ```
357
423
 
358
- Use `--help` for a complete breakdown of available options, including support for parameterised glitchlings via `-g "Name(arg=value, ...)"` to mirror the Python API.
359
-
360
424
  Attack configurations live in plain YAML files so you can version-control experiments without touching code:
361
425
 
362
426
  ```yaml
@@ -0,0 +1,42 @@
1
+ glitchlings/__init__.py,sha256=PggQt66bImHyWBggz5CTTFvB19P7iOCMjp2uncvcgXA,1177
2
+ glitchlings/__main__.py,sha256=nB7btO_T4wBFOcyawfWpjEindVrUfTqqV5hdeeS1HT8,128
3
+ glitchlings/_zoo_rust.cp312-win_amd64.pyd,sha256=_J4R5tA4q8CesIZ-K-3OJybUoy-NM_-kmHyo5-GE9vU,2103808
4
+ glitchlings/compat.py,sha256=qba3_W4W5edy9_hoPkekBRNhYy34eG2yCdyWaNrbxeg,7042
5
+ glitchlings/config.py,sha256=USnSw5-HO0ghsuwbmEvimZ4acU2EeNChB6RPlBFj4hc,13013
6
+ glitchlings/config.toml,sha256=EOEqKUwPygOv7MuEuExil5ZQfwKV1H2hU-Z5aBKQ440,111
7
+ glitchlings/main.py,sha256=JDgfHPDhRvZVb7bYQAFGHTRxH8yGNlgStlBqv-y5Thk,10444
8
+ glitchlings/dlc/__init__.py,sha256=IHD-GGhVFb7SVzErvf2YCJkOR4wGo0nFHXkn_daMvS8,146
9
+ glitchlings/dlc/_shared.py,sha256=i66HyJJiHpR0mug7zmfmxB17Vs3CSqBTsk5CuVaLDk0,2040
10
+ glitchlings/dlc/huggingface.py,sha256=Ym8dTArb-43AnCyukOO1m66iAbs8al9YkIWB3rGdhTk,2657
11
+ glitchlings/dlc/prime.py,sha256=KY3so8WOwksbsKhZXfWorsZSYvIdPiUtc8e9apHabkM,8861
12
+ glitchlings/lexicon/__init__.py,sha256=N1G-0xL-dkjRECEhLE1j7BrpBW6evqtjmcG5kiAczTM,6442
13
+ glitchlings/lexicon/_cache.py,sha256=cQCO-dizyClUz8FU8xyaeaJDBxqwrDo6v3YyJ-MQfp0,4052
14
+ glitchlings/lexicon/graph.py,sha256=00HQEbjNVXuBkgCyQy-ru6BB9GHDKiSJXv1TIillXRw,10339
15
+ glitchlings/lexicon/metrics.py,sha256=TZAafSKgHpUS4h6vCuhTKGsvu_fru9kMqsXqLID6BTM,4734
16
+ glitchlings/lexicon/vector.py,sha256=6QDQB2LAjRu1dZwlGYhkkdHyGv9UO79jUbf6KEtjvac,20243
17
+ glitchlings/lexicon/wordnet.py,sha256=YoEOMSIPrkrIORR3wMnPftKJLYh5PBQ7PTNrzZGchxg,6504
18
+ glitchlings/lexicon/data/default_vector_cache.json,sha256=fLT-v1sgF0lv88aPwOP23br9azrjeAkJ1ft6OgPlMeM,741
19
+ glitchlings/util/__init__.py,sha256=Q5lkncOaM6f2eJK3HAtZyxpCjGnekCpwPloqasS3JDo,4869
20
+ glitchlings/util/adapters.py,sha256=mFhPlE8JaFuO_C-3_aqhgwkqa6isV8Y2ifqVh3Iv9JM,720
21
+ glitchlings/zoo/__init__.py,sha256=EljxDKxbl6E4hTuC7Ul98dsp-FvJ2nXQTvD5LoWToWc,5271
22
+ glitchlings/zoo/_ocr_confusions.py,sha256=pPlvJOoan3ouwwGt8hATcO-9luIrGJl0vwUqssUMXD8,1236
23
+ glitchlings/zoo/_rate.py,sha256=o7B9_EfadjshSGLH0B5BHgj1J0OJWVCSXkEE8hljmxc,522
24
+ glitchlings/zoo/_sampling.py,sha256=AAPLObjqKrmX882TX8hdvPHReBOcv0Z4pUuW6AxuGgU,1640
25
+ glitchlings/zoo/_text_utils.py,sha256=LqCa33E-Qxbk6N5AVfxEmAz6C2u7_mCF0xPT9-404A8,2854
26
+ glitchlings/zoo/adjax.py,sha256=Rx8PxK9MBecaSXHJv7rXzWL2uP1QTdNuO2XohPZ61uo,3657
27
+ glitchlings/zoo/core.py,sha256=OE3zZYtyqlQoJkycxl5ZOG52Rxqi05Hd4rr2CAGUhrw,19929
28
+ glitchlings/zoo/jargoyle.py,sha256=fnSXlHlOlVFNKUP44V1TyXFmDYAt1dm1tV2dGL8hCFU,11773
29
+ glitchlings/zoo/mim1c.py,sha256=GqUMErVAVcqMAZjx4hhJ0Af25CxA0Aorv3U_fTqLZek,3546
30
+ glitchlings/zoo/ocr_confusions.tsv,sha256=S-IJEYCIXYKT1Uu7Id8Lnvg5pw528yNigTtWUdnMv9k,213
31
+ glitchlings/zoo/redactyl.py,sha256=0xGFuygN-vCsNplm3UddzFf2pWqvl7RShUFyXNdSzJ4,5627
32
+ glitchlings/zoo/reduple.py,sha256=lpKNqpSk-gzLKryxvobuikTpG3uOXZqPntyxmeeuPhg,4390
33
+ glitchlings/zoo/rushmore.py,sha256=_jU78_q_iJAWffjfq24WwQ2teyQ4brKOFoOU4IZnM7k,4459
34
+ glitchlings/zoo/scannequin.py,sha256=INTZlzskkXPy8zz6O19DBAbyRLQxvFK0AYhwjLfY7Ec,5055
35
+ glitchlings/zoo/typogre.py,sha256=zXvZX8V_0yDmEaLheWKBRa9vCEnSc9TiekYUqZITx0w,6889
36
+ glitchlings/zoo/zeedub.py,sha256=0k7IuTWXbMt5B-1IOwzGk29EvHZNkxyEQUlZloIcrOc,5006
37
+ glitchlings-0.4.2.dist-info/licenses/LICENSE,sha256=EFEP1evBfHaxsMTBjxm0sZVRp2wct8QLvHE1saII5FI,11538
38
+ glitchlings-0.4.2.dist-info/METADATA,sha256=9h2Wc3BbR0pm6d-_AfOcMvTJFL06cVuQFw43d2BVYns,31312
39
+ glitchlings-0.4.2.dist-info/WHEEL,sha256=8UP9x9puWI0P1V_d7K2oMTBqfeLNm21CTzZ_Ptr0NXU,101
40
+ glitchlings-0.4.2.dist-info/entry_points.txt,sha256=kGOwuAsjFDLtztLisaXtOouq9wFVMOJg5FzaAkg-Hto,54
41
+ glitchlings-0.4.2.dist-info/top_level.txt,sha256=VHFNBrLjtDwPCYXbGKi6o17Eueedi81eNbR3hBOoST0,12
42
+ glitchlings-0.4.2.dist-info/RECORD,,
@@ -1,39 +0,0 @@
1
- glitchlings/__init__.py,sha256=onTBFM_ih4O1E1ntZaNaFxiMcD5NtCGc4TaX276sgNk,867
2
- glitchlings/__main__.py,sha256=pqNe1C9hMf8pap4oh6x6yo2h4Nsa2RFSaMWHfGtNXj0,130
3
- glitchlings/_zoo_rust.cp312-win_amd64.pyd,sha256=EMWrDQpRnkzHPhEiK2X7H1qcMPnNN_eIAx_SbAsKlas,2103808
4
- glitchlings/config.py,sha256=P6qMJdHrvZYAIUj7NXxrpEKcv6lDy8Eo4toWu3ctsHs,8043
5
- glitchlings/config.toml,sha256=EOEqKUwPygOv7MuEuExil5ZQfwKV1H2hU-Z5aBKQ440,111
6
- glitchlings/main.py,sha256=sKdUk4trBS-yNbEAOwdTXldg87TSPwnSAr_inecj4bE,10442
7
- glitchlings/dlc/__init__.py,sha256=IHD-GGhVFb7SVzErvf2YCJkOR4wGo0nFHXkn_daMvS8,146
8
- glitchlings/dlc/huggingface.py,sha256=PIesnDIEvyJxj1IuLw2P9nVPTr4Nv81XM7w2axfyhkA,3029
9
- glitchlings/dlc/prime.py,sha256=b5CE1qDl5MxZjTudlKrqMsmSGxXNKZ16krqPyrr2nK8,9569
10
- glitchlings/lexicon/__init__.py,sha256=WTX3vZhbhjd-WsRs63RT9Lw6KSfPW7SfzP2R3L_MFx0,6438
11
- glitchlings/lexicon/_cache.py,sha256=3hiGngtRlMfqKK4vIOnvjxb0tvCfF5u7DZP3wbn2Zlc,4066
12
- glitchlings/lexicon/graph.py,sha256=-AEh3eybkuUbVYg4GtOSvZhSqvik2QYY49A-lcNSi1I,10331
13
- glitchlings/lexicon/metrics.py,sha256=zwd3vm9-pUQbSywORXgHyHCfAjIJs8S5rPNQ70UYgUo,4768
14
- glitchlings/lexicon/vector.py,sha256=rEAKk8o8l8DfiV_-9D-9asLKg1dYc9MzHA5_oRmNIVM,20304
15
- glitchlings/lexicon/wordnet.py,sha256=EeZ1bZx9y-snjEsgItpJTysR1pDNpyO8CxcUztjloj4,6226
16
- glitchlings/lexicon/data/default_vector_cache.json,sha256=fLT-v1sgF0lv88aPwOP23br9azrjeAkJ1ft6OgPlMeM,741
17
- glitchlings/util/__init__.py,sha256=GoyQuHTfGRkHzuZwJji6QWSiGd_LHa9QiyjjEpBFW7E,4679
18
- glitchlings/zoo/__init__.py,sha256=AQu2Z0ECuzQDXwM_DbGaNzkcjLu8WptJS17sh6WTyyA,4975
19
- glitchlings/zoo/_ocr_confusions.py,sha256=W59Aa5MBDwRF65f8GV-6XwGAmlR5Uk7pa5qvHvhIYdY,1252
20
- glitchlings/zoo/_rate.py,sha256=EYUWXYyR2IK0zYBWyBOlnUjDxU32JE9mZTZeodVx5CA,548
21
- glitchlings/zoo/_sampling.py,sha256=UK-XmEERjtY7nLaWDp81yktuZ_K80Un-9tvj4MjsHcg,1642
22
- glitchlings/zoo/_text_utils.py,sha256=YxV069L8c0YSn5iCp72Dv8XCdfhbcFeBrbMoBeKIDns,2862
23
- glitchlings/zoo/adjax.py,sha256=G2diAEsQ8T4mjFCcTeiGzLF0261n7LjLyW5HyVCy3R4,3661
24
- glitchlings/zoo/core.py,sha256=zptaRvSL4wFdiUkmy_x4tD4CUD0la_egDQVMZ1n3xj0,17708
25
- glitchlings/zoo/jargoyle.py,sha256=yRSVRKHdnaUfZMDJ6miBhRQpPHfYK9iD2DCYMp-7Dec,11807
26
- glitchlings/zoo/mim1c.py,sha256=3ddNOzWgLABuEOh5T98Xk439ejx-YHGI7ErXET03Crc,3537
27
- glitchlings/zoo/ocr_confusions.tsv,sha256=S-IJEYCIXYKT1Uu7Id8Lnvg5pw528yNigTtWUdnMv9k,213
28
- glitchlings/zoo/redactyl.py,sha256=P2YYo1V_u62WIj8zqgDpbzDsreGx2I77BJ0RkdCKhXU,5651
29
- glitchlings/zoo/reduple.py,sha256=w90xQWQKwkY3tItk8S20emDQy4FLDbee9rrPyh_ffpg,4363
30
- glitchlings/zoo/rushmore.py,sha256=amAk44TIQBN4rU1c-W1g7I6WForGJMGxNb8uaa8Zfaw,4495
31
- glitchlings/zoo/scannequin.py,sha256=TJyNYTTIB7rxZH3XKIETy0YVf4EjsMgGWYmYaxH9jxU,5030
32
- glitchlings/zoo/typogre.py,sha256=j7LuAyYLrP6LjmCm8Jwi_wPxhTAP_TmWbt5pQrOvFZk,6901
33
- glitchlings/zoo/zeedub.py,sha256=J8F1XZeCMQVVtzWwNiFhOeogjBt1BsOtqrnDjlwUcl8,4984
34
- glitchlings-0.4.1.dist-info/licenses/LICENSE,sha256=EFEP1evBfHaxsMTBjxm0sZVRp2wct8QLvHE1saII5FI,11538
35
- glitchlings-0.4.1.dist-info/METADATA,sha256=5cwuNjNuQCoGUBsM_xipGSoDmC1DBb8AJGhrAeRFnDI,28787
36
- glitchlings-0.4.1.dist-info/WHEEL,sha256=8UP9x9puWI0P1V_d7K2oMTBqfeLNm21CTzZ_Ptr0NXU,101
37
- glitchlings-0.4.1.dist-info/entry_points.txt,sha256=kGOwuAsjFDLtztLisaXtOouq9wFVMOJg5FzaAkg-Hto,54
38
- glitchlings-0.4.1.dist-info/top_level.txt,sha256=VHFNBrLjtDwPCYXbGKi6o17Eueedi81eNbR3hBOoST0,12
39
- glitchlings-0.4.1.dist-info/RECORD,,