glitchlings 0.4.5__cp313-cp313-win_amd64.whl → 0.5.1__cp313-cp313-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 (38) hide show
  1. glitchlings/__init__.py +33 -0
  2. glitchlings/_zoo_rust.cp313-win_amd64.pyd +0 -0
  3. glitchlings/assets/ekkokin_homophones.json +1995 -0
  4. glitchlings/compat.py +98 -8
  5. glitchlings/config.py +12 -24
  6. glitchlings/dev/__init__.py +5 -0
  7. glitchlings/dev/sync_assets.py +130 -0
  8. glitchlings/dlc/pytorch_lightning.py +13 -1
  9. glitchlings/spectroll.py +5 -0
  10. glitchlings/util/stretchability.py +4 -9
  11. glitchlings/zoo/__init__.py +10 -2
  12. glitchlings/zoo/_ocr_confusions.py +3 -3
  13. glitchlings/zoo/_text_utils.py +10 -9
  14. glitchlings/zoo/adjax.py +3 -18
  15. glitchlings/zoo/apostrofae.py +2 -5
  16. glitchlings/zoo/assets/__init__.py +91 -0
  17. glitchlings/zoo/ekkokin.py +226 -0
  18. glitchlings/zoo/jargoyle.py +2 -16
  19. glitchlings/zoo/mim1c.py +2 -17
  20. glitchlings/zoo/redactyl.py +3 -17
  21. glitchlings/zoo/reduple.py +3 -17
  22. glitchlings/zoo/rushmore.py +3 -20
  23. glitchlings/zoo/scannequin.py +3 -20
  24. glitchlings/zoo/spectroll.py +159 -0
  25. glitchlings/zoo/typogre.py +2 -19
  26. glitchlings/zoo/zeedub.py +2 -13
  27. {glitchlings-0.4.5.dist-info → glitchlings-0.5.1.dist-info}/METADATA +22 -7
  28. glitchlings-0.5.1.dist-info/RECORD +57 -0
  29. glitchlings/data/__init__.py +0 -1
  30. glitchlings/zoo/_rate.py +0 -131
  31. glitchlings-0.4.5.dist-info/RECORD +0 -53
  32. /glitchlings/{zoo/assets → assets}/apostrofae_pairs.json +0 -0
  33. /glitchlings/{data → assets}/hokey_assets.json +0 -0
  34. /glitchlings/{zoo → assets}/ocr_confusions.tsv +0 -0
  35. {glitchlings-0.4.5.dist-info → glitchlings-0.5.1.dist-info}/WHEEL +0 -0
  36. {glitchlings-0.4.5.dist-info → glitchlings-0.5.1.dist-info}/entry_points.txt +0 -0
  37. {glitchlings-0.4.5.dist-info → glitchlings-0.5.1.dist-info}/licenses/LICENSE +0 -0
  38. {glitchlings-0.4.5.dist-info → glitchlings-0.5.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,159 @@
1
+ from __future__ import annotations
2
+
3
+ import random
4
+ import re
5
+ from itertools import zip_longest
6
+
7
+ from .core import AttackOrder, AttackWave, Glitchling
8
+
9
+ _CANONICAL_COLOR_MAP: dict[str, str] = {
10
+ "red": "blue",
11
+ "blue": "red",
12
+ "green": "lime",
13
+ "lime": "green",
14
+ "yellow": "purple",
15
+ "purple": "yellow",
16
+ "orange": "cyan",
17
+ "cyan": "orange",
18
+ "magenta": "teal",
19
+ "teal": "magenta",
20
+ "black": "white",
21
+ "white": "black",
22
+ }
23
+
24
+ _VALID_MODES = {"literal", "drift"}
25
+
26
+ _COLOR_PATTERN = re.compile(
27
+ r"\b(?P<color>"
28
+ + "|".join(sorted(_CANONICAL_COLOR_MAP, key=len, reverse=True))
29
+ + r")(?P<suffix>[a-zA-Z]*)\b",
30
+ re.IGNORECASE,
31
+ )
32
+
33
+ _COLOR_ADJACENCY: dict[str, tuple[str, ...]] = {
34
+ "red": ("orange", "magenta", "purple"),
35
+ "blue": ("cyan", "teal", "purple"),
36
+ "green": ("teal", "cyan", "yellow"),
37
+ "lime": ("yellow", "white", "cyan"),
38
+ "yellow": ("orange", "lime", "white"),
39
+ "purple": ("magenta", "red", "blue"),
40
+ "orange": ("red", "yellow", "magenta"),
41
+ "cyan": ("blue", "green", "teal"),
42
+ "magenta": ("purple", "red", "blue"),
43
+ "teal": ("cyan", "green", "blue"),
44
+ "black": ("purple", "blue", "teal"),
45
+ "white": ("yellow", "lime", "cyan"),
46
+ }
47
+
48
+
49
+ def _apply_case(template: str, replacement: str) -> str:
50
+ if not template:
51
+ return replacement
52
+ if template.isupper():
53
+ return replacement.upper()
54
+ if template.islower():
55
+ return replacement.lower()
56
+ if template[0].isupper() and template[1:].islower():
57
+ return replacement.capitalize()
58
+
59
+ characters: list[str] = []
60
+ for repl_char, template_char in zip_longest(replacement, template, fillvalue=""):
61
+ if template_char.isupper():
62
+ characters.append(repl_char.upper())
63
+ elif template_char.islower():
64
+ characters.append(repl_char.lower())
65
+ else:
66
+ characters.append(repl_char)
67
+ return "".join(characters)
68
+
69
+
70
+ def _harmonize_suffix(original: str, replacement: str, suffix: str) -> str:
71
+ if not suffix:
72
+ return suffix
73
+
74
+ if (
75
+ original
76
+ and suffix
77
+ and original[-1].lower() == suffix[0].lower()
78
+ and replacement[-1].lower() != suffix[0].lower()
79
+ ):
80
+ return suffix[1:]
81
+ return suffix
82
+
83
+
84
+ def _normalize_mode(mode: str | None) -> str:
85
+ normalized = "literal" if mode is None else mode.lower()
86
+ if normalized not in _VALID_MODES:
87
+ valid = ", ".join(sorted(_VALID_MODES))
88
+ raise ValueError(f"Unsupported Spectroll mode '{mode}'. Expected one of: {valid}")
89
+ return normalized
90
+
91
+
92
+ def swap_colors(
93
+ text: str,
94
+ *,
95
+ seed: int | None = None,
96
+ mode: str = "literal",
97
+ rng: random.Random | None = None,
98
+ ) -> str:
99
+ """Swap canonical colour words for their partners.
100
+
101
+ Examples:
102
+ >>> swap_colors("red green blue")
103
+ 'blue lime red'
104
+ >>> swap_colors("red green blue", mode="drift", seed=42)
105
+ 'purple teal cyan'
106
+ """
107
+
108
+ normalized_mode = _normalize_mode(mode)
109
+ active_rng = rng if rng is not None else random.Random(seed)
110
+
111
+ def replace(match: re.Match[str]) -> str:
112
+ base = match.group("color")
113
+ suffix = match.group("suffix") or ""
114
+ canonical = base.lower()
115
+
116
+ replacement_base: str | None
117
+ if normalized_mode == "literal":
118
+ replacement_base = _CANONICAL_COLOR_MAP.get(canonical)
119
+ else:
120
+ palette = _COLOR_ADJACENCY.get(canonical)
121
+ if palette:
122
+ replacement_base = active_rng.choice(palette)
123
+ else:
124
+ replacement_base = _CANONICAL_COLOR_MAP.get(canonical)
125
+
126
+ if not replacement_base:
127
+ return match.group(0)
128
+
129
+ suffix_fragment = _harmonize_suffix(base, replacement_base, suffix)
130
+ adjusted = _apply_case(base, replacement_base)
131
+ return f"{adjusted}{suffix_fragment}"
132
+
133
+ return _COLOR_PATTERN.sub(replace, text)
134
+
135
+
136
+ class Spectroll(Glitchling):
137
+ """Glitchling that remaps colour terms to alternate hues."""
138
+
139
+ def __init__(
140
+ self,
141
+ *,
142
+ mode: str = "literal",
143
+ seed: int | None = None,
144
+ ) -> None:
145
+ normalized_mode = _normalize_mode(mode)
146
+ super().__init__(
147
+ name="Spectroll",
148
+ corruption_function=swap_colors,
149
+ scope=AttackWave.WORD,
150
+ order=AttackOrder.NORMAL,
151
+ seed=seed,
152
+ mode=normalized_mode,
153
+ )
154
+
155
+
156
+ spectroll = Spectroll()
157
+
158
+
159
+ __all__ = ["Spectroll", "spectroll", "swap_colors"]
@@ -5,7 +5,6 @@ import random
5
5
  from typing import Any, Optional, cast
6
6
 
7
7
  from ..util import KEYNEIGHBORS
8
- from ._rate import resolve_rate
9
8
  from ._rust_extensions import get_rust_operation
10
9
  from .core import AttackOrder, AttackWave, Glitchling
11
10
 
@@ -144,16 +143,9 @@ def fatfinger(
144
143
  keyboard: str = "CURATOR_QWERTY",
145
144
  seed: int | None = None,
146
145
  rng: random.Random | None = None,
147
- *,
148
- max_change_rate: float | None = None,
149
146
  ) -> str:
150
147
  """Introduce character-level "fat finger" edits with a Rust fast path."""
151
- effective_rate = resolve_rate(
152
- rate=rate,
153
- legacy_value=max_change_rate,
154
- default=0.02,
155
- legacy_name="max_change_rate",
156
- )
148
+ effective_rate = 0.02 if rate is None else rate
157
149
 
158
150
  if rng is None:
159
151
  rng = random.Random(seed)
@@ -182,17 +174,10 @@ class Typogre(Glitchling):
182
174
  self,
183
175
  *,
184
176
  rate: float | None = None,
185
- max_change_rate: float | None = None,
186
177
  keyboard: str = "CURATOR_QWERTY",
187
178
  seed: int | None = None,
188
179
  ) -> None:
