prank 0.1.0__py3-none-any.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.
- prank/__init__.py +142 -0
- prank-0.1.0.dist-info/METADATA +167 -0
- prank-0.1.0.dist-info/RECORD +6 -0
- prank-0.1.0.dist-info/WHEEL +5 -0
- prank-0.1.0.dist-info/licenses/LICENSE +21 -0
- prank-0.1.0.dist-info/top_level.txt +1 -0
prank/__init__.py
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"""Turns every uncaught exception into emotional damage."""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
import random
|
|
5
|
+
|
|
6
|
+
__version__ = "0.1.0"
|
|
7
|
+
__all__ = ["install", "uninstall", "is_installed"]
|
|
8
|
+
|
|
9
|
+
random_messages = [
|
|
10
|
+
"Stack Overflow is waiting for you.",
|
|
11
|
+
"git blame won't save you this time.",
|
|
12
|
+
"Expected behavior.",
|
|
13
|
+
"Feature, not a bug.",
|
|
14
|
+
"I'm disappointed in you.",
|
|
15
|
+
"Fucking bug.",
|
|
16
|
+
"It worked yesterday.",
|
|
17
|
+
"Congratulations, you found another bug.",
|
|
18
|
+
"Skill issue.",
|
|
19
|
+
"Have you tried turning it off and on again?",
|
|
20
|
+
"Who wrote this code?",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
rare_messages = [
|
|
24
|
+
"This message has a 1% drop rate.",
|
|
25
|
+
"The debugger is judging you.",
|
|
26
|
+
"Congratulations, you found the developer's secret.",
|
|
27
|
+
"Error successfully generated.",
|
|
28
|
+
"Please don't report this.",
|
|
29
|
+
"The universe has decided against your code today.",
|
|
30
|
+
"Trust me, it's not DNS... probably.",
|
|
31
|
+
"This exception is sponsored by coffee.",
|
|
32
|
+
"404: Motivation not found.",
|
|
33
|
+
"Your bug has evolved.",
|
|
34
|
+
"Congratulations. This bug unlocks the secret ending.",
|
|
35
|
+
"You weren't supposed to see this.",
|
|
36
|
+
"Developer mode activated.",
|
|
37
|
+
"The bug is now self-aware.",
|
|
38
|
+
"Achievement unlocked: Segmentation Imagination.",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
ultra_rare_messages = [
|
|
42
|
+
"You have been chosen.",
|
|
43
|
+
"Developer console unlocked.",
|
|
44
|
+
"Thanks for finding me.",
|
|
45
|
+
"This line exists solely for people with terrible luck.",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
exception_messages = {
|
|
49
|
+
ZeroDivisionError: "Math is hard.",
|
|
50
|
+
FileNotFoundError: "The file has successfully escaped.",
|
|
51
|
+
KeyboardInterrupt: "Coward.",
|
|
52
|
+
MemoryError: "Have you considered downloading more RAM?",
|
|
53
|
+
RecursionError: "Have you tried recursing less?",
|
|
54
|
+
PermissionError: "The OS said no.",
|
|
55
|
+
AttributeError: "Maybe None isn't what you thought it was.",
|
|
56
|
+
KeyError: "The key has gone on vacation.",
|
|
57
|
+
(ImportError, ModuleNotFoundError): "pip install hope",
|
|
58
|
+
AssertionError: "Your assumptions were... optimistic.",
|
|
59
|
+
TypeError: "Those types were never meant to be together.",
|
|
60
|
+
IndexError: "That index is beyond the horizon.",
|
|
61
|
+
(NameError, UnboundLocalError): "Did you forget to introduce yourself?",
|
|
62
|
+
NotImplementedError: "Future you will deal with this.",
|
|
63
|
+
TimeoutError: "Patience.exe has stopped responding.",
|
|
64
|
+
UnicodeDecodeError: "Your bytes are speaking another language.",
|
|
65
|
+
UnicodeEncodeError: "Unicode strikes again.",
|
|
66
|
+
UnicodeTranslateError: "Lost in translation.",
|
|
67
|
+
UnicodeError: "Unicode is once again reminding us who's boss.",
|
|
68
|
+
ValueError: "Right type. Wrong value.",
|
|
69
|
+
BrokenPipeError: "The pipe has retired.",
|
|
70
|
+
OSError: "The operating system chose violence.",
|
|
71
|
+
RuntimeError: "Runtime had a bad day.",
|
|
72
|
+
EOFError: "The input gave up.",
|
|
73
|
+
OverflowError: "Congratulations, you found infinity.",
|
|
74
|
+
SyntaxError: "Python couldn't even parse your creativity.",
|
|
75
|
+
(IndentationError, TabError): "Tabs and spaces have declared war.",
|
|
76
|
+
StopIteration: "Nothing more to iterate. Literally.",
|
|
77
|
+
StopAsyncIteration: "The async universe has ended.",
|
|
78
|
+
ConnectionRefusedError: "The server left you on read.",
|
|
79
|
+
ConnectionResetError: "Connection rage-quit.",
|
|
80
|
+
ConnectionAbortedError: "The connection changed its mind.",
|
|
81
|
+
ConnectionError: "Have you tried blaming the internet?",
|
|
82
|
+
IsADirectoryError: "That's a folder. Nice try.",
|
|
83
|
+
NotADirectoryError: "Folders don't work that way.",
|
|
84
|
+
FileExistsError: "That file already exists. Like your bugs.",
|
|
85
|
+
InterruptedError: "Something interrupted your masterpiece.",
|
|
86
|
+
ProcessLookupError: "The process vanished into thin air.",
|
|
87
|
+
ChildProcessError: "The child process has run away.",
|
|
88
|
+
LookupError: "Whatever you wanted isn't here.",
|
|
89
|
+
ReferenceError: "That object has moved on.",
|
|
90
|
+
BufferError: "The buffer is buffering... too much.",
|
|
91
|
+
ArithmeticError: "Math has filed a complaint.",
|
|
92
|
+
FloatingPointError: "Floating point strikes again.",
|
|
93
|
+
BlockingIOError: "The operation is taking a coffee break.",
|
|
94
|
+
GeneratorExit: "The generator has retired peacefully.",
|
|
95
|
+
SystemError: "Congratulations. You confused Python itself.",
|
|
96
|
+
SystemExit: "See you next execution.",
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
old_hook = None
|
|
100
|
+
_installed = False
|
|
101
|
+
|
|
102
|
+
def my_hook(exc_type, exc_value, exc_tb):
|
|
103
|
+
if old_hook is not None:
|
|
104
|
+
old_hook(exc_type, exc_value, exc_tb)
|
|
105
|
+
msg = random.choice(random_messages)
|
|
106
|
+
for exception, message in exception_messages.items():
|
|
107
|
+
if issubclass(exc_type, exception):
|
|
108
|
+
msg = message
|
|
109
|
+
break
|
|
110
|
+
bad_luck = random.random()
|
|
111
|
+
if bad_luck < 0.001:
|
|
112
|
+
msg = random.choice(ultra_rare_messages)
|
|
113
|
+
elif bad_luck < 0.01:
|
|
114
|
+
msg = random.choice(rare_messages)
|
|
115
|
+
print(msg, file=sys.stderr)
|
|
116
|
+
|
|
117
|
+
def install():
|
|
118
|
+
global _installed
|
|
119
|
+
if not _installed:
|
|
120
|
+
global old_hook
|
|
121
|
+
old_hook = sys.excepthook
|
|
122
|
+
sys.excepthook = my_hook
|
|
123
|
+
_installed = True
|
|
124
|
+
if random.random() < 0.01:
|
|
125
|
+
print("You shouldn't have installed me.", file=sys.stderr)
|
|
126
|
+
else:
|
|
127
|
+
print("Welcome, hope the bug comes your way.", file=sys.stderr)
|
|
128
|
+
|
|
129
|
+
def uninstall():
|
|
130
|
+
global _installed
|
|
131
|
+
if _installed:
|
|
132
|
+
global old_hook
|
|
133
|
+
sys.excepthook = old_hook
|
|
134
|
+
old_hook = None
|
|
135
|
+
_installed = False
|
|
136
|
+
if random.random() < 0.001:
|
|
137
|
+
print("Goodbye. See you after the next bug.", file=sys.stderr)
|
|
138
|
+
else:
|
|
139
|
+
print("Goodbye, hope you had fun.", file=sys.stderr)
|
|
140
|
+
|
|
141
|
+
def is_installed():
|
|
142
|
+
return _installed
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: prank
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Turns every uncaught exception into emotional damage.
|
|
5
|
+
Author-email: Hoàng Long <hoanglongcodes@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Hoang-Long2012/Prank
|
|
8
|
+
Project-URL: Repository, https://github.com/Hoang-Long2012/Prank
|
|
9
|
+
Project-URL: Issues, https://github.com/Hoang-Long2012/Prank/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/Hoang-Long2012/Prank/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: prank,troll,traceback,exception,excepthook,debug,humor,fun,sarcasm
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# prank
|
|
30
|
+
|
|
31
|
+
Turns every uncaught exception into emotional damage.
|
|
32
|
+
|
|
33
|
+
> Tested on countless unfortunate exceptions.
|
|
34
|
+
>
|
|
35
|
+
> Side effects may include laughter, frustration, and questioning your life choices.
|
|
36
|
+
|
|
37
|
+
> ⚠️ If you use this in production, we need to have a serious talk, dude.
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
- Does absolutely nothing useful.
|
|
42
|
+
- Compatible with your worst debugging session.
|
|
43
|
+
- Zero dependencies.
|
|
44
|
+
- Zero configuration.
|
|
45
|
+
- Zero benefits.
|
|
46
|
+
- Maximum emotional damage.
|
|
47
|
+
- Rare (1%) and Ultra Rare (0.1%) messages.
|
|
48
|
+
- Makes every crash a little more memorable.
|
|
49
|
+
- Makes Python just a little bit more sarcastic.
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install prank
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
No restart required.
|
|
58
|
+
|
|
59
|
+
Emotional damage starts immediately.
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import prank
|
|
65
|
+
|
|
66
|
+
prank.install()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Congratulations.
|
|
70
|
+
|
|
71
|
+
Your future exceptions are no longer alone.
|
|
72
|
+
|
|
73
|
+
Now wait for your next bug.
|
|
74
|
+
|
|
75
|
+
## Example
|
|
76
|
+
|
|
77
|
+
Possible outputs:
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
Traceback (most recent call last):
|
|
81
|
+
...
|
|
82
|
+
ZeroDivisionError: division by zero
|
|
83
|
+
|
|
84
|
+
Math is hard.
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
RuntimeError: Oops
|
|
89
|
+
|
|
90
|
+
Who wrote this code?
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Or maybe...
|
|
94
|
+
|
|
95
|
+
```text
|
|
96
|
+
AttributeError: ...
|
|
97
|
+
|
|
98
|
+
Maybe None isn't what you thought it was.
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Or, if you're incredibly lucky...
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
Developer console unlocked.
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## API
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
prank.install()
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Enable prank mode.
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
prank.uninstall()
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Disable prank mode.
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
prank.is_installed()
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Returns whether prank is currently installed.
|
|
126
|
+
|
|
127
|
+
## FAQ
|
|
128
|
+
|
|
129
|
+
**Does it fix bugs?**
|
|
130
|
+
|
|
131
|
+
No.
|
|
132
|
+
|
|
133
|
+
**Does it improve debugging?**
|
|
134
|
+
|
|
135
|
+
Also no.
|
|
136
|
+
|
|
137
|
+
**Then what's the point?**
|
|
138
|
+
|
|
139
|
+
Because debugging is already painful. It might as well be funny.
|
|
140
|
+
|
|
141
|
+
**Is this a serious project?**
|
|
142
|
+
|
|
143
|
+
No.
|
|
144
|
+
|
|
145
|
+
**Is this a joke?**
|
|
146
|
+
|
|
147
|
+
Yes.
|
|
148
|
+
|
|
149
|
+
**Then why is the code actually well-written?**
|
|
150
|
+
|
|
151
|
+
...
|
|
152
|
+
|
|
153
|
+
**Can I disable it?**
|
|
154
|
+
|
|
155
|
+
Yes.
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
prank.uninstall()
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
Licensed under the [MIT License](LICENSE).
|
|
164
|
+
|
|
165
|
+
No warranty.
|
|
166
|
+
|
|
167
|
+
Especially emotional warranty.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
prank/__init__.py,sha256=A0C2aPf0ks39QyJAnkjmhGxyOAUNmJFALXjRqPIO5XI,5156
|
|
2
|
+
prank-0.1.0.dist-info/licenses/LICENSE,sha256=c1qSpYLFRd3y_-AO7xnys7ntD8rcvVy7_E5Ue5-QIBo,1068
|
|
3
|
+
prank-0.1.0.dist-info/METADATA,sha256=JjO7P5CysnU2JrQPm8QJLjqt9I9KUs7BCmEAanp6qSI,3309
|
|
4
|
+
prank-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
5
|
+
prank-0.1.0.dist-info/top_level.txt,sha256=gIR3-0qiK0D_GuYWL58xHEDkalMMnqtz_OFEPpjPgLo,6
|
|
6
|
+
prank-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hoàng Long
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
prank
|