construct.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 _construct
  6. __all__ = [ # noqa: F822
  7. 'block_diag',
  8. 'bmat',
  9. 'bsr_matrix',
  10. 'check_random_state',
  11. 'coo_matrix',
  12. 'csc_matrix',
  13. 'csr_hstack',
  14. 'csr_matrix',
  15. 'dia_matrix',
  16. 'diags',
  17. 'eye',
  18. 'get_index_dtype',
  19. 'hstack',
  20. 'identity',
  21. 'isscalarlike',
  22. 'issparse',
  23. 'kron',
  24. 'kronsum',
  25. 'numbers',
  26. 'partial',
  27. 'rand',
  28. 'random',
  29. 'rng_integers',
  30. 'spdiags',
  31. 'upcast',
  32. 'vstack',
  33. ]
  34. def __dir__():
  35. return __all__
  36. def __getattr__(name):
  37. if name not in __all__:
  38. raise AttributeError(
  39. "scipy.sparse.construct is deprecated and has no attribute "
  40. f"{name}. Try looking in scipy.sparse instead.")
  41. warnings.warn(f"Please use `{name}` from the `scipy.sparse` namespace, "
  42. "the `scipy.sparse.construct` namespace is deprecated.",
  43. category=DeprecationWarning, stacklevel=2)
  44. return getattr(_construct, name)