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.2.tar.gz
(8.6 kB
view hashes)
Built Distribution
Close
Hashes for pytel_inject-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a7193c1e28e93f28c6b6cde0578c49668e4db1da7677b29839cd98a8dc60d6c |
|
MD5 | f43d7eb97c197478e5761f774111561a |
|
BLAKE2b-256 | 758d9b65f954361750b2c1815a56713e9088180066c8cc6a2ac3d1598bf966dc |