You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
401 B
19 lines
401 B
4 years ago
|
# -*- coding: utf-8 -*-
|
||
|
"""Python 2/3 compatibility module."""
|
||
|
import sys
|
||
|
|
||
|
PY2 = int(sys.version[0]) == 2
|
||
|
|
||
|
if PY2:
|
||
|
text_type = unicode # noqa
|
||
|
binary_type = str
|
||
|
string_types = (str, unicode) # noqa
|
||
|
unicode = unicode # noqa
|
||
|
basestring = basestring # noqa
|
||
|
else:
|
||
|
text_type = str
|
||
|
binary_type = bytes
|
||
|
string_types = (str,)
|
||
|
unicode = str
|
||
|
basestring = (str, bytes)
|