Injection of dependencies for python 3
Project description
For when your object graph is too big
class A:
def __init__(self, context: Pytel):
self.b = context.b
class B:
pass
context = Pytel()
context.a = lazy(A)(context)
context.b = lazy(B)
assert context.a.b == context.b
Works with dependency cycles (through a proxy object):
class A:
def __init__(self, context: Pytel):
self.b = context.b
class B:
def __init__(self, context: Pytel):
self.a = context.a
context = Pytel()
context.a = lazy(A)(context)
context.b = lazy(B)(context)
assert context.a.b == context.b
assert context.b.a == context.a
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
pytel-inject-0.2.1.tar.gz
(8.8 kB
view hashes)
Built Distribution
Close
Hashes for pytel_inject-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfe961cac4be8ddec71d2b6476d04e08cecfe879bc95ab8baa43ccaeecca14bd |
|
MD5 | d3933d0b7bdd576e491bd568745475bd |
|
BLAKE2b-256 | 66a599337a8103b604d71c964cb5f48a8cfbf1c43a8b6860815d0c5b4d0a40e7 |