glitchlings 0.4.4__cp310-cp310-win_amd64.whl → 0.5.0__cp310-cp310-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 (42) hide show
  1. glitchlings/__init__.py +4 -0
  2. glitchlings/_zoo_rust.cp310-win_amd64.pyd +0 -0
  3. glitchlings/compat.py +2 -4
  4. glitchlings/config.py +14 -28
  5. glitchlings/dev/__init__.py +5 -0
  6. glitchlings/dev/sync_assets.py +153 -0
  7. glitchlings/dlc/_shared.py +6 -6
  8. glitchlings/dlc/huggingface.py +6 -6
  9. glitchlings/dlc/prime.py +1 -1
  10. glitchlings/dlc/pytorch.py +3 -3
  11. glitchlings/dlc/pytorch_lightning.py +4 -10
  12. glitchlings/lexicon/_cache.py +3 -5
  13. glitchlings/lexicon/vector.py +6 -5
  14. glitchlings/lexicon/wordnet.py +4 -8
  15. glitchlings/util/hokey_generator.py +144 -0
  16. glitchlings/util/stretch_locator.py +140 -0
  17. glitchlings/util/stretchability.py +370 -0
  18. glitchlings/zoo/__init__.py +5 -1
  19. glitchlings/zoo/_ocr_confusions.py +3 -3
  20. glitchlings/zoo/_text_utils.py +10 -9
  21. glitchlings/zoo/adjax.py +3 -18
  22. glitchlings/zoo/apostrofae.py +2 -5
  23. glitchlings/zoo/assets/__init__.py +54 -0
  24. glitchlings/zoo/assets/hokey_assets.json +193 -0
  25. glitchlings/zoo/hokey.py +173 -0
  26. glitchlings/zoo/jargoyle.py +2 -16
  27. glitchlings/zoo/mim1c.py +2 -17
  28. glitchlings/zoo/redactyl.py +3 -17
  29. glitchlings/zoo/reduple.py +3 -17
  30. glitchlings/zoo/rushmore.py +3 -20
  31. glitchlings/zoo/scannequin.py +3 -20
  32. glitchlings/zoo/typogre.py +2 -19
  33. glitchlings/zoo/zeedub.py +2 -13
  34. {glitchlings-0.4.4.dist-info → glitchlings-0.5.0.dist-info}/METADATA +29 -6
  35. glitchlings-0.5.0.dist-info/RECORD +53 -0
  36. glitchlings/zoo/_rate.py +0 -131
  37. glitchlings-0.4.4.dist-info/RECORD +0 -47
  38. /glitchlings/zoo/{ocr_confusions.tsv → assets/ocr_confusions.tsv} +0 -0
  39. {glitchlings-0.4.4.dist-info → glitchlings-0.5.0.dist-info}/WHEEL +0 -0
  40. {glitchlings-0.4.4.dist-info → glitchlings-0.5.0.dist-info}/entry_points.txt +0 -0
  41. {glitchlings-0.4.4.dist-info → glitchlings-0.5.0.dist-info}/licenses/LICENSE +0 -0
  42. {glitchlings-0.4.4.dist-info → glitchlings-0.5.0.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,6 @@ import re
3
3
  from typing import Any, cast
4
4
 
5
5
  from ._ocr_confusions import load_confusion_table
6
- from ._rate import resolve_rate
7
6
  from ._rust_extensions import get_rust_operation
8
7
  from .core import AttackOrder, AttackWave, Glitchling
9
8
 
@@ -102,8 +101,6 @@ def ocr_artifacts(
102
101
  rate: float | None = None,
103
102
  seed: int | None = None,
104
103
  rng: random.Random | None = None,
105
- *,
106
- error_rate: float | None = None,
107
104
  ) -> str:
108
105
  """Introduce OCR-like artifacts into text.
109
106
 
@@ -112,12 +109,7 @@ def ocr_artifacts(
112
109
  if not text:
113
110
  return text
114
111
 
115
- effective_rate = resolve_rate(
116
- rate=rate,
117
- legacy_value=error_rate,
118
- default=0.02,
119
- legacy_name="error_rate",
120
- )
112
+ effective_rate = 0.02 if rate is None else rate
121
113
 
122
114
  if rng is None:
123
115
  rng = random.Random(seed)
@@ -137,16 +129,9 @@ class Scannequin(Glitchling):
137
129
  self,
138
130
  *,
139
131
  rate: float | None = None,
140
- error_rate: float | None = None,
141
132
  seed: int | None = None,
142
133
  ) -> None:
143
- self._param_aliases = {"error_rate": "rate"}
144
- effective_rate = resolve_rate(
145
- rate=rate,
146
- legacy_value=error_rate,
147
- default=0.02,
148
- legacy_name="error_rate",
149
- )
134
+ effective_rate = 0.02 if rate is None else rate
150
135
  super().__init__(
151
136
  name="Scannequin",
152
137
  corruption_function=ocr_artifacts,
@@ -158,11 +143,9 @@ class Scannequin(Glitchling):
158
143
 
159
144
  def pipeline_operation(self) -> dict[str, Any] | None:
160
145
  rate = self.kwargs.get("rate")
161
- if rate is None:
162
- rate = self.kwargs.get("error_rate")
163
146
  if rate is None:
164
147
  return None
165
- return {"type": "ocr", "error_rate": float(rate)}
148
+ return {"type": "ocr", "rate": float(rate)}
166
149
 
167
150
 
168
151
  scannequin = Scannequin()
@@ -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.4
3
+ Version: 0.5.0
4
4
  Summary: Monsters for your language games.
5
5
  Author: osoleve
6
6
  License: Apache License
@@ -294,6 +294,15 @@ 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)
298
+ [![PyPI version](https://img.shields.io/pypi/v/glitchlings.svg)](https://pypi.org/project/glitchlings/)
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)
305
+
297
306
  `Glitchlings` are **utilities for corrupting the text inputs to your language models in deterministic, _linguistically principled_** ways.
298
307
  Each embodies a different way that documents can be compromised in the wild.
299
308
 
@@ -382,6 +391,7 @@ glitchlings --list
382
391
  ```text
383
392
  Typogre — scope: Character, order: early
384
393
  Apostrofae — scope: Character, order: normal
394
+ Hokey — scope: Character, order: first
385
395
  Mim1c — scope: Character, order: last
386
396
  Jargoyle — scope: Word, order: normal
387
397
  Adjax — scope: Word, order: normal
@@ -429,10 +439,6 @@ options:
429
439
  ```
430
440
  <!-- END: CLI_USAGE -->
431
441
 
432
- 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.
433
-
434
- Prefer inline tweaks? You can still configure glitchlings directly in the shell:
435
-
436
442
  ```bash
437
443
  # Run Typogre against the contents of a file and inspect the diff.
438
444
  glitchlings -g typogre --file documents/report.txt --diff
@@ -507,6 +513,22 @@ _Wait, was that...?_
507
513
  > - `banned_characters (Collection[str])`: Characters that must never appear as replacements (default: none).
508
514
  > - `seed (int)`: The random seed for reproducibility (default: 151).
509
515
 
516
+ ### Hokey
517
+
518
+ _She's soooooo coooool!_
519
+
520
+ > _**Passionista.**_ Hokey sometimes gets a little excited and elongates words for emphasis.
521
+ >
522
+ > Args
523
+ >
524
+ > - `rate (float)`: Share of high-scoring tokens to stretch (default: 0.3).
525
+ > - `extension_min` / `extension_max (int)`: Bounds for extra repetitions (defaults: 2 / 5).
526
+ > - `word_length_threshold (int)`: Preferred maximum alphabetic length; longer words are damped instead of excluded (default: 6).
527
+ > - `base_p (float)`: Base probability for the heavy-tailed sampler (default: 0.45).
528
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
529
+
530
+ _Apocryphal Glitchling contributed by Chloé Nunes_
531
+
510
532
  ### Scannequin
511
533
 
512
534
  _How can a computer need reading glasses?_
@@ -539,7 +561,9 @@ _Uh oh. The worst person you know just bought a thesaurus._
539
561
  > Args
540
562
  >
541
563
  > - `rate (float)`: The maximum proportion of words to replace (default: 0.01, 1%).
564
+ >
542
565
  - `part_of_speech`: The WordNet-style part(s) of speech to target (default: nouns). Accepts `wn.NOUN`, `wn.VERB`, `wn.ADJ`, `wn.ADV`, any iterable of those tags, or the string `"any"` to include them all. Vector/graph backends ignore this filter while still honouring deterministic sampling.
566
+ >
543
567
  > - `seed (int)`: The random seed for reproducibility (default: 151).
544
568
 
545
569
  ### Reduple
@@ -575,7 +599,6 @@ _Keep your hands and punctuation where I can see them._
575
599
  > Args
576
600
  >
577
601
  > - `rate (float)`: Probability that each adjacent pair swaps cores (default: 0.5, 50%).
578
- > - `swap_rate (float)`: Alias for `rate`, retained for backward compatibility.
579
602
  > - `seed (int)`: The random seed for reproducibility (default: 151).
580
603
 
581
604
  ### Redactyl
@@ -0,0 +1,53 @@
1
+ glitchlings/__init__.py,sha256=pNL6Vx6ggpRq-vW0CXJjnWOe_LktP6Zz9xNhqDHj3Dw,1301
2
+ glitchlings/__main__.py,sha256=nB7btO_T4wBFOcyawfWpjEindVrUfTqqV5hdeeS1HT8,128
3
+ glitchlings/_zoo_rust.cp310-win_amd64.pyd,sha256=g9Szqm3jKPb_eTY5Oa6KHbq3unxA3mxHkI9kbaX6PD0,2350080
4
+ glitchlings/compat.py,sha256=j4lkWNtyox5sen5j7u0SHfnk8QUn-yicaqvuLlZp1-s,9174
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/dev/__init__.py,sha256=Pr2tXDwfa6SHW1wPseLHRXPINi7lEs6QNClreU0rAiw,147
9
+ glitchlings/dev/sync_assets.py,sha256=QgUNrNpNloxqVGTCX0kVYwQMkJ58zGiZd37svteeS5M,4830
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=WWGMN9MTbHhgQIBB_p_cz-JKb51rCHZqyDRjPGkUOjY,13037
27
+ glitchlings/zoo/__init__.py,sha256=Ab69SD_RUXfiWUEzqU3wteGWobpm2kkbmwndYLEbv_0,5511
28
+ glitchlings/zoo/_ocr_confusions.py,sha256=Kyo3W6w-FGs4C7jXp4bLFHFCaa0RUJWvUrWKqfBOdBk,1171
29
+ glitchlings/zoo/_rust_extensions.py,sha256=SdU06m-qjf-rRHnqM5OMophx1IacoI4KbyRu2HXrTUc,4354
30
+ glitchlings/zoo/_sampling.py,sha256=AAPLObjqKrmX882TX8hdvPHReBOcv0Z4pUuW6AxuGgU,1640
31
+ glitchlings/zoo/_text_utils.py,sha256=DRjPuC-nFoxFeA7KIbpuIB5k8DXbvvvcHNJniL_8KoQ,2872
32
+ glitchlings/zoo/adjax.py,sha256=Oz3WGSsa4qpH7HLgBQC0r4JktJYGl3A0vkVknqeSG5I,3249
33
+ glitchlings/zoo/apostrofae.py,sha256=C9x9_jj9CidYEWL9OEoNJU_Jzr3Vk4UQ8tITThVbwvY,3798
34
+ glitchlings/zoo/core.py,sha256=tkJFqGwpVa7qQxkUr9lsHOB8zS3lDCo987R6Nvz375U,21257
35
+ glitchlings/zoo/hokey.py,sha256=h-yjCLqYAZFksIYw4fMniuTWUywFw9GU9yUFs_uECHo,5471
36
+ glitchlings/zoo/jargoyle.py,sha256=2FwL4A_DpI2Lz6pnZo5iSJZzgd8wDNM9bMeOsMVFSmw,11581
37
+ glitchlings/zoo/mim1c.py,sha256=86lCawTFWRWsO_vH6GMRJfM09TMTUy5MNhO9gsBEkk0,3105
38
+ glitchlings/zoo/redactyl.py,sha256=2BYQfcKwp1WFPwXomQCmh-z0UPN9sNx6Px84WilFs3k,5323
39
+ glitchlings/zoo/reduple.py,sha256=YukTZvLMBoarx96T4LHLGHr_KJVmFkAb0OBsO13ws8A,3911
40
+ glitchlings/zoo/rushmore.py,sha256=CiVkLlskOmfKtzFanmYe6wxKJkCSMbLeKTWDrwZZaXw,3895
41
+ glitchlings/zoo/scannequin.py,sha256=s2wno1_7aGebXvG3o9WvDQ5RRwp5Upl2dejbDUGIXkY,4560
42
+ glitchlings/zoo/typogre.py,sha256=B1-kMfOygKtiKXDBQOHJxvheielBWGbbdWk-cgoONgs,6402
43
+ glitchlings/zoo/zeedub.py,sha256=4x9bNQEq4VSsfol77mYx8jyBRyTugjRQPyk-ANy6gpY,4792
44
+ glitchlings/zoo/assets/__init__.py,sha256=6dOYQnMw-Hk9Tb3lChgZ4aoRr9qacZtbXR8ROnDfBq8,1691
45
+ glitchlings/zoo/assets/apostrofae_pairs.json,sha256=lPLFLndzn_f7_5wZizxsLMnwBY4O63zsCvDjyJ56MLA,553
46
+ glitchlings/zoo/assets/hokey_assets.json,sha256=1GaSEzXwtT1nvf0B9mFyLzHOcqzKbPreibsC6iBWAHA,3083
47
+ glitchlings/zoo/assets/ocr_confusions.tsv,sha256=S-IJEYCIXYKT1Uu7Id8Lnvg5pw528yNigTtWUdnMv9k,213
48
+ glitchlings-0.5.0.dist-info/licenses/LICENSE,sha256=EFEP1evBfHaxsMTBjxm0sZVRp2wct8QLvHE1saII5FI,11538
49
+ glitchlings-0.5.0.dist-info/METADATA,sha256=Nu4n4Oy-LoMko5-2ncvshT_OKMWxr-k9YOm5uMLIHBk,34013
50
+ glitchlings-0.5.0.dist-info/WHEEL,sha256=KUuBC6lxAbHCKilKua8R9W_TM71_-9Sg5uEP3uDWcoU,101
51
+ glitchlings-0.5.0.dist-info/entry_points.txt,sha256=kGOwuAsjFDLtztLisaXtOouq9wFVMOJg5FzaAkg-Hto,54
52
+ glitchlings-0.5.0.dist-info/top_level.txt,sha256=VHFNBrLjtDwPCYXbGKi6o17Eueedi81eNbR3hBOoST0,12
53
+ glitchlings-0.5.0.dist-info/RECORD,,
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,47 +0,0 @@
1
- glitchlings/__init__.py,sha256=jyfvslkaFlYVefDFq0CQKkc52F8p8I1UrbFbcyihFCU,1249
2
- glitchlings/__main__.py,sha256=nB7btO_T4wBFOcyawfWpjEindVrUfTqqV5hdeeS1HT8,128
3
- glitchlings/_zoo_rust.cp310-win_amd64.pyd,sha256=o5tlRkqbmzbnWqe6r0k5Ltk5lfo-WZExCJTz_s1IjnE,2215936
4
- glitchlings/compat.py,sha256=xM5fT5RELgIdQTmgKQFZaPZJJpOg0noC-gLDcO390Ro,9192
5
- glitchlings/config.py,sha256=pKpM5onr9UG8sHKVIZKj2Ti2gD5bZ6N1wyxOhzgrviQ,13341
6
- glitchlings/config.toml,sha256=OywXmEpuOPtyJRbcRt4cwQkHiZ__5axEHoCaX9ye-uA,102
7
- glitchlings/main.py,sha256=eCUEFsu8-NLDz1xyKNDIucVm975HNQZJYm6YCv8RIyg,10987
8
- glitchlings/dlc/__init__.py,sha256=iFDTwkaWl2C0_QUYykIXfmOUzy__oURX_BiJhexf-8o,312
9
- glitchlings/dlc/_shared.py,sha256=L6dc4Xi0q2K4ZwkyytXIU8Zu3MPugIDXhseZNuJNqyY,4560
10
- glitchlings/dlc/huggingface.py,sha256=Ym8dTArb-43AnCyukOO1m66iAbs8al9YkIWB3rGdhTk,2657
11
- glitchlings/dlc/prime.py,sha256=KY3so8WOwksbsKhZXfWorsZSYvIdPiUtc8e9apHabkM,8861
12
- glitchlings/dlc/pytorch.py,sha256=FZZbWHVX94FA9Ab77twZPUwQNno4IKTAjuHPXNhdY6M,6399
13
- glitchlings/dlc/pytorch_lightning.py,sha256=cKLFn3cFcOhFSN3QFlcvRPP5sLQts0M6DQ1J1cQuqRM,8289
14
- glitchlings/lexicon/__init__.py,sha256=oSLI1bOMfTpqiI7bMp9beeQ7Vp81G5coXxwdmCIQfV0,6199
15
- glitchlings/lexicon/_cache.py,sha256=KWqJ__WrM2ccIlplaaqoVT0ns65uU5WHewlJd4BvnJE,4196
16
- glitchlings/lexicon/metrics.py,sha256=TZAafSKgHpUS4h6vCuhTKGsvu_fru9kMqsXqLID6BTM,4734
17
- glitchlings/lexicon/vector.py,sha256=x9iT1O8Osolwt08g41V_70WHZt_b4OGzHBU72YHkmwg,23181
18
- glitchlings/lexicon/wordnet.py,sha256=fJi5SNa-sLpQiTIoXorkYzc2ZArejIms6zhoe8TPIOg,7840
19
- glitchlings/lexicon/data/default_vector_cache.json,sha256=bnMV4tHIVOQtK7FDH81yqSLRkeViEzclGKXrrS8fEJ8,1079
20
- glitchlings/util/__init__.py,sha256=Q5lkncOaM6f2eJK3HAtZyxpCjGnekCpwPloqasS3JDo,4869
21
- glitchlings/util/adapters.py,sha256=mFhPlE8JaFuO_C-3_aqhgwkqa6isV8Y2ifqVh3Iv9JM,720
22
- glitchlings/zoo/__init__.py,sha256=j21naQtFunJYgdgYsyTNYUSa7sl88yNQWaGP8sWyw5U,5411
23
- glitchlings/zoo/_ocr_confusions.py,sha256=pPlvJOoan3ouwwGt8hATcO-9luIrGJl0vwUqssUMXD8,1236
24
- glitchlings/zoo/_rate.py,sha256=KxFDFJEGWsv76v1JcoHXIETj9kGdbbAiUqCPwAcWcDw,3710
25
- glitchlings/zoo/_rust_extensions.py,sha256=SdU06m-qjf-rRHnqM5OMophx1IacoI4KbyRu2HXrTUc,4354
26
- glitchlings/zoo/_sampling.py,sha256=AAPLObjqKrmX882TX8hdvPHReBOcv0Z4pUuW6AxuGgU,1640
27
- glitchlings/zoo/_text_utils.py,sha256=LqCa33E-Qxbk6N5AVfxEmAz6C2u7_mCF0xPT9-404A8,2854
28
- glitchlings/zoo/adjax.py,sha256=8AqTfcJe50vPVxER5wREuyr4qqsmyKqi-klDW77HVYM,3646
29
- glitchlings/zoo/apostrofae.py,sha256=WB1zvCc1_YvTD9XdTNtFrK8H9FleaF-UNMCai_E7lqE,3949
30
- glitchlings/zoo/core.py,sha256=tkJFqGwpVa7qQxkUr9lsHOB8zS3lDCo987R6Nvz375U,21257
31
- glitchlings/zoo/jargoyle.py,sha256=kgKw_hsaJaKQjrxzt_CMlgtZApedM6I2-U3d3aeipXs,12014
32
- glitchlings/zoo/mim1c.py,sha256=GqUMErVAVcqMAZjx4hhJ0Af25CxA0Aorv3U_fTqLZek,3546
33
- glitchlings/zoo/ocr_confusions.tsv,sha256=S-IJEYCIXYKT1Uu7Id8Lnvg5pw528yNigTtWUdnMv9k,213
34
- glitchlings/zoo/redactyl.py,sha256=xSdt-Az3HI8XLC-uV8hK6JIoNa1nL-cTCFCoShFvKt0,5752
35
- glitchlings/zoo/reduple.py,sha256=YfdKZPr2TO2ZK7h8K5xlsnoubEZ3kQLRpDX65GzrKls,4372
36
- glitchlings/zoo/rushmore.py,sha256=JjLKTKQoXlvp0uvCzMRlJSXE_N2VFZPHMF_nkolKm3g,4439
37
- glitchlings/zoo/scannequin.py,sha256=-YG6tRTE72MGw4CpWAPo42gFaCTpyDvOJnk0gynitCg,5041
38
- glitchlings/zoo/typogre.py,sha256=X6jcnCYifNtoSwe2ig7YS3QrODyrACirMZ9pjN5LLBA,6917
39
- glitchlings/zoo/zeedub.py,sha256=KApSCSiTr3b412vsA8UHWFhYQDxe_jg0308wWK-GNtM,5025
40
- glitchlings/zoo/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- glitchlings/zoo/assets/apostrofae_pairs.json,sha256=lPLFLndzn_f7_5wZizxsLMnwBY4O63zsCvDjyJ56MLA,553
42
- glitchlings-0.4.4.dist-info/licenses/LICENSE,sha256=EFEP1evBfHaxsMTBjxm0sZVRp2wct8QLvHE1saII5FI,11538
43
- glitchlings-0.4.4.dist-info/METADATA,sha256=G5yU2jAph6LYY0Hvr5WTa3tnSdmDI890nTiecmP7P68,33015
44
- glitchlings-0.4.4.dist-info/WHEEL,sha256=KUuBC6lxAbHCKilKua8R9W_TM71_-9Sg5uEP3uDWcoU,101
45
- glitchlings-0.4.4.dist-info/entry_points.txt,sha256=kGOwuAsjFDLtztLisaXtOouq9wFVMOJg5FzaAkg-Hto,54
46
- glitchlings-0.4.4.dist-info/top_level.txt,sha256=VHFNBrLjtDwPCYXbGKi6o17Eueedi81eNbR3hBOoST0,12
47
- glitchlings-0.4.4.dist-info/RECORD,,