Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sonion-0.2.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sonion-0.2.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

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

Hashes for sonion-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f37ff55285f8cd91d99870d6669762608e0b46c1066b218563ef3456acf4b4b4
MD5 f6ecb63b765b73338a7a849afa2f9a3d
BLAKE2b-256 4ed73b2421223061763830336efd44b127f0523cf4a371aa546c408dadbdba8e

See more details on using hashes here.

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

Hashes for sonion-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5523cd40ec44c8bd681f3fe40e5ebc3d340efd88d066250d43ae2261df33e6f8
MD5 51383deadfb5c0b5625784e681d73b41
BLAKE2b-256 f40defca01bc607a18e61d2d553ecf56c0e03d9c231331c603836cf86f193b0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page