"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "865d4d595eefc8cc9cee58fec9179bd182be0e2e"
Unverified Commit ec15da24 authored by Toni Kukurin's avatar Toni Kukurin Committed by GitHub
Browse files

Report only the failed imports in `requires_backends` (#15636)

parent 2b8599b2
...@@ -827,8 +827,10 @@ def requires_backends(obj, backends): ...@@ -827,8 +827,10 @@ def requires_backends(obj, backends):
backends = [backends] backends = [backends]
name = obj.__name__ if hasattr(obj, "__name__") else obj.__class__.__name__ name = obj.__name__ if hasattr(obj, "__name__") else obj.__class__.__name__
if not all(BACKENDS_MAPPING[backend][0]() for backend in backends): checks = (BACKENDS_MAPPING[backend] for backend in backends)
raise ImportError("".join([BACKENDS_MAPPING[backend][1].format(name) for backend in backends])) failed = [msg.format(name) for available, msg in checks if not available()]
if failed:
raise ImportError("".join(failed))
class DummyObject(type): class DummyObject(type):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment