_util.py 359 B

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