diff options
Diffstat (limited to 'tablib/core.py')
| -rw-r--r-- | tablib/core.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tablib/core.py b/tablib/core.py index 896dfcc..4cef83c 100644 --- a/tablib/core.py +++ b/tablib/core.py @@ -13,12 +13,9 @@ from copy import copy from operator import itemgetter from tablib import formats -import collections -try: - from collections import OrderedDict -except ImportError: - from tablib.packages.ordereddict import OrderedDict + +from tablib.compat import OrderedDict __title__ = 'tablib' @@ -278,7 +275,8 @@ class Dataset(object): else: header = [] - if len(col) == 1 and isinstance(col[0], collections.Callable): + if len(col) == 1 and hasattr(col[0], '__call__'): + col = list(map(col[0], self._data)) col = tuple(header + col) @@ -549,7 +547,7 @@ class Dataset(object): col = list(col) # Callable Columns... - if len(col) == 1 and isinstance(col[0], collections.Callable): + if len(col) == 1 and hasattr(col[0], '__call__'): col = list(map(col[0], self._data)) col = self._clean_col(col) @@ -795,7 +793,7 @@ def import_set(stream): format.import_set(data, stream) return data - except AttributeError as e: + except AttributeError: return None |
