- Notifications
You must be signed in to change notification settings - Fork15
Open
Description
Based on this comment#391 (comment)
There is a repeated pattern of checking for function-specific imports and providing a helpful error message on failure to import, e.g.:
python-graphblas/graphblas/io.py
Lines 246 to 254 in7bf394d
| try: | |
| importsparse | |
| exceptImportError:# pragma: no cover (import) | |
| raiseImportError("sparse is required to import from pydata sparse")fromNone | |
| ifnotisinstance(s,sparse.SparseArray): | |
| raiseTypeError( | |
| "from_pydata_sparse only accepts objects from the `sparse` library; " | |
| "see https://sparse.pydata.org" | |
| ) |
This issue is to study the feasibility and value-added of extracting this logic into a separate utility function.