coo.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # This file is not meant for public use and will be removed in SciPy v2.0.0.
  2. # Use the `scipy.sparse` namespace for importing the functions
  3. # included below.
  4. import warnings
  5. from . import _coo
  6. __all__ = [ # noqa: F822
  7. 'SparseEfficiencyWarning',
  8. 'check_reshape_kwargs',
  9. 'check_shape',
  10. 'coo_matrix',
  11. 'coo_matvec',
  12. 'coo_tocsr',
  13. 'coo_todense',
  14. 'downcast_intp_index',
  15. 'get_index_dtype',
  16. 'getdata',
  17. 'getdtype',
  18. 'isshape',
  19. 'isspmatrix',
  20. 'isspmatrix_coo',
  21. 'operator',
  22. 'spmatrix',
  23. 'to_native',
  24. 'upcast',
  25. 'upcast_char',
  26. 'warn',
  27. ]
  28. def __dir__():
  29. return __all__
  30. def __getattr__(name):
  31. if name not in __all__:
  32. raise AttributeError(
  33. "scipy.sparse.coo is deprecated and has no attribute "
  34. f"{name}. Try looking in scipy.sparse instead.")
  35. warnings.warn(f"Please use `{name}` from the `scipy.sparse` namespace, "
  36. "the `scipy.sparse.coo` namespace is deprecated.",
  37. category=DeprecationWarning, stacklevel=2)
  38. return getattr(_coo, name)