dsolve.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # This file is not meant for public use and will be removed in SciPy v2.0.0.
  2. # Use the `scipy.sparse.linalg` namespace for importing the functions
  3. # included below.
  4. import warnings
  5. from . import _dsolve
  6. __all__ = [ # noqa: F822
  7. 'MatrixRankWarning', 'SuperLU', 'factorized',
  8. 'spilu', 'splu', 'spsolve',
  9. 'spsolve_triangular', 'use_solver', 'linsolve', 'test'
  10. ]
  11. dsolve_modules = ['linsolve']
  12. def __dir__():
  13. return __all__
  14. def __getattr__(name):
  15. if name not in __all__ and name not in dsolve_modules:
  16. raise AttributeError(
  17. "scipy.sparse.linalg.dsolve is deprecated and has no attribute "
  18. f"{name}. Try looking in scipy.sparse.linalg instead.")
  19. if name in dsolve_modules:
  20. msg = (f'The module `scipy.sparse.linalg.dsolve.{name}` is '
  21. 'deprecated. All public names must be imported directly from '
  22. 'the `scipy.sparse.linalg` namespace.')
  23. else:
  24. msg = (f"Please use `{name}` from the `scipy.sparse.linalg` namespace,"
  25. " the `scipy.sparse.linalg.eigen` namespace is deprecated.")
  26. warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
  27. return getattr(_dsolve, name)