189
- self._param_aliases = {"max_change_rate": "rate"}
190
- effective_rate = resolve_rate(
191
- rate=rate,
192
- legacy_value=max_change_rate,
193
- default=0.02,
194
- legacy_name="max_change_rate",
195
- )
180
+ effective_rate = 0.02 if rate is None else rate
196
181
  super().__init__(
197
182
  name="Typogre",
198
183
  corruption_function=fatfinger,
@@ -205,8 +190,6 @@ class Typogre(Glitchling):
205
190
 
206
191
  def pipeline_operation(self) -> dict[str, Any] | None:
207
192
  rate = self.kwargs.get("rate")
208
- if rate is None:
209
- rate = self.kwargs.get("max_change_rate")
210
193
  if rate is None:
211
194
  return None
212
195
 
glitchlings/zoo/zeedub.py CHANGED
@@ -5,7 +5,6 @@ import random
5
5
  from collections.abc import Sequence
6
6
  from typing import Any, cast
7
7
 
8
- from ._rate import resolve_rate
9
8
  from ._rust_extensions import get_rust_operation
10
9
  from .core import AttackOrder, AttackWave, Glitchling
11
10
 
@@ -77,12 +76,7 @@ def insert_zero_widths(
77
76
  characters: Sequence[str] | None = None,
78
77
  ) -> str:
79
78
  """Inject zero-width characters between non-space character pairs."""
80
- effective_rate = resolve_rate(
81
- rate=rate,
82
- legacy_value=None,
83
- default=0.02,
84
- legacy_name="rate",
85
- )
79
+ effective_rate = 0.02 if rate is None else rate
86
80
 
87
81
  if rng is None:
88
82
  rng = random.Random(seed)
@@ -142,12 +136,7 @@ class Zeedub(Glitchling):
142
136
  seed: int | None = None,
143
137
  characters: Sequence[str] | None = None,
144
138
  ) -> None:
