Meshroom/meshroom/core/pyCompatibility.py
Karthikeyan Singaravelan 165ba412e4
Import ABC from collections.abc (#983)
Use compatibility layer for Python 2 support
2020-07-16 16:02:51 +02:00

22 lines
531 B
Python

try:
unicode = unicode
except NameError:
# 'unicode' is undefined, must be Python 3
str = str
unicode = str
bytes = bytes
basestring = (str, bytes)
else:
# 'unicode' exists, must be Python 2
str = str
unicode = unicode
bytes = str
basestring = basestring
try:
# Import ABC from collections.abc in Python 3.4+
from collections.abc import Sequence, Iterable
except ImportError:
# Import ABC from collections in Python 2 support
from collections import Sequence, Iterable