Attempt to import a required dependency. Raises a RuntimeError if the requested module is not available.
(mod_name, error_msg)
| 319 | |
| 320 | |
| 321 | def import_required(mod_name, error_msg): |
| 322 | """Attempt to import a required dependency. |
| 323 | |
| 324 | Raises a RuntimeError if the requested module is not available. |
| 325 | """ |
| 326 | try: |
| 327 | return import_module(mod_name) |
| 328 | except ImportError as e: |
| 329 | raise RuntimeError(error_msg) from e |
| 330 | |
| 331 | |
| 332 | @contextmanager |
no outgoing calls
no test coverage detected