aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/MarkupSafe/py2/markupsafe/_compat.py
blob: bc05090f9e88da2c16a75844bcb6d5043025581b (plain) (blame)
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
29
30
31
32
33
# -*- coding: utf-8 -*-
"""
markupsafe._compat
~~~~~~~~~~~~~~~~~~

:copyright: 2010 Pallets
:license: BSD-3-Clause
"""
import sys

PY2 = sys.version_info[0] == 2

if not PY2:
    text_type = str
    string_types = (str,)
    unichr = chr
    int_types = (int,)

    def iteritems(x):
        return iter(x.items())

    from collections.abc import Mapping

else:
    text_type = unicode
    string_types = (str, unicode)
    unichr = unichr
    int_types = (int, long)

    def iteritems(x):
        return x.iteritems()

    from collections import Mapping