attrs/attr/_compat.py

29 lines
561 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import sys
PY3 = sys.version_info[0] == 3
2015-01-29 19:50:42 +00:00
PY2 = sys.version_info[0] == 2
if PY2:
# TYPE is used in exceptions, repr(int) is differnt on Python 2 and 3.
TYPE = "type"
def exec_(code, locals_, globals_):
exec("exec code in locals_, globals_")
2015-01-29 19:50:42 +00:00
def iteritems(d):
return d.iteritems()
else:
2015-01-29 19:50:42 +00:00
TYPE = "class"
def exec_(code, locals_, globals_):
exec(code, locals_, globals_)
2015-01-29 19:50:42 +00:00
def iteritems(d):
return d.items()