def configure(binder: inject.Binder) -> None: binder.bind(DbConfigProvider, DbConfigProvider(s.VAULT_DB_NAME)) binder.bind_to_constructor(Db, lambda: SqliteDb()) binder.bind_to_constructor(SqliteDb, lambda: SqliteDb()) print(s.DATA_PATH) binder.bind( DataRepo, S3DataRepo() if s.DATA_PATH.startswith("s3") else LocalDataRepo())
def test_bind_constructor(self): constructor = lambda: 123 binder = Binder() binder.bind_to_constructor(int, constructor) assert binder._bindings[int]._constructor is constructor
def base(binder: inject.Binder): binder.bind_to_constructor(IReceiptDAO, lambda: ReceiptDAO()) binder.bind_to_constructor(IPersonalInfoDAO, lambda: PersonalInfoDAO()) binder.bind_to_constructor(IFileDAO, lambda: FileDAO()) binder.bind_to_constructor(IBonusAccDAO, lambda: BonusAccDAO()) binder.bind_to_constructor(IBonusHistoryDAO, lambda: BonusHistoryDAO()) binder.bind_to_constructor(IDelegateDAO, lambda: DelegateDAO()) binder.bind_to_constructor(IDelegateEventDAO, lambda: DelegateEventDAO()) binder.bind_to_constructor(ICheckingNumberDAO, lambda: CheckingNumberDAO()) binder.bind_to_constructor(IProblemDAO, lambda: ProblemDAO()) binder.bind_to_constructor(IVoteDAO, lambda: VoteDAO()) binder.bind_to_constructor(IDelegatActionDAO, lambda: DelegatActionDAO()) binder.bind_to_constructor(IVoteDelegateDAO, lambda: VoteDelegateDAO()) binder.bind_to_constructor(IRDataDAO, lambda: RDataDAO())