my_exceptions.py 962 B

1234567891011121314151617181920212223242526272829303132333435
  1. from sys import version_info
  2. from warnings import warn
  3. from . import _deprecated_my_exceptions
  4. """
  5. Exceptions
  6. """
  7. # Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org >
  8. # Copyright: 2010, Gael Varoquaux
  9. # License: BSD 3 clause
  10. _deprecated_names = [
  11. name for name in dir(_deprecated_my_exceptions) if
  12. not name.startswith("__")
  13. ]
  14. if version_info[:2] >= (3, 7):
  15. def __getattr__(name):
  16. if not name.startswith("__") and name in _deprecated_names:
  17. warn("{} is deprecated and will be removed from joblib "
  18. "in 0.16".format(name), DeprecationWarning)
  19. return getattr(_deprecated_my_exceptions, name)
  20. raise AttributeError
  21. else:
  22. for name in _deprecated_names:
  23. globals()[name] = getattr(_deprecated_my_exceptions, name)
  24. class WorkerInterrupt(Exception):
  25. """ An exception that is not KeyboardInterrupt to allow subprocesses
  26. to be interrupted.
  27. """
  28. pass