A module for creating static instance objects.
Project description
███████╗████████╗ █████╗ ████████╗██╗ ██████╗██╗ ██╗██████╗
██╔════╝╚══██╔══╝██╔══██╗╚══██╔══╝██║██╔════╝██║ ██║██╔══██╗
███████╗ ██║ ███████║ ██║ ██║██║ ██║ ██║██████╔╝
╚════██║ ██║ ██╔══██║ ██║ ██║██║ ██║ ██║██╔══██╗
███████║ ██║ ██║ ██║ ██║ ██║╚██████╗███████╗██║██████╔╝
╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝╚═════╝
StaticLib is a module that provides a single class for defining a static object.
There're two option for a StaticObject instance:
freeze_value=True: the value declared within the StaticObject instance is immutable.
freeze_value=False: the value declared within the StaticObject instance is mutable.
For values to become mutable, the freeze_value option have to be set to True during object instanciation.
The value can them be modified by invoking the 'modify' method.
A type that is declared during object instanciation is always immutable, meaning it can never be changed.
Examples:
from StaticLib import StaticObject
# Unmodifiable
user: StaticObject = StaticObject(str, "Admin", freeze_value=True)
if hasattr(user, "error"):
raise user.error
else:
print(user.value)
# Trying to modify the value results in an error
# if user.modify("Hello") is False:
# raise user.error # we'll see this error
# else:
# print(user.value)
##################################################################
# Modifiable
age: StaticObject = StaticObject(int, 22, freeze_value=False)
if hasattr(age, "error"):
raise age.error
elif not age.modify(15):
raise age.error
else:
print(age.value)
# The instance object can be viewed as a string representation using the 'view' method
print(user.view())
print(age.view())
###################################################################
# When using StaticLib the None type is replaced with a custom type named Null
# which can be imported and used as a type and a value without the hassle of using None
# as it isn't considered a type and doesn't work well with isinstance. The name of the
# Null type is StaticNull where Null is its alias.
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 staticlib-0.1.tar.gz.
File metadata
- Download URL: staticlib-0.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Kali GNU/Linux","version":"2025.4","id":"kali-rolling","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c00ab9f67b71d9a16f6f0571e075816c2345d16058a9f713164d4d4287718147
|
|
| MD5 |
e55a2080e639629e0b7e942d3d74b4e1
|
|
| BLAKE2b-256 |
89e3eb042007e5905c818a4d87964ac1a1e7608fae34940276ae97ffd7555d19
|
File details
Details for the file staticlib-0.1-py3-none-any.whl.
File metadata
- Download URL: staticlib-0.1-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Kali GNU/Linux","version":"2025.4","id":"kali-rolling","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
082a5ddf42839aa7b421348fad02842d268f344d0dcf77dd1e6129aafa0d178d
|
|
| MD5 |
75cdcaee13a2bfc95eb584a7347d5db3
|
|
| BLAKE2b-256 |
134fb75b2621d13a44f95d45b48c742c417553e4e2e2c54cb68f38d183f20a96
|