2021-08-06 00:07:30 +02:00
|
|
|
from inject import Binder, Injector, clear_and_configure, get_injector_or_die
|
2021-08-01 17:02:15 +02:00
|
|
|
|
|
|
|
from ytrssil.config import Configuration
|
2021-11-19 19:44:46 +01:00
|
|
|
from ytrssil.fetch import create_fetcher
|
|
|
|
from ytrssil.parse import create_feed_parser
|
|
|
|
from ytrssil.protocols import ChannelRepository, Fetcher, Parser
|
|
|
|
from ytrssil.repository import create_channel_repository
|
2021-08-01 17:02:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
def dependency_configuration(binder: Binder) -> None:
|
|
|
|
config = Configuration()
|
|
|
|
binder.bind(Configuration, config)
|
|
|
|
binder.bind_to_constructor(ChannelRepository, create_channel_repository)
|
2021-08-02 01:38:28 +02:00
|
|
|
binder.bind_to_constructor(Fetcher, create_fetcher)
|
2021-08-01 17:02:15 +02:00
|
|
|
binder.bind_to_constructor(Parser, create_feed_parser)
|
|
|
|
|
|
|
|
|
2021-08-02 01:38:28 +02:00
|
|
|
def setup_dependencies() -> Injector:
|
2021-08-06 00:07:30 +02:00
|
|
|
clear_and_configure(dependency_configuration)
|
2021-08-02 01:38:28 +02:00
|
|
|
|
|
|
|
return get_injector_or_die()
|