dependencies helper
Project description
dependency helper
Dependency helper for properties of python class
$ pip install deps_helper
from deps_helper import Dependencies
class A(deps := Dependencies.new()):
# "_for" can be an array
@deps.register(_for="operation")
def requested_by(self, user):
print(f"operation requested by {user}.")
return user
@deps.guard()
def operation(self):
...
>>> a = A()
>>> a.operation()
Traceback (most recent call last):
...
AttributeError: ("follow attributes are not assigned for operation => ", [requested_by])
>>> a.requested_by = "admin"
operation requested by admin.
>>> a.operation() # OK
>>>
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
deps_helper-0.1.5.tar.gz
(1.6 kB
view hashes)
Built Distribution
Close
Hashes for deps_helper-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4758c4e9893212f7429f24747322652f129bff08a68ada23e0275240a9aa7dda |
|
MD5 | 1b36a69b289237075faaa85bc71feffc |
|
BLAKE2b-256 | 15edfe8e0bec07670fba72cdfeffd07a762f3d6ce1355d49577512d460a0e142 |