glitchlings 0.4.1__cp311-cp311-macosx_11_0_universal2.whl → 0.4.2__cp311-cp311-macosx_11_0_universal2.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.cpython-311-darwin.so +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=qAV0OXtnIGs4YnG_L9xUt9bhTcVhYKrDHfN6ZcBMMX4,1114
2
+ glitchlings/__main__.py,sha256=f-P4jiVBd7ZpS6QxRpa_6SJgOG03UhZhcWasMDRWLs8,120
3
+ glitchlings/_zoo_rust.cpython-311-darwin.so,sha256=WTXzOqP-45v51MizLNyiDaJwbeEnBLv88VZyeySMXB0,2488368
4
+ glitchlings/compat.py,sha256=BdGFf4cKbbHbmLPirNT3U76AXhSn3vpZ59DfNdEQWPQ,6827
5
+ glitchlings/config.py,sha256=TshOTvVlQOhokDTteTMTti-7S2qWnVUJR4LyBYDhQAQ,12638
6
+ glitchlings/config.toml,sha256=MWwgbx1-KIRAY3JZmMrCVbZNxFjHgRJXbtNAVuUNcxY,108
7
+ glitchlings/main.py,sha256=FIpDIqN42HCDCSpsU_JkSzyWC-ugszArwCLfmq_ZCYU,10090
8
+ glitchlings/dlc/__init__.py,sha256=eTLEEWrVWPqniXHqee4W23H1rjElI1PQ_jcqWFe9D3g,141
9
+ glitchlings/dlc/_shared.py,sha256=EFSnush3rjjaf4La5QfVaf_KEp0U_l_3-q4PKx0A6NQ,1972
10
+ glitchlings/dlc/huggingface.py,sha256=9lW7TnTHA_bXyo4Is8pymZchrB9BIL1bMCP2p7LCMtg,2576
11
+ glitchlings/dlc/prime.py,sha256=qGFI1d4BiOEIgQZ5v9QnlbYx4J4q-vNlh5tWZng11xs,8607
12
+ glitchlings/lexicon/__init__.py,sha256=myW5MPFBvsurdisvolE6ECfUraO_mF8Dhyp_KhWxIGs,6244
13
+ glitchlings/lexicon/_cache.py,sha256=KQBesSY-XkH2WwM7Xa_LAPbJEZgIARb2odgrZIHrme8,3948
14
+ glitchlings/lexicon/graph.py,sha256=BbK1YfD9vgfQGDg-QTRegII10IDrervAsu6e20gTFPs,10057
15
+ glitchlings/lexicon/metrics.py,sha256=VBFfFpxjiEwZtK-jS55H8xP7MTC_0OjY8lQ5zSQ9aTY,4572
16
+ glitchlings/lexicon/vector.py,sha256=ILK727WItcHYIRqSVnaAAbGIlj9QTTqjbwHy43UXdb0,19671
17
+ glitchlings/lexicon/wordnet.py,sha256=05ApyN9h0bSw0PQEfjZUeInmGWphxVIuGASc8Zoc5n0,6313
18
+ glitchlings/lexicon/data/default_vector_cache.json,sha256=7obKHqmR3odbTfgJPWLSRFYFh4J_6uvv_CntCSe_EjI,725
19
+ glitchlings/util/__init__.py,sha256=vc3EAY8ehRjbOiryFdaqvvljXcyNGtZSPiEp9ok1vVw,4674
20
+ glitchlings/util/adapters.py,sha256=psxQFYSFmh1u7NuqtIrKwQP5FOhOrZoxZzc7X7DDi9U,693
21
+ glitchlings/zoo/__init__.py,sha256=lu1wnD-lRDJy8uTJKVRwL4qL-nyb0Vyfz9GbiOletCI,5107
22
+ glitchlings/zoo/_ocr_confusions.py,sha256=Ju2_avXiwsr1p8zWFUTOzMxJ8vT5PpYobuGIn4L_sqI,1204
23
+ glitchlings/zoo/_rate.py,sha256=Vb1_5HAzrqr9eAh_zzngSV-d0zI264zcYspnT3VHPkE,504
24
+ glitchlings/zoo/_sampling.py,sha256=KrWyUSsYXghlvktS5hQBO0bPqywEEyA49A2qDWInB7Q,1586
25
+ glitchlings/zoo/_text_utils.py,sha256=fS5L_eq-foBbBdiv4ymI8-O0D0csc3yDekHpX8bqfV4,2754
26
+ glitchlings/zoo/adjax.py,sha256=VJgUasyAk7K3E23B5PzoJ5HaqWtcPJG649TzQRAHraA,3528
27
+ glitchlings/zoo/core.py,sha256=yuCgLXFWJtu2fLOJoCWLtHspbcTFRZhUKobv1AlqKqs,19385
28
+ glitchlings/zoo/jargoyle.py,sha256=sUhCy_0sD0KOAHQKRmy9PTu9FwJitaSBDxdhuX9j7ME,11452
29
+ glitchlings/zoo/mim1c.py,sha256=-fgodKWZq--Xw8L2t1EqNbsh48bwX5jZxmiXdoaQShI,3437
30
+ glitchlings/zoo/ocr_confusions.tsv,sha256=KhtR7vJDTITpfTSGa-I7RHr6CK7LkGi2KjdhEWipI6o,183
31
+ glitchlings/zoo/redactyl.py,sha256=6WgHIVumzRaDIyuLbewTJW5TXBs7s1CsKDPVXP4gkJc,5436
32
+ glitchlings/zoo/reduple.py,sha256=GC1Sq4Ch7WOxL6gQZ9Ogs5EgXU2HkktLeMRVObBYFe4,4241
33
+ glitchlings/zoo/rushmore.py,sha256=zxwiwcHHXHGLv8JLvKS4d0cduZ0qnwO9mcKOwXlMA1M,4305
34
+ glitchlings/zoo/scannequin.py,sha256=JBpiSAnuSgCaEgPwCgSItiHms32wdLNXLPMotaBpYAs,4883
35
+ glitchlings/zoo/typogre.py,sha256=7CHGfBkP4W2Bh8MCxtketA-3nlCb5QRCTUthRnXEhnk,6660
36
+ glitchlings/zoo/zeedub.py,sha256=N4MBwWDRgcspLRlOCSAZ0hdwdnIj4h6uZLaJDFExj6Y,4823
37
+ glitchlings-0.4.2.dist-info/licenses/LICENSE,sha256=YCvGip-LoaRyu6h0nPo71q6eHEkzUpsE11psDJOIRkw,11337
38
+ glitchlings-0.4.2.dist-info/METADATA,sha256=1jm8iwNC4bhfp3nSc-O8POL_U0Fr6fw2RvvADpyxuqg,30721
39
+ glitchlings-0.4.2.dist-info/WHEEL,sha256=Tgp8Vc-mmQm0KX-V22BSUoymoX1p0w13bZbX85y8hSs,114
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=hEmQ1rl3G5uZBDbfJX_W4aIUNSsPAsy_Ai5DgQHasvk,813
2
- glitchlings/__main__.py,sha256=EOiBgay0x6B9VlSDzSQvMuoq6bHJdSvFSgcAVGGKkd4,121
3
- glitchlings/_zoo_rust.cpython-311-darwin.so,sha256=g3v99fyeGelWex500hqBOCSQ26suGLoU2wiq8yTnhGM,2488368
4
- glitchlings/config.py,sha256=hwkcMkhEvUzK8FECgG6kbf_4MpMQcopskiSgXzK5B3o,7785
5
- glitchlings/config.toml,sha256=MWwgbx1-KIRAY3JZmMrCVbZNxFjHgRJXbtNAVuUNcxY,108
6
- glitchlings/main.py,sha256=Rw9pCgNrGxwzC1rZbbng7cHUP9xlL0WWWTdjW95XiSM,10084
7
- glitchlings/dlc/__init__.py,sha256=eTLEEWrVWPqniXHqee4W23H1rjElI1PQ_jcqWFe9D3g,141
8
- glitchlings/dlc/huggingface.py,sha256=I1QWanWVxO02awgSpHDtgQEVF-9AQRLtsta2RCitWhE,2933
9
- glitchlings/dlc/prime.py,sha256=wpRMNtgka1vNlEzifeCjGMp1q_-QclZn3NxXczGnNpM,9278
10
- glitchlings/lexicon/__init__.py,sha256=e3MbtV3R_UOoZXsckR3gnThwgqCi4HXnfduaqxqYXvw,6229
11
- glitchlings/lexicon/_cache.py,sha256=KlcHKtOFH1yPxwhr8_HF_qgpALmUuHkGTzNfWnQ2Jb8,3955
12
- glitchlings/lexicon/graph.py,sha256=YYLrYnmSZ8uf8VvrNLuVF_nIVDH7OoR3RuxJ-9JMA2c,10041
13
- glitchlings/lexicon/metrics.py,sha256=W8TCemZaCjBOUSX8G7JdgQAbMykXXfRTfodkDSkc3aQ,4599
14
- glitchlings/lexicon/vector.py,sha256=oeZQwYxrK25REu4MhUUlMmaStW17Gx6RwrU1v6NooOg,19713
15
- glitchlings/lexicon/wordnet.py,sha256=Zv0YNHSM-DE2ucVZl_OOutTV1s0-i2xPOrfqYYdZKTU,6034
16
- glitchlings/lexicon/data/default_vector_cache.json,sha256=7obKHqmR3odbTfgJPWLSRFYFh4J_6uvv_CntCSe_EjI,725
17
- glitchlings/util/__init__.py,sha256=7KiZ0gKMjocfd34cajneZhTqYb7Hkwi_PpjltPqvkNI,4498
18
- glitchlings/zoo/__init__.py,sha256=eFYmaWeFDlSqfaiED51HWM-OqiTo_BOz0ASeyhOwOsw,4818
19
- glitchlings/zoo/_ocr_confusions.py,sha256=MkCbwk9T24SO2pD3JNPajYCfpMMlm2vQ5_sJty5GoXE,1218
20
- glitchlings/zoo/_rate.py,sha256=TMyfVFV7pLxSGVswPlOAtBvk25Bjtx5xXTtpb_utgik,527
21
- glitchlings/zoo/_sampling.py,sha256=VOSWDgYWXIiAuKxn2IckFJhpRgGotQP_KW28db8kTKI,1587
22
- glitchlings/zoo/_text_utils.py,sha256=nAfFT_VdXMXciCR7eQ5EAmym5wvzL6_Sdn9dvCx2s3Q,2758
23
- glitchlings/zoo/adjax.py,sha256=N3CzfM7m7mAYgFcQYLQkqK2VYLw_vFvEMBM2aNU--ZA,3530
24
- glitchlings/zoo/core.py,sha256=YymiEc66V4mW_4MbTST2038D7YdZVyRkiUZn886IV4I,17203
25
- glitchlings/zoo/jargoyle.py,sha256=6-DJxUFz2AjT-iQDFlK2ZG9pVwq2boDtslEzCNyI_04,11481
26
- glitchlings/zoo/mim1c.py,sha256=yAt1ngR3j2KXLbzc8LhrQlIWRO_KT5dFK1EE8QivMAQ,3429
27
- glitchlings/zoo/ocr_confusions.tsv,sha256=KhtR7vJDTITpfTSGa-I7RHr6CK7LkGi2KjdhEWipI6o,183
28
- glitchlings/zoo/redactyl.py,sha256=H4PwAMBCIsDw1KBOBiTR3VUbRZwynqakwwfx3wHjVp8,5457
29
- glitchlings/zoo/reduple.py,sha256=Q9NRCdvUgaHvvJu8A0n6zW9v_L3pdmNZbWqaJ7uycw4,4216
30
- glitchlings/zoo/rushmore.py,sha256=J1wd4IB7WOAR2TdntkxCMZWseWR0Yii8UQZ7ucfpWCc,4335
31
- glitchlings/zoo/scannequin.py,sha256=Ps8nxysKjkJV408zaL1kjVjy4jliATDBpYcNHLWbNFg,4859
32
- glitchlings/zoo/typogre.py,sha256=0fYaxOEiTnxiCqmsiSN1r_wl1vC1Ueaiks2e94kks70,6668
33
- glitchlings/zoo/zeedub.py,sha256=l51swlo556-TXhDk4nayHOm1XgHwWmfUKzQ01YMuCpE,4801
34
- glitchlings-0.4.1.dist-info/licenses/LICENSE,sha256=YCvGip-LoaRyu6h0nPo71q6eHEkzUpsE11psDJOIRkw,11337
35
- glitchlings-0.4.1.dist-info/METADATA,sha256=9HdqQt7PazdHMtPP5JpINljl3kvL8HOqTFE3Wwyrm2g,28260
36
- glitchlings-0.4.1.dist-info/WHEEL,sha256=Tgp8Vc-mmQm0KX-V22BSUoymoX1p0w13bZbX85y8hSs,114
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,,