glitchlings 0.4.4__cp310-cp310-macosx_11_0_universal2.whl → 0.5.0__cp310-cp310-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 (42) hide show
  1. glitchlings/__init__.py +4 -0
  2. glitchlings/_zoo_rust.cpython-310-darwin.so +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=A6m-sj1Gnq5DXdaD7IRsPnMvXW9UjZh3fQGcvps22uw,1230
2
+ glitchlings/__main__.py,sha256=f-P4jiVBd7ZpS6QxRpa_6SJgOG03UhZhcWasMDRWLs8,120
3
+ glitchlings/_zoo_rust.cpython-310-darwin.so,sha256=jZ1lZsevyEARIxBF4l8aczwZr6Db89W9WK1xxM2Jypo,2714896
4
+ glitchlings/compat.py,sha256=lswR7J3kXER5hPXeyfkO-7USJvUhdtTi1ovJgEpspKc,8892
5
+ glitchlings/config.py,sha256=xqTc2YJGMYJHbnh1nxQBdCKhQ6sqcjWJViArjarsZa4,12303
6
+ glitchlings/config.toml,sha256=04-Y_JCdQU68SRmwk2qZqrH_bbX4jEH9uh7URtxdIHA,99
7
+ glitchlings/main.py,sha256=uw8VbDgxov1m-wYHPDl2dP5ItpLB4ZHpb0ChJXzcL0o,10623
8
+ glitchlings/dev/__init__.py,sha256=v-qk9iE6b7VEg-4bpKH2PAifG-rkrCRgrS0C4VPR7ow,142
9
+ glitchlings/dev/sync_assets.py,sha256=BDzfzRMhcvPC2N-bIjnsB8KUA5I7YrfSY-EnXQqh3WY,4677
10
+ glitchlings/dlc/__init__.py,sha256=qlY4nuagy4AAWuPMwmuhwK2m36ktp-qkeiIxC7OXg34,305
11
+ glitchlings/dlc/_shared.py,sha256=moQwnJdHMo-dx5uK0zM8XdPy5cs-OlAzYKVWfUP0RSQ,4407
12
+ glitchlings/dlc/huggingface.py,sha256=BWceVUm28Yd8b7Tf_lmnPGgSVN1hZEmseRjf17nAPJw,2576
13
+ glitchlings/dlc/prime.py,sha256=zhm0oTVKNDa1ByxZTP42rmMVaJDyx77w2g6NHy4jndc,8607
14
+ glitchlings/dlc/pytorch.py,sha256=Laqz5o0UZXE1X9P-Qxb6KE0D5lcBKAoBbKsn-fnd6c0,6233
15
+ glitchlings/dlc/pytorch_lightning.py,sha256=rhDwRgOGVzaEet27QG8GigKh6hK5ZdTBOxGE2G0MPxw,8005
16
+ glitchlings/lexicon/__init__.py,sha256=ooEPcAJhCI2Nw5z8OsQ0EtVpKBfiTrU0-AQJq8Zn2nQ,6007
17
+ glitchlings/lexicon/_cache.py,sha256=oWdQtiU3csUAs-fYJRHuS_314j8JJ-T8AL73-GxVXzA,4072
18
+ glitchlings/lexicon/metrics.py,sha256=VBFfFpxjiEwZtK-jS55H8xP7MTC_0OjY8lQ5zSQ9aTY,4572
19
+ glitchlings/lexicon/vector.py,sha256=hUtMewkdLdMscQWjFgWcspSg0C_C0JdhFSMAs0HA-i0,22600
20
+ glitchlings/lexicon/wordnet.py,sha256=8wEN3XHI8Cf01h4h9cP4F25FLlGIoUrvk5l2nsgkfx4,7576
21
+ glitchlings/lexicon/data/default_vector_cache.json,sha256=3iVH0nX8EqMbqOkKWvORCGYtN0LKHn5G_Snlizsnm1g,997
22
+ glitchlings/util/__init__.py,sha256=vc3EAY8ehRjbOiryFdaqvvljXcyNGtZSPiEp9ok1vVw,4674
23
+ glitchlings/util/adapters.py,sha256=psxQFYSFmh1u7NuqtIrKwQP5FOhOrZoxZzc7X7DDi9U,693
24
+ glitchlings/util/hokey_generator.py,sha256=NCbOGw55SG720VYnuwEdFAfdOvYlmjsZ0hAr5Y0Ja0Y,4483
25
+ glitchlings/util/stretch_locator.py,sha256=INTMz7PXe-0HoDaMnQIQxJ266nABMXBYD67oJM8ur8g,4194
26
+ glitchlings/util/stretchability.py,sha256=Rs-OHlfhRxGFlZeEQgEN66Z_CYTcWJrGypu7X5Yc9i4,12667
27
+ glitchlings/zoo/__init__.py,sha256=xCVVAHLJ4lxl1JQUzff9fr84pJbB04fyXBjuX1m3YSw,5339
28
+ glitchlings/zoo/_ocr_confusions.py,sha256=0Y2GvfXCUIrXggL-tsFMQqzEFYVp6p5r7F-4dGrXiT4,1139
29
+ glitchlings/zoo/_rust_extensions.py,sha256=Bsd0kiPB1rUn5x3k7ykydFuk2YSvXS9CQGPRlE5XzXY,4211
30
+ glitchlings/zoo/_sampling.py,sha256=KrWyUSsYXghlvktS5hQBO0bPqywEEyA49A2qDWInB7Q,1586
31
+ glitchlings/zoo/_text_utils.py,sha256=NG9Iru9k3oSCxwYFAbvY4iG5NzHRYOIEtUXtvhKe4wA,2771
32
+ glitchlings/zoo/adjax.py,sha256=D3gadataEL7QzxrTOElwNdXHKrJmb2EB9qwNLbTVUK0,3136
33
+ glitchlings/zoo/apostrofae.py,sha256=zfQrq_ds0N6CTdqz3zsDO4KfiVLb5gx-0S4_VU19vMM,3674
34
+ glitchlings/zoo/core.py,sha256=dRzUTmhOswDV0hWcaD-Sx7rZdPlrszn7C_1G2xd4ECk,20675
35
+ glitchlings/zoo/hokey.py,sha256=71z1JGzKGb_N8Wo7LVuS7qAqH2T0Y0h2LemIw66eprs,5298
36
+ glitchlings/zoo/jargoyle.py,sha256=dkJpcDwBqyNJpsJDk3k1hAkLpLXKu0fH0ZJyhhllHWI,11260
37
+ glitchlings/zoo/mim1c.py,sha256=BQ0kR-ob5TK5BrysipTUx1Yox6G5wlYi-EBH2V93xmI,3011
38
+ glitchlings/zoo/redactyl.py,sha256=lmFb3dobXpsQfwmgT-9yhoKIvrJyilu_yhj4mef0cm0,5144
39
+ glitchlings/zoo/reduple.py,sha256=uawpaq5cDBdGGbw0CwdITYp56nI6fazCTr9QIrJb0ag,3777
40
+ glitchlings/zoo/rushmore.py,sha256=jsffZAfhpDTIUtG-jjBzM7bZUCnz2truR0fNNkpVR3M,3759
41
+ glitchlings/zoo/scannequin.py,sha256=oaBiqU57dLruCPHo-W2ojno3lolefSAcvTjXpFwLarM,4406
42
+ glitchlings/zoo/typogre.py,sha256=NqA9b3HmFl8hR6bVLe85Tjv6uEYoDoSkb0i9gnd8t2Y,6188
43
+ glitchlings/zoo/zeedub.py,sha256=Smegw7zUBAiMapKwZUqP0MqBKSCN5RNXvpbpU_ypnfI,4618
44
+ glitchlings/zoo/assets/__init__.py,sha256=kETGGz0_V1OLpqB4rEfD5SU3XX0Ea9nSZ9isNL6SXWU,1637
45
+ glitchlings/zoo/assets/apostrofae_pairs.json,sha256=bfjSEaMTI_axGNJ93nI431KXU0IVp7ayO42gGcMgL6U,521
46
+ glitchlings/zoo/assets/hokey_assets.json,sha256=9drpOv_PHHxs7jZOcgMr9G-Nswx_UuMzC4yQ0O8mIZ0,2890
47
+ glitchlings/zoo/assets/ocr_confusions.tsv,sha256=KhtR7vJDTITpfTSGa-I7RHr6CK7LkGi2KjdhEWipI6o,183
48
+ glitchlings-0.5.0.dist-info/licenses/LICENSE,sha256=YCvGip-LoaRyu6h0nPo71q6eHEkzUpsE11psDJOIRkw,11337
49
+ glitchlings-0.5.0.dist-info/METADATA,sha256=mWzN0o6h8e0hFfT6ZhiDy9U1yaJNCCXWXNYLO3i6vLk,33363
50
+ glitchlings-0.5.0.dist-info/WHEEL,sha256=G4cu_uTI97hAXSudQC0D9fpgNQkuavCNljtwFXiUqZM,114
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=bkyRgzjC8ssidEO9UL9VpbYXQxTV1Hz3VAPOIqd9uMg,1182
2
- glitchlings/__main__.py,sha256=f-P4jiVBd7ZpS6QxRpa_6SJgOG03UhZhcWasMDRWLs8,120
3
- glitchlings/_zoo_rust.cpython-310-darwin.so,sha256=lrs-tFQ0IlzrfGlRT5_yIyVDh-i2USmpmkArk6dA9M4,2604048
4
- glitchlings/compat.py,sha256=T_5Ia8yCzZvsMdicZ2TCcOgDO53_AjNGkSXWTR_qEnA,8908
5
- glitchlings/config.py,sha256=ofxDMkoMg4j51CFube54aca1Ky9y_ZeVktXpeUEdWmA,12953
6
- glitchlings/config.toml,sha256=04-Y_JCdQU68SRmwk2qZqrH_bbX4jEH9uh7URtxdIHA,99
7
- glitchlings/main.py,sha256=uw8VbDgxov1m-wYHPDl2dP5ItpLB4ZHpb0ChJXzcL0o,10623
8
- glitchlings/dlc/__init__.py,sha256=qlY4nuagy4AAWuPMwmuhwK2m36ktp-qkeiIxC7OXg34,305
9
- glitchlings/dlc/_shared.py,sha256=OmEjJmSs1pQ7j1ggR_H8D8RDp5E1ZqOnzSIxyqRE1aE,4407
10
- glitchlings/dlc/huggingface.py,sha256=9lW7TnTHA_bXyo4Is8pymZchrB9BIL1bMCP2p7LCMtg,2576
11
- glitchlings/dlc/prime.py,sha256=qGFI1d4BiOEIgQZ5v9QnlbYx4J4q-vNlh5tWZng11xs,8607
12
- glitchlings/dlc/pytorch.py,sha256=QaiIYyQ3koy2-enhUI9WY3SIMRX65gmsnjDvCsf8xbg,6233
13
- glitchlings/dlc/pytorch_lightning.py,sha256=Ls7Xh5Mg643Tyk3KvCMq_MsB4vvekfUUZOhE0z4K22c,8074
14
- glitchlings/lexicon/__init__.py,sha256=ooEPcAJhCI2Nw5z8OsQ0EtVpKBfiTrU0-AQJq8Zn2nQ,6007
15
- glitchlings/lexicon/_cache.py,sha256=aWSUb5Ex162dr3HouO2Ic2O8ck3ViEFWs8-XMLKMeJ0,4086
16
- glitchlings/lexicon/metrics.py,sha256=VBFfFpxjiEwZtK-jS55H8xP7MTC_0OjY8lQ5zSQ9aTY,4572
17
- glitchlings/lexicon/vector.py,sha256=yWf-vlN2OEHnTCPu7tgDnJbhm47cmhdrTtjR0RZKkUM,22530
18
- glitchlings/lexicon/wordnet.py,sha256=YcOliPHuesdlekmGspwAyR4fWDDxZWR_dIt_Nsq7ag0,7608
19
- glitchlings/lexicon/data/default_vector_cache.json,sha256=3iVH0nX8EqMbqOkKWvORCGYtN0LKHn5G_Snlizsnm1g,997
20
- glitchlings/util/__init__.py,sha256=vc3EAY8ehRjbOiryFdaqvvljXcyNGtZSPiEp9ok1vVw,4674
21
- glitchlings/util/adapters.py,sha256=psxQFYSFmh1u7NuqtIrKwQP5FOhOrZoxZzc7X7DDi9U,693
22
- glitchlings/zoo/__init__.py,sha256=1dWZPCTXuh5J7WdCxHX7ZX9bNd8bakzYndxQRhF43i8,5243
23
- glitchlings/zoo/_ocr_confusions.py,sha256=Ju2_avXiwsr1p8zWFUTOzMxJ8vT5PpYobuGIn4L_sqI,1204
24
- glitchlings/zoo/_rate.py,sha256=tkIlXHewE8s9w1jpCw8ZzkVN31690FAnvTM_R3dCIpY,3579
25
- glitchlings/zoo/_rust_extensions.py,sha256=Bsd0kiPB1rUn5x3k7ykydFuk2YSvXS9CQGPRlE5XzXY,4211
26
- glitchlings/zoo/_sampling.py,sha256=KrWyUSsYXghlvktS5hQBO0bPqywEEyA49A2qDWInB7Q,1586
27
- glitchlings/zoo/_text_utils.py,sha256=fS5L_eq-foBbBdiv4ymI8-O0D0csc3yDekHpX8bqfV4,2754
28
- glitchlings/zoo/adjax.py,sha256=XT5kKqPOUPgKSDOcR__HBnv4OXtBKee40GuNNmm1GYI,3518
29
- glitchlings/zoo/apostrofae.py,sha256=qjpfnxdPWXMNzZnSD7UMfvHyzGKa7TLsvUhMsIvjwj8,3822
30
- glitchlings/zoo/core.py,sha256=dRzUTmhOswDV0hWcaD-Sx7rZdPlrszn7C_1G2xd4ECk,20675
31
- glitchlings/zoo/jargoyle.py,sha256=2TGU_z8gILwQ-lyZEqvmsrLupxqb8ydlDiwcp-O6WwY,11679
32
- glitchlings/zoo/mim1c.py,sha256=-fgodKWZq--Xw8L2t1EqNbsh48bwX5jZxmiXdoaQShI,3437
33
- glitchlings/zoo/ocr_confusions.tsv,sha256=KhtR7vJDTITpfTSGa-I7RHr6CK7LkGi2KjdhEWipI6o,183
34
- glitchlings/zoo/redactyl.py,sha256=eWn7JC81BXkp2bSinwrBfU3jXukcUGDVkaa6BcGvte4,5559
35
- glitchlings/zoo/reduple.py,sha256=zSc1N_-tz9Kl7CDMrdZKgCuW3Bxp_-g6axadAa6AszM,4224
36
- glitchlings/zoo/rushmore.py,sha256=k429trwNPcWJHEOIoeGsdKBzJNL4Fxz9KRqX3Ro9u_0,4286
37
- glitchlings/zoo/scannequin.py,sha256=GfjLYWWp-jdnOBmdg7gt5wQnobY8jWQHScB5EMgo6HE,4870
38
- glitchlings/zoo/typogre.py,sha256=BQotNL-gn4PXQI9j63d2w9mQ4X6ZJKSJ4de-GN-gmUI,6686
39
- glitchlings/zoo/zeedub.py,sha256=aNnjZGeTmMqA2WjgtGh7Fgl9pUQo3AZ2B-tYs2ZFOQE,4840
40
- glitchlings/zoo/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- glitchlings/zoo/assets/apostrofae_pairs.json,sha256=bfjSEaMTI_axGNJ93nI431KXU0IVp7ayO42gGcMgL6U,521
42
- glitchlings-0.4.4.dist-info/licenses/LICENSE,sha256=YCvGip-LoaRyu6h0nPo71q6eHEkzUpsE11psDJOIRkw,11337
43
- glitchlings-0.4.4.dist-info/METADATA,sha256=onpPJTtANv13MyyvYS930OWiJb_Ipxvje5sTrNmNPQw,32388
44
- glitchlings-0.4.4.dist-info/WHEEL,sha256=G4cu_uTI97hAXSudQC0D9fpgNQkuavCNljtwFXiUqZM,114
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,,