openmedialibrary_platform_w.../Lib/site-packages/PIL/_util.py

31 lines
618 B
Python
Raw Normal View History

2016-01-31 14:44:46 +00:00
import os
2019-01-20 10:35:31 +00:00
import sys
2016-01-31 14:44:46 +00:00
2019-01-20 10:35:31 +00:00
py3 = sys.version_info.major >= 3
if py3:
2016-01-31 14:44:46 +00:00
def isStringType(t):
2019-01-20 10:35:31 +00:00
return isinstance(t, str)
2016-01-31 14:44:46 +00:00
def isPath(f):
2019-01-20 10:35:31 +00:00
return isinstance(f, (bytes, str))
2016-01-31 14:44:46 +00:00
else:
def isStringType(t):
2019-01-20 10:35:31 +00:00
return isinstance(t, basestring) # noqa: F821
2016-01-31 14:44:46 +00:00
def isPath(f):
2019-01-20 10:35:31 +00:00
return isinstance(f, basestring) # noqa: F821
2016-01-31 14:44:46 +00: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)
class deferred_error(object):
def __init__(self, ex):
self.ex = ex
def __getattr__(self, elt):
raise self.ex