dok.py 980 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 _dok
  6. __all__ = [ # noqa: F822
  7. 'IndexMixin',
  8. 'check_shape',
  9. 'dok_matrix',
  10. 'get_index_dtype',
  11. 'getdtype',
  12. 'isdense',
  13. 'isintlike',
  14. 'isscalarlike',
  15. 'isshape',
  16. 'isspmatrix',
  17. 'isspmatrix_dok',
  18. 'itertools',
  19. 'spmatrix',
  20. 'upcast',
  21. 'upcast_scalar',
  22. ]
  23. def __dir__():
  24. return __all__
  25. def __getattr__(name):
  26. if name not in __all__:
  27. raise AttributeError(
  28. "scipy.sparse.dok is deprecated and has no attribute "
  29. f"{name}. Try looking in scipy.sparse instead.")
  30. warnings.warn(f"Please use `{name}` from the `scipy.sparse` namespace, "
  31. "the `scipy.sparse.dok` namespace is deprecated.",
  32. category=DeprecationWarning, stacklevel=2)
  33. return getattr(_dok, name)