mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-21 17:16:46 +03:00
569 fix numpy typing wiring (#570)
* change erroneous issubclass call to isinstance * import numpy.typing in tests * better subclass check * fix return
This commit is contained in:
parent
c26b260c73
commit
8fe00bcff0
|
@ -321,7 +321,13 @@ class InspectFilter:
|
|||
def _is_starlette_request_cls(self, instance: object) -> bool:
|
||||
return starlette \
|
||||
and isinstance(instance, type) \
|
||||
and issubclass(instance, starlette.requests.Request)
|
||||
and self._safe_is_subclass(instance, starlette.requests.Request)
|
||||
|
||||
def _safe_is_subclass(self, instance: type, cls: type) -> bool:
|
||||
try:
|
||||
return issubclass(instance, cls)
|
||||
except TypeError:
|
||||
return False
|
||||
|
||||
def _is_builtin(self, instance: object) -> bool:
|
||||
return inspect.isbuiltin(instance)
|
||||
|
|
|
@ -5,6 +5,7 @@ import sys
|
|||
if "pypy" not in sys.version.lower():
|
||||
import numpy # noqa
|
||||
from numpy import * # noqa
|
||||
from numpy.typing import * # noqa
|
||||
|
||||
import scipy # noqa
|
||||
from scipy import * # noqa
|
||||
|
|
Loading…
Reference in New Issue
Block a user