AttribTool
The project contains base classes that limit the possibility of adding new attributes without their prior declaration inside classes inheriting from them or their objects.
Classes throw an AttributeError exception when trying to add an undefined attribute to a derived class or its object.
Usage examples
from attribtool.ndattrib import NoDynamicAttributes
class Example(NoDynamicAttributes):
__name = None
def __init__(self):
self.__name = self.__class__.__name__
if __name__ == "__main__":
obj = Example()
obj.data = "abc"
% ./example.py
Traceback (most recent call last):
File "/home/szumak/Projects/ToolBox/AttribTool/./example.py", line 22, in <module>
obj.data = "abc"
File "/home/szumak/Projects/ToolBox/AttribTool/attribtool/ndattrib.py", line 22, in __setattr__
raise AttributeError(
AttributeError: Cannot add new attribute 'data' to Example object
from attribtool.nnattrib import NoNewAttributes
class Example(NoNewAttributes):
__name = None
def __init__(self):
self.__name = self.__class__.__name__
self.__data = 1
if __name__ == "__main__":
obj = Example()
% ./example.py
Traceback (most recent call last):
File "/home/szumak/Projects/ToolBox/AttribTool/./example.py", line 22, in <module>
obj = Example()
File "/home/szumak/Projects/ToolBox/AttribTool/./example.py", line 18, in __init__
self.__data = 1
File "/home/szumak/Projects/ToolBox/AttribTool/attribtool/nnattrib.py", line 24, in __setattr__
raise AttributeError(
AttributeError: Undefined attribute _Example__data cannot be added to <__main__.Example object at 0x7f7129ccc2b0>
Metadata
Release files for attribtool 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| attribtool-1.0.4.tar.gz | 3.1 kB | Without provenance | Details for attribtool-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| attribtool-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for attribtool-1.0.4-py3-none-any.whl |
Total release size: 7.8 kB
Release files / attribtool-1.0.4.tar.gz
| Download URL | attribtool-1.0.4.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
672d9509cd27d01bc60f62754d27133e3fc62263883ce8a65d4305a8a21c371f
|
|
BLAKE2b-256 checksum How to use checksums |
46c7da47aa64ee9a9a4eb33f57a9ef9d657bead6c55501c58891e9b101ec7e55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.9.2 Linux/5.10.0-22-amd64
|
Release files / attribtool-1.0.4-py3-none-any.whl
| Download URL | attribtool-1.0.4-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45d6d616f86e4ac084c04ff70e1d5df3bb89091e4e81a9c728ef1da906e02727
|
|
BLAKE2b-256 checksum How to use checksums |
130095cd0a2f6bd652aa917b6658de87c725a46ed6b9d08235eb664a2f128ffc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.9.2 Linux/5.10.0-22-amd64
|
Security for attribtool 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.