summaryrefslogtreecommitdiff
path: root/lib/python2.7/site-packages/south/utils/py3.py
blob: 732e9043a8d2bc99627f7643ac127923d7df3771 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Python 2 + 3 compatibility functions. This is a very small subset of six.
"""

import sys

PY3 = sys.version_info[0] == 3

if PY3:
    string_types = str,
    text_type = str
    raw_input = input

    import io
    StringIO = io.StringIO

else:
    string_types = basestring,
    text_type = unicode
    raw_input = raw_input

    import cStringIO
    StringIO = cStringIO.StringIO


def with_metaclass(meta, base=object):
    """Create a base class with a metaclass."""
    return meta("NewBase", (base,), {})