openmedialibrary_platform_d.../lib/python3.7/site-packages/PIL/_util.py

31 lines
590 B
Python
Raw Normal View History

2016-02-06 09:36:57 +00:00
import os
2018-12-31 23:25:26 +00:00
import sys
2016-02-06 09:36:57 +00:00
2018-12-31 23:25:26 +00:00
py3 = sys.version_info.major >= 3
if py3:
2016-02-06 09:36:57 +00:00
def isStringType(t):
2018-12-31 23:25:26 +00:00
return isinstance(t, str)
2016-02-06 09:36:57 +00:00
def isPath(f):
2018-12-31 23:25:26 +00:00
return isinstance(f, (bytes, str))
2016-02-06 09:36:57 +00:00
else:
def isStringType(t):
2018-12-31 23:25:26 +00:00
return isinstance(t, basestring)
2016-02-06 09:36:57 +00:00
def isPath(f):
2018-12-31 23:25:26 +00:00
return isinstance(f, basestring)
2016-02-06 09:36:57 +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