Skip to content

Commit fb7018c

Browse files
committed
Optimize imports in _cwiring.pyx
1 parent 37127bc commit fb7018c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Diff for: src/dependency_injector/_cwiring.pyx

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
import asyncio
44
import collections.abc
5-
import functools
65
import inspect
76
import types
87

9-
from . import providers
10-
from .wiring import _Marker, PatchedCallable
8+
from .wiring import _Marker
119

12-
from .providers cimport Provider
10+
from .providers cimport Provider, Resource
1311

1412

15-
def _sync_inject(object fn, tuple args, dict kwargs, dict injections, dict closings):
13+
def _sync_inject(object fn, tuple args, dict kwargs, dict injections, dict closings, /):
1614
cdef object result
1715
cdef dict to_inject
1816
cdef object arg_key
@@ -29,14 +27,14 @@ def _sync_inject(object fn, tuple args, dict kwargs, dict injections, dict closi
2927
for arg_key, provider in closings.items():
3028
if arg_key in kwargs and not isinstance(kwargs[arg_key], _Marker):
3129
continue
32-
if not isinstance(provider, providers.Resource):
30+
if not isinstance(provider, Resource):
3331
continue
3432
provider.shutdown()
3533

3634
return result
3735

3836

39-
async def _async_inject(object fn, tuple args, dict kwargs, dict injections, dict closings):
37+
async def _async_inject(object fn, tuple args, dict kwargs, dict injections, dict closings, /):
4038
cdef object result
4139
cdef dict to_inject
4240
cdef list to_inject_await = []
@@ -66,7 +64,7 @@ async def _async_inject(object fn, tuple args, dict kwargs, dict injections, dic
6664
for arg_key, provider in closings.items():
6765
if arg_key in kwargs and isinstance(kwargs[arg_key], _Marker):
6866
continue
69-
if not isinstance(provider, providers.Resource):
67+
if not isinstance(provider, Resource):
7068
continue
7169
shutdown = provider.shutdown()
7270
if _isawaitable(shutdown):

0 commit comments

Comments
 (0)