1# -*- coding: utf-8 -*- 2""" 3markupsafe._compat 4~~~~~~~~~~~~~~~~~~ 5 6:copyright: 2010 Pallets 7:license: BSD-3-Clause 8""" 9import sys 10 11PY2 = sys.version_info[0] == 2 12 13if not PY2: 14 text_type = str 15 string_types = (str,) 16 unichr = chr 17 int_types = (int,) 18 19 def iteritems(x): 20 return iter(x.items()) 21 22 from collections.abc import Mapping 23 24else: 25 text_type = unicode 26 string_types = (str, unicode) 27 unichr = unichr 28 int_types = (int, long) 29 30 def iteritems(x): 31 return x.iteritems() 32 33 from collections import Mapping 34