Skip to content

Commit 534fac6

Browse files
committed
v0.1.9
feat: add uwuification levels feat: separate exclamations based on original use refactor: simplify chance guards fix: skip URIs and URNs, not just http[s] URIs tests: add tests for uwuification levels, URIs/URNs, and the value guards Neofetch action removed by request of Pin.
1 parent 1d1a89c commit 534fac6

File tree

7 files changed

+207
-60
lines changed

7 files changed

+207
-60
lines changed

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ uwuipy/__pycache__
22
uwuipy.egg-info/
33
dist/
44
build/
5-
uwuipy.egg-info/
6-
.idea
5+
.idea
6+
poetry.lock
7+
.vscode
8+
__pycache__

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,42 @@ print(uwu.uwuify(input()))
2828
```
2929

3030
#### Constructor parameters
31-
The `uwuipy` constructor allows fine-tuning of the uwuification process through the following parameters:
31+
The `Uwuipy` constructor allows fine-tuning of the uwuification process through the following parameters:
3232

3333
- `seed`: An integer seed for the random number generator. Defaults to current time if - not provided.
3434
- `stutterchance`: Probability of stuttering a word (0 to 1.0), default 0.1.
3535
- `facechance`: Probability of adding a face (0 to 1.0), default 0.05.
3636
- `actionchance`: Probability of adding an action (0 to 1.0), default 0.075.
3737
- `exclamationchance`: Probability of adding exclamations (0 to 1.0), default 1.
38-
- `nsfw_actions`: Enables more explicit actions if set to true; default is false.
38+
- `nsfw_actions`: Enables more "explicit" actions if set to true; default is false.
39+
- `power`: The uwuification "level" — higher levels lead to more text transformations being done (1 is core uwu, 2 is nyaification, 3 and 4 are just extra). Using a higher level includes the lower levels.
3940

4041
#### Customized Example:
4142
Adjust the parameters to create a customized uwuification process:
4243
```python
43-
from uwuipy import uwuipy
44+
from uwuipy import Uwuipy
4445

