kdtree.py 870 B

12345678910111213141516171819202122232425262728293031323334
  1. # This file is not meant for public use and will be removed in SciPy v2.0.0.
  2. # Use the `scipy.spatial` namespace for importing the functions
  3. # included below.
  4. import warnings
  5. from . import _kdtree
  6. __all__ = [ # noqa: F822
  7. 'KDTree',
  8. 'Rectangle',
  9. 'cKDTree',
  10. 'cKDTreeNode',
  11. 'distance_matrix',
  12. 'minkowski_distance',
  13. 'minkowski_distance_p',
  14. ]
  15. def __dir__():
  16. return __all__
  17. def __getattr__(name):
  18. if name not in __all__:
  19. raise AttributeError(
  20. "scipy.spatial.kdtree is deprecated and has no attribute "
  21. f"{name}. Try looking in scipy.spatial instead.")
  22. warnings.warn(f"Please use `{name}` from the `scipy.spatial` namespace, "
  23. "the `scipy.spatial.kdtree` namespace is deprecated.",
  24. category=DeprecationWarning, stacklevel=2)
  25. return getattr(_kdtree, name)