-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
hygieneImprove code quality and reduce maintenance overheadImprove code quality and reduce maintenance overhead
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 in 7bf394d
try: | |
import sparse | |
except ImportError: # pragma: no cover (import) | |
raise ImportError("sparse is required to import from pydata sparse") from None | |
if not isinstance(s, sparse.SparseArray): | |
raise TypeError( | |
"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.
Metadata
Metadata
Assignees
Labels
hygieneImprove code quality and reduce maintenance overheadImprove code quality and reduce maintenance overhead