_util.py 369 B

12345678910111213141516171819
  1. import os
  2. from pathlib import Path
  3. def is_path(f):
  4. return isinstance(f, (bytes, str, Path))
  5. def is_directory(f):
  6. """Checks if an object is a string, and that it points to a directory."""
  7. return is_path(f) and os.path.isdir(f)
  8. class DeferredError:
  9. def __init__(self, ex):
  10. self.ex = ex
  11. def __getattr__(self, elt):
  12. raise self.ex