Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from examples.qualifier_overloading.sender_service import SenderService
from injectable import injectable
@injectable(group="old")
class FaxSenderService(SenderService):
def send(self, message, recipient):
print(f"Sending Fax to {recipient}: {message}")
from injectable import injectable, autowired, Autowired
@injectable(qualifier="B")
class ServiceB:
@autowired
def __init__(self, service_a: Autowired("A", lazy=True)):
self.service_a = service_a
self.some_property = "some property from B"
@property
def get_some_property_from_a(self):
return self.service_a.some_property
from injectable import injectable
@injectable(singleton=True)
class SingletonClient:
def __init__(self):
self.connected = False
def connect(self):
self.connected = True
from injectable import injectable, Autowired, autowired
@injectable(qualifier="A")
class ServiceA:
@autowired
def __init__(self, service_b: Autowired("B", lazy=True)):
self.service_b = service_b
self.some_property = "some property from A"
@property
def get_some_property_from_b(self):
return self.service_b.some_property
from examples.dependencies_precedence.abstract_service import AbstractService
from injectable import injectable
@injectable(qualifier="sum", primary=True)
class SumService(AbstractService):
def combine(self, a, b):
print(f"{a} + {b} = {a + b}")
from examples.dependencies_precedence.abstract_service import AbstractService
from injectable import injectable
@injectable(qualifier="multiply")
class MultiplyService(AbstractService):
def combine(self, a, b):
print(f"{a} * {b} = {a * b}")