A massive Python library to creatively check every mathematical property of numbers, son... ๐ญ๐
Project description
๐ญ๐ sonion
Welcome to sonion, the most over-engineered, mathematically profound, and utterly depressing number-checking library ever conceived in Python.
Have you ever looked at a number and thought: "Sure, it's even, but does it have any aura? Is it a Spy Number? Is it over 9000? Is it spooky?"
Well, my friend, sonion is exactly what you didn't know you needed.
It is designed to demonstrate the power of Python's execution contexts, "magic" dunder methods, and operator overloading, all while throwing TikTok brainrot-level sarcastic errors at you if you do something stupid.
๐ฆ Installation
pip install sonion
Once installed, you can type sonion directly into your terminal to see the interactive quick-start guide!
$ sonion
๐ Usage
The module is imported simply as son:
import son
๐ง The "Magic" Behavior
The functions in this library never actually return a primitive boolean (True or False). Instead, they return a custom object (SonResult) that reads your mind depending on where you use it.
It acts like a boolean for the cold logic of the computer, but screams sentences for the delicate eyes of the user!
1. Logic Contexts (__bool__)
If you use it in an if statement, it acts like a ninja. It evaluates strictly as True or False silently.
if son.isEven(4):
print("The computer knows it's even, but the module kept its mouth shut!")
2. Display Contexts (__repr__)
If you type it into an interactive REPL or print() it, it suddenly becomes chatty:
>>> son.isEven(2)
yes 2 is an even number, son... ๐ญ๐
3. Doing Math with Sentences (__add__, __sub__, etc)
Because True acts as 1 and False acts as 0 in Python, we overloaded the math operators. You can literally add sentences together!
>>> son.isEven(2) + son.isEven(4)
2
>>> son.isEven(2) + 10
11
4. The Sarcastic Error Handler (__getattr__)
If you try to call a function that doesn't exist, it intercepts your typo and insults you:
>>> son.isFloatingPoint(3.14)
AttributeError: SonMathError: Whoa there Einstein. 'isFloatingPoint' is way above my paygrade. I just do basic integer properties, son... ๐ญ๐
>>> son.isCap(1)
AttributeError: SonBrainrotError: You're watching too many movies. 'isCap' isn't a real function, son... ๐ญ๐
5. Parameter Validation (Ghosting and Greed)
The functions strictly demand exactly one number.
>>> son.isHappy()
TypeError: SonGhostError: Bro passed absolutely nothing to isHappy(). Who are you talking to, son... ๐ญ๐
>>> son.isEven(2, 4)
TypeError: SonGreedyError: isEven() only takes ONE number! Why are you doing so much, son... ๐ญ๐
>>> son.isHappy("yes")
TypeError: SonNegativeAuraError: You passed a str ('yes') to isHappy(). I only evaluate numbers, son... ๐ญ๐
6. Global Brainrot Infection (sys.excepthook)
The absolute most devastating feature: just by import son, the library infects your global Python error handler!
If you make any standard Python error anywhere in your script, it will add a tragic brainrot message to the crash:
>>> 1 / 0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: division by zero
SonZeroDivisionError: Bro tried to divide by zero... reality is collapsing, son... ๐ญ๐
>>> eval("if True print('syntax')")
Traceback (most recent call last):
...
SyntaxError: invalid syntax
SonSyntaxError: You can't even type Python properly... negative aura, son... ๐ญ๐
>>> print(unknown_variable)
Traceback (most recent call last):
...
NameError: name 'unknown_variable' is not defined
SonNameError: Bro forgot to define 'unknown_variable'... memory loss, son... ๐ญ๐
๐งฎ The Arsenal of Checks
We support everything from basic middle-school math to college-level number theory, trigonometry, and pure internet brainrot.
Basic Math
>>> son.isEven(2)
yes 2 is an even number, son... ๐ญ๐
>>> son.isPrime(7)
yes 7 is a prime number, son... ๐ญ๐
>>> son.isPositive(-5)
no -5 is not a positive number, son... ๐ญ๐
Advanced Nerd Math
>>> son.isFibonacci(8)
yes 8 is a Fibonacci number, son... ๐ญ๐
>>> son.isArmstrong(153)
yes 153 is an Armstrong number, son... ๐ญ๐
>>> son.isHappy(19)
yes 19 is a happy number, son... ๐ญ๐
>>> son.isPronic(12)
yes 12 is a pronic number, son... ๐ญ๐
>>> son.isFascinating(192)
yes 192 is a fascinating number, son... ๐ญ๐
(Also supports: isSquare, isCube, isPerfect, isPowerOfTwo, isHarshad, isAbundant, isDeficient, isPalindrome, isTriangular, isAutomorphic, isNeon, isSpy)
Constants & Trigonometry
>>> son.isPi(3.14159)
yes 3.14159 is Pi (ฯ), son... ๐ญ๐
>>> son.isGoldenRatio(1.61803)
yes 1.61803 is the Golden Ratio (ฯ), son... ๐ญ๐
>>> son.isRightAngle(90)
yes 90 is a right angle in degrees, son... ๐ญ๐
Internet Brainrot
>>> son.isBeast(666)
yes 666 is the number of the beast, son... ๐ญ๐ ๐ค
>>> son.isLeet(1337)
yes 1337 is absolutely l33t, son... ๐ญ๐
>>> son.isOver9000(9001)
IT'S OVER 9000, SON... ๐ญ๐ (yes, 9001 is > 9000)
>>> son.isWeed(420)
420 blaze it, son... ๐ญ๐ ๐ฟ๐จ
>>> son.isSpooky(13)
woah 13 is super spooky, son... ๐ญ๐ ๐ป
>>> son.isError404(404)
Error 404: Number not found, son... ๐ญ๐
>>> son.isMeaningOfLife(42)
yes 42 is the meaning of life, the universe, and everything, son... ๐ญ๐
>>> son.isSkibidi(69)
skibidi toilet rizz! 69 is pure sigma, son... ๐ญ๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sonion-0.2.1.tar.gz.
File metadata
- Download URL: sonion-0.2.1.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f37ff55285f8cd91d99870d6669762608e0b46c1066b218563ef3456acf4b4b4
|
|
| MD5 |
f6ecb63b765b73338a7a849afa2f9a3d
|
|
| BLAKE2b-256 |
4ed73b2421223061763830336efd44b127f0523cf4a371aa546c408dadbdba8e
|
File details
Details for the file sonion-0.2.1-py3-none-any.whl.
File metadata
- Download URL: sonion-0.2.1-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5523cd40ec44c8bd681f3fe40e5ebc3d340efd88d066250d43ae2261df33e6f8
|
|
| MD5 |
51383deadfb5c0b5625784e681d73b41
|
|
| BLAKE2b-256 |
f40defca01bc607a18e61d2d553ecf56c0e03d9c231331c603836cf86f193b0f
|