tripwire
¶
Class to raise error for missing modules or other misfortunes
|
Class raising error if used |
Exception if trying to use TripWire object |
|
|
Returns True if obj appears to be a TripWire object |
TripWire
¶
- class nibabel.tripwire.TripWire(msg: str)¶
Bases:
object
Class raising error if used
Standard use is to proxy modules that we could not import
Examples
>>> a_module = TripWire('We do not have a_module') >>> a_module.do_silly_thing('with silly string') Traceback (most recent call last): ... TripWireError: We do not have a_module
- __init__(msg: str) None ¶
TripWireError
¶
is_tripwire¶
- nibabel.tripwire.is_tripwire(obj: Any) bool ¶
Returns True if obj appears to be a TripWire object
Examples
>>> is_tripwire(object()) False >>> is_tripwire(TripWire('some message')) True