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.0.tar.gz
(8.6 kB
view hashes)
Built Distribution
Close
Hashes for pytel_inject-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbe85adeda0d2683b2110d4a82b04ec181262331400fa88609615ca104a4de00 |
|
MD5 | fbfb9eb5ff8cb484a0c1863aa989721a |
|
BLAKE2b-256 | e528c29d6cb9dc79f546785fb3b526444d6be091bc066d81cf0a33e4d30a8615 |