MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / _LazyRaise

Class _LazyRaise

monai/utils/module.py:409–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407 msg += f" ({exception_str})"
408
409 class _LazyRaise:
410
411 def __init__(self, *_args, **_kwargs):
412 _default_msg = (
413 f"{msg}."
414 + "\n\nFor details about installing the optional dependencies, please visit:"
415 + "\n https://monai.readthedocs.io/en/latest/installation.html#installing-the-recommended-dependencies"
416 )
417 if tb_str:
418 _default_msg += f"\n\nOriginal traceback:\n{tb_str}"
419 self._exception = OptionalImportError(_default_msg)
420
421 def __getattr__(self, name):
422 """
423 Raises:
424 OptionalImportError: When you call this method.
425 """
426 raise self._exception
427
428 def __call__(self, *_args, **_kwargs):
429 """
430 Raises:
431 OptionalImportError: When you call this method.
432 """
433 raise self._exception
434
435 def __getitem__(self, item):
436 raise self._exception
437
438 def __iter__(self):
439 raise self._exception
440
441 if as_type == "default":
442 return _LazyRaise(), False

Callers 1

optional_importFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…