Abstract base class for decorators
Project description
abd - Abstract Base Decorator
abd provides an AbstractBaseDecorator
class which you can inherit from to create flexible decorators.
Example
>>> from abd import ABD
>>> class Decorator(ABD):
... def invoke(self, *args, **kwargs):
... """Must write an invoke function
... invoke is called when the decorated function is called
... """
... # catch, edit and pass on the (keyword) arguments
... # that are given the the decorated function
... print('invoke is called')
... result = self.decorated_object(*args, **kwargs)
... # function has been called and result is available
... # possible to edit the result here
... return result
...
>>> @Decorator
... def func(argument):
... # some function logic ...
... return argument
...
>>> func('some text')
invoke is called
'some text'
>>>
PyPI
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
abd-0.0.3.tar.gz
(11.2 kB
view details)
Built Distribution
abd-0.0.3-py2.py3-none-any.whl
(10.3 kB
view details)
File details
Details for the file abd-0.0.3.tar.gz
.
File metadata
- Download URL: abd-0.0.3.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b9052f300a8d047501559c5476da143001794ccc0b93b692d3043958b1299f9 |
|
MD5 | 14015c22cc844016f954165e2ec08287 |
|
BLAKE2b-256 | f872cff93a2c1d9419b6e456dc1372a99f22821581a94d92e809760bbc9998c7 |
File details
Details for the file abd-0.0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: abd-0.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b9f6a17f9bea809af45b14805da9b63050d05df2545c8074d818fc7eec07381 |
|
MD5 | 4a36b97f2dddd95d89c054eef0926c6b |
|
BLAKE2b-256 | ba9f89c8a2938603b128e65b30ce300a7c65281f10e6706f80ca6e328a45562f |