45-
uwu = uwuipy(None, 0.3, 0.3, 0.3, 1, False)
46+
uwu = Uwuipy(None, 0.3, 0.3, 0.3, 1, False, 4)
4647
print(uwu.uwuify(input()))
4748
```
4849

4950
This can produce output like:
5051
```
51-
The quick brown fox jumps over the lazy dog
52-
The quick b-b-b-bwown (・\`ω\´・) ***screeches*** fox jumps uvw t-t-t-the OwO wazy dog
52+
The quick bwown (ᵘʷᵘ) ***glomps*** f-f-fox jyumps uvw the ***screeches*** w-w-w-wazy ***blushes*** dog
53+
The (ᵘﻌᵘ) quick bwown ***smirks smugly*** fox \>w\< ***screeches*** jyumps uvw t-t-t-the (uwu) wazy owo dog ~(˘▾˘~)
54+
The q-q-q-quick ***nuzzles your necky wecky*** b-b-bwown f-f-fox ( ᵘ ꒳ ᵘ ✼) j-j-jyumps (U ﹏ U) u-uvw ***whispers to self*** the owo w-w-w-wazy Uwu d-d-d-dog ***huggles tightly***
5355
```
5456

5557
#### Time-Based Seeding:
5658
Utilize time-based seeding for unique transformations:
5759
```python
5860
from datetime import datetime
59-
from uwuipy import uwuipy
61+
from uwuipy import Uwuipy
6062

6163
message = "Hello this is a message posted in 2017."
6264
seed = datetime(2017, 11, 28, 23, 55, 59, 342380).timestamp()
63-
uwu = uwuipy(seed)
64-
print(uwu.uwuify(message))
65+
uwu = Uwuipy(seed)
66+
print(uwu.uwuify(message)) # Hewwo ***blushes*** t-t-t-this is a ***cries*** message posted ***screeches*** in 2017.
6567
```
6668
This method only uses the `uwuify()` function, accepting a string and returning an uwuified string based on the constructor parameters.
6769

@@ -73,15 +75,15 @@ python3 -m uwuipy The quick brown fox jumps over the lazy dog
7375
```
7476
Output:
7577
```bash
76-
The quick b-b-b-bwown (・\`ω・) ***screeches*** fox jumps uvw t-t-t-the OwO wazy dog
78+
The q-q-quick bwown fox jyumps uvw the wazy dog
7779
```
7880

7981
#### REPL
8082
REPL Mode:
8183
```bash
8284
python3 -m uwuipy
8385
>>> The quick brown fox jumps over the lazy dog
84-
The quick b-b-b-bwown (・\`ω・) ***screeches*** fox jumps uvw t-t-t-the OwO wazy dog
86+
The quick bwown fox jyumps uvw the wazy dog
8587
```
8688

8789
#### Help

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "uwuipy"
3-
version = "0.1.8"
3+
version = "0.1.9"
44
description = "Allows the easy implementation of uwuifying words for applications like Discord bots and websites"
55
authors = ["Cuprum77", "diminDDL", "R2Boyo25", "ThatRedKite", "pin-lee", "BadlyWrittenStylesheet"]
66
license = "MIT"
@@ -13,6 +13,13 @@ python = "^3.10"
1313
[tool.poetry.urls]
1414
homepage = "https://github.com/Cuprum77/uwuipy"
1515

16+
[tool.poetry.group.dev.dependencies]
17+
pytest = "^8.2.2"
18+
19+
[tool.pytest.ini_options]
20+
addopts = [
21+
"--import-mode=importlib",
22+
]
1623

1724
[build-system]
1825
requires = ["poetry-core"]

tests/test_uwuification.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import pytest
2+
from uwuipy import Uwuipy
3+
4+
5+
def test_uwuification_level_1():
6+
# Random assortment of Monty Python quotes.
7+
assert (
8+
Uwuipy(1, 0, 0, 0, 0, power=1).uwuify(
9+
"We want a shrubbery!! …Are you suggesting that coconuts migrate? "
10+
"Shut up! Will you shut up?! Ah, now we see the violence inherent in the system!"
11+
)
12+
== "We want a shwubbewy!! …Awe you suggesting that coconuts migwate? "
13+
"Shut up! Wiww you shut up?! Ah, now we see the viowence inhewent in the system!"
14+
)
15+
16+
17+
def test_uwuification_level_2():
18+
# Monty Python reference combined with a Jojo reference (Kaz: I don't watch Jojo).
19+
assert (
20+
Uwuipy(1, 0, 0, 0, 0, power=2).uwuify("Jojo says no to the Knights of Ni!")
21+
== "Jyojyo says nyo to the Knyights of Nyi!"
22+
)
23+
24+
25+
def test_uwuification_level_3():
26+
assert (
27+
Uwuipy(1, 0, 0, 0, 0, power=3).uwuify("Avali love to smell the roses!")
28+
== "Awawi wuv to smeww the woses!"
29+
)
30+
31+
32+
def test_uwuification_level_4():
33+
assert (
34+
Uwuipy(1, 0, 0, 0, 0, power=4).uwuify(
35+
"Avali love to smell the roses! Oh! Don't put them on there! They'll melt! Don't give them an apple, either."
36+
)
37+
== "Awawi wuv to smeww the wowses! Owh! Down't put them own thewe! They'ww mewt! Down't giwe them awn appwe, eithew."
38+
)
39+
40+
41+
def test_stuttering():
42+
assert (
43+
Uwuipy(1, 1, 0, 0, 0).uwuify("Hello world! (this is in parenthesis)")
44+
== "H-Hewwo w-w-w-wowwd! (this i-i-is i-i-in p-pawenthesis)"
45+
)
46+
47+
48+
def test_url():
49+
assert (
50+
Uwuipy(1, 1, 0, 0, 0).uwuify("https://example.com mailto:[email protected]")
51+
== "https://example.com mailto:[email protected]"
52+
)
53+
54+
55+
def test_guards():
56+
with pytest.raises(ValueError):
57+
Uwuipy(stutter_chance=-1)
58+
59+
with pytest.raises(ValueError):
60+
Uwuipy(stutter_chance=2)
61+
62+
with pytest.raises(ValueError):
63+
Uwuipy(power=0)
64+
65+
with pytest.raises(ValueError):
66+
Uwuipy(power=5)

uwuipy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .uwuipy import uwuipy
1+
from .uwuipy import Uwuipy as Uwuipy, Uwuipy

uwuipy/__main__.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from uwuipy import uwuipy
1+
from uwuipy import Uwuipy
22
from os import getenv
33
import argparse
44

@@ -61,19 +61,28 @@ def main():
6161
"--nsfwactions",
6262
default=False,
6363
action="store_true",
64-
help="Enable NFSW actions. [default: False]"
64+
help="Enable NFSW actions. [default: False]",
65+
)
66+
67+
parser.add_argument(
68+
"-p",
69+
"--power",
70+
default=3,
71+
type=int,
72+
help="The uwuification strength. [default: 3 — max is 4]",
6573
)
6674

6775
parser.add_argument("message", nargs=argparse.REMAINDER, help="The text to uwuify")
6876
args = parser.parse_args()
6977

70-
uwu = uwuipy(
78+
uwu = Uwuipy(
7179
args.seed,
7280
args.stutterchance,
7381
args.facechance,
7482
args.actionchance,
7583
args.exclamationchance,
76-
args.nsfwactions
84+
args.nsfwactions,
85+
args.power,
7786
)
7887

7988
if len(args.message):

0 commit comments

Comments
 (0)