mirror of
https://github.com/kennethreitz/tablib.git
synced 2026-06-05 15:00:19 +00:00
52 lines
1019 B
Python
52 lines
1019 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
tablib.compat
|
|
~~~~~~~~~~~~~
|
|
|
|
Tablib compatiblity module.
|
|
|
|
"""
|
|
|
|
import sys
|
|
|
|
is_py3 = (sys.version_info[0] > 2)
|
|
|
|
|
|
|
|
try:
|
|
from collections import OrderedDict
|
|
except ImportError:
|
|
from tablib.packages.ordereddict import OrderedDict
|
|
|
|
|
|
if is_py3:
|
|
from io import BytesIO
|
|
import tablib.packages.xlwt3 as xlwt
|
|
from tablib.packages import markup3 as markup
|
|
from tablib.packages import openpyxl3 as openpyxl
|
|
from tablib.packages.odf3 import opendocument, style, text, table
|
|
|
|
# py3 mappings
|
|
ifilter = filter
|
|
xrange = range
|
|
unicode = str
|
|
bytes = bytes
|
|
basestring = str
|
|
|
|
else:
|
|
from cStringIO import StringIO as BytesIO
|
|
import tablib.packages.xlwt as xlwt
|
|
from tablib.packages import markup
|
|
from itertools import ifilter
|
|
from tablib.packages import openpyxl
|
|
from tablib.packages.odf import opendocument, style, text, table
|
|
|
|
# py2 mappings
|
|
xrange = xrange
|
|
unicode = unicode
|
|
bytes = str
|
|
basestring = basestring
|
|
|
|
|