145
- effective_rate = resolve_rate(
146
- rate=rate,
147
- legacy_value=None,
148
- default=0.02,
149
- legacy_name="rate",
150
- )
139
+ effective_rate = 0.02 if rate is None else rate
151
140
  super().__init__(
152
141
  name="Zeedub",
153
142
  corruption_function=insert_zero_widths,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glitchlings
3
- Version: 0.4.5
3
+ Version: 0.5.1
4
4
  Summary: Monsters for your language games.
5
5
  Author: osoleve
6
6
  License: Apache License
@@ -294,11 +294,14 @@ Dynamic: license-file
294
294
  Every language game breeds monsters.
295
295
  ```
296
296
 
297
+ ![Python Versions](https://img.shields.io/pypi/pyversions/glitchlings.svg)
297
298
  [![PyPI version](https://img.shields.io/pypi/v/glitchlings.svg)](https://pypi.org/project/glitchlings/)
298
- [![PyPI Status](https://github.com/osoleve/glitchlings/actions/workflows/publish.yml/badge.svg)](https://github.com/osoleve/glitchlings/actions/workflows/publish.yml)
299
- [![Lint and Type](https://github.com/osoleve/glitchlings/actions/workflows/ci.yml/badge.svg)](https://github.com/osoleve/glitchlings/actions/workflows/ci.yml)
300
- [![Website status](https://img.shields.io/website-up-down-green-red/https/osoleve.github.io/glitchlings)](https://osoleve.github.io/glitchlings/)
301
- [![License](https://img.shields.io/github/license/osoleve/glitchlings.svg)](https://github.com/osoleve/glitchlings/blob/main/LICENSE)
299
+ ![Wheel](https://img.shields.io/pypi/wheel/glitchlings.svg)
300
+ ![Linting and Typing](https://github.com/osoleve/glitchlings/actions/workflows/ci.yml/badge.svg)
301
+ ![Entropy Budget](https://img.shields.io/badge/entropy-lifegiving-magenta.svg)
302
+ ![Chaos](https://img.shields.io/badge/chaos-friend--shaped-chartreuse.svg)
303
+ ![Charm](https://img.shields.io/badge/jouissance-indefatigable-cyan.svg)
304
+ ![Lore Compliance](https://img.shields.io/badge/ISO--474--▓▓-Z--Compliant-blue.svg)
302
305
 
303
306
  `Glitchlings` are **utilities for corrupting the text inputs to your language models in deterministic, _linguistically principled_** ways.
304
307
  Each embodies a different way that documents can be compromised in the wild.
@@ -390,11 +393,13 @@ glitchlings --list
390
393
  Apostrofae — scope: Character, order: normal
391
394
  Hokey — scope: Character, order: first
392
395
  Mim1c — scope: Character, order: last
396
+ Ekkokin — scope: Word, order: early
393
397
  Jargoyle — scope: Word, order: normal
394
398
  Adjax — scope: Word, order: normal
395
399
  Reduple — scope: Word, order: normal
396
400
  Rushmore — scope: Word, order: normal
397
401
  Redactyl — scope: Word, order: normal
402
+ Spectroll — scope: Word, order: normal
398
403
  Scannequin — scope: Character, order: late
399
404
  Zeedub — scope: Character, order: last
400
405
  ```
@@ -549,6 +554,18 @@ _Watch your step around here._
549
554
  > - `characters (Sequence[str])`: Optional override for the pool of zero-width strings to inject (default: curated invisibles such as U+200B, U+200C, U+200D, U+FEFF, U+2060).
550
555
  > - `seed (int)`: The random seed for reproducibility (default: 151).
551
556
 
557
+ ### Ekkokin
558
+
559
+ _Did you hear what I heard?_
560
+
561
+ > _**Echo Chamber.**_ Ekkokin swaps words with curated homophones so the text still sounds right while the spelling drifts. Groups are normalised to prevent duplicates and casing is preserved when substitutions fire.
562
+ >
563
+ > Args
564
+ >
565
+ > - `rate (float)`: Maximum proportion of eligible words to replace with homophones (default: 0.02, 2%).
566
+ > - `weighting (str)`: Sampling strategy applied within each homophone set (default: "flat").
567
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
568
+
552
569
  ### Jargoyle
553
570
 
554
571
  _Uh oh. The worst person you know just bought a thesaurus._
@@ -596,7 +613,6 @@ _Keep your hands and punctuation where I can see them._
596
613
  > Args
597
614
  >
598
615
  > - `rate (float)`: Probability that each adjacent pair swaps cores (default: 0.5, 50%).
599
- > - `swap_rate (float)`: Alias for `rate`, retained for backward compatibility.
600
616
  > - `seed (int)`: The random seed for reproducibility (default: 151).
601
617
 
602
618
  ### Redactyl
@@ -617,7 +633,6 @@ _Oops, that was my black highlighter._
617
633
 
618
634
  ### _Containment procedures pending_
619
635
 
620
- - `ekkokin` substitutes words with homophones (phonetic equivalents).
621
636
  - `nylingual` backtranslates portions of text.
622
637
  - `glothopper` introduces code-switching effects, blending languages or dialects.
623
638
  - `palimpsest` rewrites, but leaves accidental traces of the past.
@@ -0,0 +1,57 @@
1
+ glitchlings/__init__.py,sha256=NFlHQWDuMWspkx0dEknAdmQeEMAXzqRfkh5zlgm2ys0,2051
2
+ glitchlings/__main__.py,sha256=nB7btO_T4wBFOcyawfWpjEindVrUfTqqV5hdeeS1HT8,128
3
+ glitchlings/_zoo_rust.cp313-win_amd64.pyd,sha256=oapV2upzUdYcFbeHOivEZGQF2r9NaGjIttv5K2hyuiE,2413568
4
+ glitchlings/compat.py,sha256=QAu4PYbBY6WNhk9o68cFIXys67d-_isedtJMIZXGSVE,12437
5
+ glitchlings/config.py,sha256=00BAHPbfOFnGHvC7FCcz1YpJjdsfpn1ET5SJJdsVQog,12677
6
+ glitchlings/config.toml,sha256=OywXmEpuOPtyJRbcRt4cwQkHiZ__5axEHoCaX9ye-uA,102
7
+ glitchlings/main.py,sha256=eCUEFsu8-NLDz1xyKNDIucVm975HNQZJYm6YCv8RIyg,10987
8
+ glitchlings/spectroll.py,sha256=oxV21u_0xZQWl_rURpG40Ojj0ctjY0OvCYJNbxHSPnU,155
9
+ glitchlings/assets/apostrofae_pairs.json,sha256=lPLFLndzn_f7_5wZizxsLMnwBY4O63zsCvDjyJ56MLA,553
10
+ glitchlings/assets/ekkokin_homophones.json,sha256=7_7tsBJdwn8BwUq9-aBTvFyUcg45Hu3Vm8xQQu4Ac1M,19054
11
+ glitchlings/assets/hokey_assets.json,sha256=1GaSEzXwtT1nvf0B9mFyLzHOcqzKbPreibsC6iBWAHA,3083
12
+ glitchlings/assets/ocr_confusions.tsv,sha256=S-IJEYCIXYKT1Uu7Id8Lnvg5pw528yNigTtWUdnMv9k,213
13
+ glitchlings/dev/__init__.py,sha256=Pr2tXDwfa6SHW1wPseLHRXPINi7lEs6QNClreU0rAiw,147
14
+ glitchlings/dev/sync_assets.py,sha256=tudnk8nW4Nu6RcDnfUhEAMbQJv3AwGjfsvgvWNjKzt4,3805
15
+ glitchlings/dlc/__init__.py,sha256=iFDTwkaWl2C0_QUYykIXfmOUzy__oURX_BiJhexf-8o,312
16
+ glitchlings/dlc/_shared.py,sha256=q1xMclEsbR0KIEn9chwZXRubMnIvU-uIc_0PxCFpmqE,4560
17
+ glitchlings/dlc/huggingface.py,sha256=6wD4Vu2jp1d8GYSUiAvOAXqCO9w4HBxCOSfbJM8Ylzw,2657
18
+ glitchlings/dlc/prime.py,sha256=8-Ix8bjKyDKDMyXHDESE-gFDwC6blAP3mPXm1YiP3_U,8861
19
+ glitchlings/dlc/pytorch.py,sha256=xR-uoeo8f6g-aM2CmQ1cfHKfqn12uwRA9eCebEO5wXA,6399
20
+ glitchlings/dlc/pytorch_lightning.py,sha256=rNC0keSuyMhx0OZnaZE1lDm2EhCVuFgglAd95W8MSPI,8699
21
+ glitchlings/lexicon/__init__.py,sha256=oSLI1bOMfTpqiI7bMp9beeQ7Vp81G5coXxwdmCIQfV0,6199
22
+ glitchlings/lexicon/_cache.py,sha256=MRvomTi2Rx0l9FzHm91VrfRkrHqACjS5LG4a4OOCvLY,4180
23
+ glitchlings/lexicon/metrics.py,sha256=TZAafSKgHpUS4h6vCuhTKGsvu_fru9kMqsXqLID6BTM,4734
24
+ glitchlings/lexicon/vector.py,sha256=1YivmCdb9IFqVNQTJiTztxRoFQi7Fmmg-8qKO7FUKzM,23252
25
+ glitchlings/lexicon/wordnet.py,sha256=Kdj0k1m9GJAdH41zVw0MkEAoLy0-KG0ZyS6hGFq_raY,7804
26
+ glitchlings/lexicon/data/default_vector_cache.json,sha256=bnMV4tHIVOQtK7FDH81yqSLRkeViEzclGKXrrS8fEJ8,1079
27
+ glitchlings/util/__init__.py,sha256=Q5lkncOaM6f2eJK3HAtZyxpCjGnekCpwPloqasS3JDo,4869
28
+ glitchlings/util/adapters.py,sha256=mFhPlE8JaFuO_C-3_aqhgwkqa6isV8Y2ifqVh3Iv9JM,720
29
+ glitchlings/util/hokey_generator.py,sha256=hNWVbscVeKvcqwFtJ1oaWYf2Z0qHSxy0-iMLjht6zuM,4627
30
+ glitchlings/util/stretch_locator.py,sha256=tM4XsQ_asNXQq2Yee8STybFMCC2HbSKCu9I49G0yJ3c,4334
31
+ glitchlings/util/stretchability.py,sha256=WWGMN9MTbHhgQIBB_p_cz-JKb51rCHZqyDRjPGkUOjY,13037
32
+ glitchlings/zoo/__init__.py,sha256=VpZ8LVF0MwdWNDzf9E3KKJ20G8gvevd24Riqq-3BuCw,5759
33
+ glitchlings/zoo/_ocr_confusions.py,sha256=Kyo3W6w-FGs4C7jXp4bLFHFCaa0RUJWvUrWKqfBOdBk,1171
34
+ glitchlings/zoo/_rust_extensions.py,sha256=SdU06m-qjf-rRHnqM5OMophx1IacoI4KbyRu2HXrTUc,4354
35
+ glitchlings/zoo/_sampling.py,sha256=AAPLObjqKrmX882TX8hdvPHReBOcv0Z4pUuW6AxuGgU,1640
36
+ glitchlings/zoo/_text_utils.py,sha256=DRjPuC-nFoxFeA7KIbpuIB5k8DXbvvvcHNJniL_8KoQ,2872
37
+ glitchlings/zoo/adjax.py,sha256=Oz3WGSsa4qpH7HLgBQC0r4JktJYGl3A0vkVknqeSG5I,3249
38
+ glitchlings/zoo/apostrofae.py,sha256=C9x9_jj9CidYEWL9OEoNJU_Jzr3Vk4UQ8tITThVbwvY,3798
39
+ glitchlings/zoo/core.py,sha256=tkJFqGwpVa7qQxkUr9lsHOB8zS3lDCo987R6Nvz375U,21257
40
+ glitchlings/zoo/ekkokin.py,sha256=A85MMhIDbooLRYMPL1yT3x1LEzbc-Qo7UwGbVffDxdU,6668
41
+ glitchlings/zoo/hokey.py,sha256=h-yjCLqYAZFksIYw4fMniuTWUywFw9GU9yUFs_uECHo,5471
42
+ glitchlings/zoo/jargoyle.py,sha256=2FwL4A_DpI2Lz6pnZo5iSJZzgd8wDNM9bMeOsMVFSmw,11581
43
+ glitchlings/zoo/mim1c.py,sha256=86lCawTFWRWsO_vH6GMRJfM09TMTUy5MNhO9gsBEkk0,3105
44
+ glitchlings/zoo/redactyl.py,sha256=2BYQfcKwp1WFPwXomQCmh-z0UPN9sNx6Px84WilFs3k,5323
45
+ glitchlings/zoo/reduple.py,sha256=YukTZvLMBoarx96T4LHLGHr_KJVmFkAb0OBsO13ws8A,3911
46
+ glitchlings/zoo/rushmore.py,sha256=CiVkLlskOmfKtzFanmYe6wxKJkCSMbLeKTWDrwZZaXw,3895
47
+ glitchlings/zoo/scannequin.py,sha256=s2wno1_7aGebXvG3o9WvDQ5RRwp5Upl2dejbDUGIXkY,4560
48
+ glitchlings/zoo/spectroll.py,sha256=2V9HgWs76ttLww45PpQgLOSKfy1xBHFfoPPrigLmvUY,4635
49
+ glitchlings/zoo/typogre.py,sha256=B1-kMfOygKtiKXDBQOHJxvheielBWGbbdWk-cgoONgs,6402
50
+ glitchlings/zoo/zeedub.py,sha256=4x9bNQEq4VSsfol77mYx8jyBRyTugjRQPyk-ANy6gpY,4792
51
+ glitchlings/zoo/assets/__init__.py,sha256=UP5moOFAd0Nm539c9hwGsXvXY4tZ-e1c0CSAjsH1IRk,2820
52
+ glitchlings-0.5.1.dist-info/licenses/LICENSE,sha256=EFEP1evBfHaxsMTBjxm0sZVRp2wct8QLvHE1saII5FI,11538
53
+ glitchlings-0.5.1.dist-info/METADATA,sha256=KJff7BHDX7a2v-g2DBRUQGGeM6c65bIxN8o97NWwA_U,34580
54
+ glitchlings-0.5.1.dist-info/WHEEL,sha256=qV0EIPljj1XC_vuSatRWjn02nZIz3N1t8jsZz7HBr2U,101
55
+ glitchlings-0.5.1.dist-info/entry_points.txt,sha256=kGOwuAsjFDLtztLisaXtOouq9wFVMOJg5FzaAkg-Hto,54
56
+ glitchlings-0.5.1.dist-info/top_level.txt,sha256=VHFNBrLjtDwPCYXbGKi6o17Eueedi81eNbR3hBOoST0,12
57
+ glitchlings-0.5.1.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- """Static data assets shared across Glitchlings implementations."""
glitchlings/zoo/_rate.py DELETED
@@ -1,131 +0,0 @@
1
- """Utilities for handling legacy parameter names across glitchling classes."""
2
-
3
- from __future__ import annotations
4
-
5
- import warnings
6
-
7
-
8
- def resolve_rate(
9
- *,
10
- rate: float | None,
11
- legacy_value: float | None,
12
- default: float,
13
- legacy_name: str,
14
- ) -> float:
15
- """Return the effective rate while enforcing mutual exclusivity.
16
-
17
- This function centralizes the handling of legacy parameter names, allowing
18
- glitchlings to maintain backwards compatibility while encouraging migration
19
- to the standardized 'rate' parameter.
20
-
21
- Parameters
22
- ----------
23
- rate : float | None
24
- The preferred parameter value.
25
- legacy_value : float | None
26
- The deprecated legacy parameter value.
27
- default : float
28
- Default value if neither parameter is specified.
29
- legacy_name : str
30
- Name of the legacy parameter for error/warning messages.
31
-
32
- Returns
33
- -------
34
- float
35
- The resolved rate value.
36
-
37
- Raises
38
- ------
39
- ValueError
40
- If both rate and legacy_value are specified simultaneously.
41
-
42
- Warnings
43
- --------
44
- DeprecationWarning
45
- If the legacy parameter is used, a deprecation warning is issued.
46
-
47
- Examples
48
- --------
49
- >>> resolve_rate(rate=0.5, legacy_value=None, default=0.1, legacy_name="old_rate")
50
- 0.5
51
- >>> resolve_rate(rate=None, legacy_value=0.3, default=0.1, legacy_name="old_rate")
52
- 0.3 # Issues deprecation warning
53
- >>> resolve_rate(rate=None, legacy_value=None, default=0.1, legacy_name="old_rate")
54
- 0.1
55
-
56
- """
57
- if rate is not None and legacy_value is not None:
58
- raise ValueError(f"Specify either 'rate' or '{legacy_name}', not both.")
59
-
60
- if rate is not None:
61
- return rate
62
-
63
- if legacy_value is not None:
64
- warnings.warn(
65
- f"The '{legacy_name}' parameter is deprecated and will be removed in version 0.6.0. "
66
- f"Use 'rate' instead.",
67
- DeprecationWarning,
68
- stacklevel=3,
69
- )
70
- return legacy_value
71
-
72
- return default
73
-
74
-
75
- def resolve_legacy_param(
76
- *,
77
- preferred_value: object,
78
- legacy_value: object,
79
- default: object,
80
- preferred_name: str,
81
- legacy_name: str,
82
- ) -> object:
83
- """Resolve a parameter that has both preferred and legacy names.
84
-
85
- This is a generalized version of resolve_rate() that works with any type.
86
-
87
- Parameters
88
- ----------
89
- preferred_value : object
90
- The value from the preferred parameter name.
91
- legacy_value : object
92
- The value from the legacy parameter name.
93
- default : object
94
- Default value if neither parameter is specified.
95
- preferred_name : str
96
- Name of the preferred parameter.
97
- legacy_name : str
98
- Name of the legacy parameter for warning messages.
99
-
100
- Returns
101
- -------
102
- object
103
- The resolved parameter value.
104
-
105
- Raises
106
- ------
107
- ValueError
108
- If both preferred and legacy values are specified simultaneously.
109
-
110
- Warnings
111
- --------
112
- DeprecationWarning
113
- If the legacy parameter is used.
114
-
115
- """
116
- if preferred_value is not None and legacy_value is not None:
117
- raise ValueError(f"Specify either '{preferred_name}' or '{legacy_name}', not both.")
118
-
119
- if preferred_value is not None:
120
- return preferred_value
121
-
122
- if legacy_value is not None:
123
- warnings.warn(
124
- f"The '{legacy_name}' parameter is deprecated and will be removed in version 0.6.0. "
125
- f"Use '{preferred_name}' instead.",
126
- DeprecationWarning,
127
- stacklevel=3,
128
- )
129
- return legacy_value
130
-
131
- return default
@@ -1,53 +0,0 @@
1
- glitchlings/__init__.py,sha256=pNL6Vx6ggpRq-vW0CXJjnWOe_LktP6Zz9xNhqDHj3Dw,1301
2
- glitchlings/__main__.py,sha256=nB7btO_T4wBFOcyawfWpjEindVrUfTqqV5hdeeS1HT8,128
3
- glitchlings/_zoo_rust.cp313-win_amd64.pyd,sha256=6hdbgPFxuHKkzuoajgzrX67X9--NKf5BX2UehNGO1AY,2349568
4
- glitchlings/compat.py,sha256=j4lkWNtyox5sen5j7u0SHfnk8QUn-yicaqvuLlZp1-s,9174
5
- glitchlings/config.py,sha256=rBBHRmkIyoWRPcUFrsxmSm08qxZ07wDAuO5AAF6sjAk,13323
6
- glitchlings/config.toml,sha256=OywXmEpuOPtyJRbcRt4cwQkHiZ__5axEHoCaX9ye-uA,102
7
- glitchlings/main.py,sha256=eCUEFsu8-NLDz1xyKNDIucVm975HNQZJYm6YCv8RIyg,10987
8
- glitchlings/data/__init__.py,sha256=kIT4a2EDNo_R-iL8kVisJ8PxR_BrygNYegfG_Ua6DcE,69
9
- glitchlings/data/hokey_assets.json,sha256=1GaSEzXwtT1nvf0B9mFyLzHOcqzKbPreibsC6iBWAHA,3083
10
- glitchlings/dlc/__init__.py,sha256=iFDTwkaWl2C0_QUYykIXfmOUzy__oURX_BiJhexf-8o,312
11
- glitchlings/dlc/_shared.py,sha256=q1xMclEsbR0KIEn9chwZXRubMnIvU-uIc_0PxCFpmqE,4560
12
- glitchlings/dlc/huggingface.py,sha256=6wD4Vu2jp1d8GYSUiAvOAXqCO9w4HBxCOSfbJM8Ylzw,2657
13
- glitchlings/dlc/prime.py,sha256=8-Ix8bjKyDKDMyXHDESE-gFDwC6blAP3mPXm1YiP3_U,8861
14
- glitchlings/dlc/pytorch.py,sha256=xR-uoeo8f6g-aM2CmQ1cfHKfqn12uwRA9eCebEO5wXA,6399
15
- glitchlings/dlc/pytorch_lightning.py,sha256=EQq7SMlvNoyBLYVW2Vi19H5k8VUqoAiNx8IqkDWqy5I,8214
16
- glitchlings/lexicon/__init__.py,sha256=oSLI1bOMfTpqiI7bMp9beeQ7Vp81G5coXxwdmCIQfV0,6199
17
- glitchlings/lexicon/_cache.py,sha256=MRvomTi2Rx0l9FzHm91VrfRkrHqACjS5LG4a4OOCvLY,4180
18
- glitchlings/lexicon/metrics.py,sha256=TZAafSKgHpUS4h6vCuhTKGsvu_fru9kMqsXqLID6BTM,4734
19
- glitchlings/lexicon/vector.py,sha256=1YivmCdb9IFqVNQTJiTztxRoFQi7Fmmg-8qKO7FUKzM,23252
20
- glitchlings/lexicon/wordnet.py,sha256=Kdj0k1m9GJAdH41zVw0MkEAoLy0-KG0ZyS6hGFq_raY,7804
21
- glitchlings/lexicon/data/default_vector_cache.json,sha256=bnMV4tHIVOQtK7FDH81yqSLRkeViEzclGKXrrS8fEJ8,1079
22
- glitchlings/util/__init__.py,sha256=Q5lkncOaM6f2eJK3HAtZyxpCjGnekCpwPloqasS3JDo,4869
23
- glitchlings/util/adapters.py,sha256=mFhPlE8JaFuO_C-3_aqhgwkqa6isV8Y2ifqVh3Iv9JM,720
24
- glitchlings/util/hokey_generator.py,sha256=hNWVbscVeKvcqwFtJ1oaWYf2Z0qHSxy0-iMLjht6zuM,4627
25
- glitchlings/util/stretch_locator.py,sha256=tM4XsQ_asNXQq2Yee8STybFMCC2HbSKCu9I49G0yJ3c,4334
26
- glitchlings/util/stretchability.py,sha256=ja1PJKVAKySUP5G2T0Q_THwIvydJn49xYFaQn58cQYw,13194
27
- glitchlings/zoo/__init__.py,sha256=Ab69SD_RUXfiWUEzqU3wteGWobpm2kkbmwndYLEbv_0,5511
28
- glitchlings/zoo/_ocr_confusions.py,sha256=pPlvJOoan3ouwwGt8hATcO-9luIrGJl0vwUqssUMXD8,1236
29
- glitchlings/zoo/_rate.py,sha256=KxFDFJEGWsv76v1JcoHXIETj9kGdbbAiUqCPwAcWcDw,3710
30
- glitchlings/zoo/_rust_extensions.py,sha256=SdU06m-qjf-rRHnqM5OMophx1IacoI4KbyRu2HXrTUc,4354
31
- glitchlings/zoo/_sampling.py,sha256=AAPLObjqKrmX882TX8hdvPHReBOcv0Z4pUuW6AxuGgU,1640
32
- glitchlings/zoo/_text_utils.py,sha256=LqCa33E-Qxbk6N5AVfxEmAz6C2u7_mCF0xPT9-404A8,2854
33
- glitchlings/zoo/adjax.py,sha256=8AqTfcJe50vPVxER5wREuyr4qqsmyKqi-klDW77HVYM,3646
34
- glitchlings/zoo/apostrofae.py,sha256=WB1zvCc1_YvTD9XdTNtFrK8H9FleaF-UNMCai_E7lqE,3949
35
- glitchlings/zoo/core.py,sha256=tkJFqGwpVa7qQxkUr9lsHOB8zS3lDCo987R6Nvz375U,21257
36
- glitchlings/zoo/hokey.py,sha256=h-yjCLqYAZFksIYw4fMniuTWUywFw9GU9yUFs_uECHo,5471
37
- glitchlings/zoo/jargoyle.py,sha256=kgKw_hsaJaKQjrxzt_CMlgtZApedM6I2-U3d3aeipXs,12014
38
- glitchlings/zoo/mim1c.py,sha256=GqUMErVAVcqMAZjx4hhJ0Af25CxA0Aorv3U_fTqLZek,3546
39
- glitchlings/zoo/ocr_confusions.tsv,sha256=S-IJEYCIXYKT1Uu7Id8Lnvg5pw528yNigTtWUdnMv9k,213
40
- glitchlings/zoo/redactyl.py,sha256=xSdt-Az3HI8XLC-uV8hK6JIoNa1nL-cTCFCoShFvKt0,5752
41
- glitchlings/zoo/reduple.py,sha256=YfdKZPr2TO2ZK7h8K5xlsnoubEZ3kQLRpDX65GzrKls,4372
42
- glitchlings/zoo/rushmore.py,sha256=JjLKTKQoXlvp0uvCzMRlJSXE_N2VFZPHMF_nkolKm3g,4439
43
- glitchlings/zoo/scannequin.py,sha256=-YG6tRTE72MGw4CpWAPo42gFaCTpyDvOJnk0gynitCg,5041
44
- glitchlings/zoo/typogre.py,sha256=X6jcnCYifNtoSwe2ig7YS3QrODyrACirMZ9pjN5LLBA,6917
45
- glitchlings/zoo/zeedub.py,sha256=KApSCSiTr3b412vsA8UHWFhYQDxe_jg0308wWK-GNtM,5025
46
- glitchlings/zoo/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
- glitchlings/zoo/assets/apostrofae_pairs.json,sha256=lPLFLndzn_f7_5wZizxsLMnwBY4O63zsCvDjyJ56MLA,553
48
- glitchlings-0.4.5.dist-info/licenses/LICENSE,sha256=EFEP1evBfHaxsMTBjxm0sZVRp2wct8QLvHE1saII5FI,11538
49
- glitchlings-0.4.5.dist-info/METADATA,sha256=sULt2kvkK1lfhdqBbSvawNoRNyevwLsFrITBPMBrE9M,34146
50
- glitchlings-0.4.5.dist-info/WHEEL,sha256=qV0EIPljj1XC_vuSatRWjn02nZIz3N1t8jsZz7HBr2U,101
51
- glitchlings-0.4.5.dist-info/entry_points.txt,sha256=kGOwuAsjFDLtztLisaXtOouq9wFVMOJg5FzaAkg-Hto,54
52
- glitchlings-0.4.5.dist-info/top_level.txt,sha256=VHFNBrLjtDwPCYXbGKi6o17Eueedi81eNbR3hBOoST0,12
53
- glitchlings-0.4.5.dist-info/RECORD,,
File without changes
File without changes