Python utility functions for cleaner, more readable code
Project description
funx
The main reason why this library was created is to:
use
from funx import isinstances
def add(num1: int, num2: int) -> int:
if isinstances(num1, num2, datatype=int): # 41 char
return num1 + num2
raise TypeError("invalid arguments types")
print(add(3, 7))
in place of
def add(num1: int, num2: int) -> int:
if isinstance(num1, int) and isinstance(num2, int): # 51 char
return num1 + num2
raise TypeError("invalid arguments types")
print(add(3, 7))
and
from funx import isinstances
def fun(name: str, age: int) -> None:
if isinstances(name, age, datatype=(str, int)): # 47 char
print(f"your name is {name} and your age is {age}")
return
raise TypeError("invalid arguments types")
fun("mohamed", 23)
in place of
def fun(name: str, age: int) -> None:
if isinstance(name, str) and isinstance(age, int): # 50 char
print(f"your name is {name} and your age is {age}")
return
raise TypeError("invalid arguments types")
fun("mohamed", 23)
but not just this there is other funcs and with a very advanced usage you can see the source code and check all the tests in the main fun.
Installation
You can install funx via pip:
pip install funx
License
This project is licensed under the MIT LICENSE - see the LICENSE for more details.
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
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 funx-1.0.2.tar.gz.
File metadata
- Download URL: funx-1.0.2.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90be9fad2a25972b5b3ac4a1fcefbc49ec00a4a66e5315ae963d4212d1a0bff8
|
|
| MD5 |
3b8d535a6d3b16a1bfafc3ea56b69254
|
|
| BLAKE2b-256 |
a3ffea025acdac90c6539b34b67fd593b1136598f8655552e6fb1af1b8705c5c
|
File details
Details for the file funx-1.0.2-py3-none-any.whl.
File metadata
- Download URL: funx-1.0.2-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
392f6795860037cb49700a7a14b322487d76759e1edfcb7bca3e7b562385edfc
|
|
| MD5 |
2fb242928d2f777524312f312e880998
|
|
| BLAKE2b-256 |
687af97434ee53122f3be8e7524ee07bbc9b684d395967e6ac5acca4683bb10b
|