How to use the injectable.injectable function in injectable

To help you get started, we’ve selected a few injectable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github allrod5 / injectable / examples / qualifier_overloading / fax_sender_service.py View on Github external
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}")
github allrod5 / injectable / examples / cyclic_dependency / service_b.py View on Github external
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
github allrod5 / injectable / examples / singletons / singleton_client.py View on Github external
from injectable import injectable


@injectable(singleton=True)
class SingletonClient:
    def __init__(self):
        self.connected = False

    def connect(self):
        self.connected = True
github allrod5 / injectable / examples / cyclic_dependency / service_a.py View on Github external
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
github allrod5 / injectable / examples / dependencies_precedence / sum_service.py View on Github external
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}")
github allrod5 / injectable / examples / dependencies_precedence / multiply_service.py View on Github external
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}")