csr.py 887 B

123456789101112131415161718192021222324252627282930313233343536
  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 _csr
  6. __all__ = [ # noqa: F822
  7. 'csr_count_blocks',
  8. 'csr_matrix',
  9. 'csr_tobsr',
  10. 'csr_tocsc',
  11. 'get_csr_submatrix',
  12. 'get_index_dtype',
  13. 'isspmatrix_csr',
  14. 'spmatrix',
  15. 'upcast',
  16. ]
  17. def __dir__():
  18. return __all__
  19. def __getattr__(name):
  20. if name not in __all__:
  21. raise AttributeError(
  22. "scipy.sparse.csr is deprecated and has no attribute "
  23. f"{name}. Try looking in scipy.sparse instead.")
  24. warnings.warn(f"Please use `{name}` from the `scipy.sparse` namespace, "
  25. "the `scipy.sparse.csr` namespace is deprecated.",
  26. category=DeprecationWarning, stacklevel=2)
  27. return getattr(_csr, name)