reagento / dishka

Cute DI framework with agreeable API and everything you need
https://dishka.readthedocs.io
Apache License 2.0
423 stars 47 forks source link

Unable to use provide_all with WithParents #243

Closed ulbwa closed 1 week ago

ulbwa commented 2 months ago

Attempting to use provide_all with WithParents results in a TypeError: Cannot use <class 'dishka.entities.provides_marker.ProvideMultiple'> as a factory.

Example code:

from abc import abstractmethod
from typing import Protocol

from dishka import Provider, Scope, WithParents, provide_all

class MyProtocol(Protocol):
    @abstractmethod
    def __call__(self, data: bytes) -> bytes: ...

class MyImpl(MyProtocol):
    def __call__(self, data: bytes) -> bytes: ...

class MyProvider(Provider):
    scope = Scope.REQUEST

    interactors = provide_all(WithParents[MyImpl])