Pillow/src/PIL/_util.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
405 B
Python
Raw Normal View History

from __future__ import annotations
2018-06-13 12:44:36 +03:00
import os
2020-08-11 22:29:44 +03:00
from pathlib import Path
2013-07-25 20:25:18 +04:00
2018-04-20 02:19:13 +03:00
def is_path(f):
2020-08-11 22:29:44 +03:00
return isinstance(f, (bytes, str, Path))
2013-06-30 22:50:38 +04:00
2014-07-06 02:50:24 +04:00
def is_directory(f):
"""Checks if an object is a string, and that it points to a directory."""
return is_path(f) and os.path.isdir(f)
2014-04-03 07:09:04 +04:00
2014-07-06 02:50:24 +04:00
class DeferredError:
def __init__(self, ex):
self.ex = ex
2014-07-06 02:50:24 +04:00
2014-04-03 07:09:04 +04:00
def __getattr__(self, elt):
raise self.ex