Skip to content

Commit

Permalink
don't introspect
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangb committed Oct 4, 2022
1 parent 1b5c014 commit 7dbb3cb
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions xpresso/dependencies/_dependencies.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import inspect
import typing

from di.api.providers import DependencyProvider
Expand Down Expand Up @@ -84,10 +83,7 @@ def __init__(
def as_dependant(self) -> Dependant[DependencyType]:
call: "typing.Optional[DependencyProvider]"
if self.sync_to_thread:
if not (
inspect.isasyncgenfunction(self.call)
or inspect.iscoroutinefunction(self.call)
):
if not self.call:
raise ValueError(
"sync_to_thread can only be used if you explicitly declare the target function"
)
Expand Down

0 comments on commit 7dbb3cb

Please sign in to comment.