sputils.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 _sputils
  6. __all__ = [ # noqa: F822
  7. 'asmatrix',
  8. 'check_reshape_kwargs',
  9. 'check_shape',
  10. 'downcast_intp_index',
  11. 'get_index_dtype',
  12. 'get_sum_dtype',
  13. 'getdata',
  14. 'getdtype',
  15. 'is_pydata_spmatrix',
  16. 'isdense',
  17. 'isintlike',
  18. 'ismatrix',
  19. 'isscalarlike',
  20. 'issequence',
  21. 'isshape',
  22. 'matrix',
  23. 'operator',
  24. 'prod',
  25. 'supported_dtypes',
  26. 'sys',
  27. 'to_native',
  28. 'upcast',
  29. 'upcast_char',
  30. 'upcast_scalar',
  31. 'validateaxis',
  32. ]
  33. def __dir__():
  34. return __all__
  35. def __getattr__(name):
  36. if name not in __all__:
  37. raise AttributeError(
  38. "scipy.sparse.sputils is deprecated and has no attribute "
  39. f"{name}. Try looking in scipy.sparse instead.")
  40. warnings.warn(f"Please use `{name}` from the `scipy.sparse` namespace, "
  41. "the `scipy.sparse.sputils` namespace is deprecated.",
  42. category=DeprecationWarning, stacklevel=2)
  43. return getattr(_sputils, name)