Pillow/PIL/_util.py

28 lines
553 B
Python
Raw Normal View History

2013-07-25 20:25:18 +04:00
import os
2013-06-30 22:50:38 +04:00
if bytes is str:
def isStringType(t):
return isinstance(t, basestring)
2014-07-06 02:50:24 +04:00
2013-06-30 22:50:38 +04:00
def isPath(f):
return isinstance(f, basestring)
else:
def isStringType(t):
return isinstance(t, str)
2014-07-06 02:50:24 +04:00
2013-06-30 22:50:38 +04:00
def isPath(f):
return isinstance(f, (bytes, str))
2014-07-06 02:50:24 +04:00
2013-06-30 22:50:38 +04:00
# Checks if an object is a string, and that it points to a directory.
def isDirectory(f):
return isPath(f) and os.path.isdir(f)
2014-04-03 07:09:04 +04:00
2014-07-06 02:50:24 +04:00
class deferred_error(object):
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