diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-12-14 17:59:20 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-12-14 17:59:20 +0000 |
| commit | 76fcd8741a92f6868773f518a846bd18bda91a7a (patch) | |
| tree | 05295c6c48af798d7b329267c8057a4970785b26 | |
| parent | 673f1c46b7c3dbf0494612056fe3c86da9e0dc0a (diff) | |
Python 3.3 support
| -rw-r--r-- | mammoth/__init__.py | 4 | ||||
| -rw-r--r-- | mammoth/lists.py | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/mammoth/__init__.py b/mammoth/__init__.py index 0073664..987226d 100644 --- a/mammoth/__init__.py +++ b/mammoth/__init__.py @@ -1,5 +1,5 @@ from .results import Result -from . import docx, conversion, style_reader +from . import docx, conversion, style_reader, lists def convert_to_html(fileobj): @@ -10,7 +10,7 @@ def convert_to_html(fileobj): def _create_default_styles(): lines = filter(None, map(lambda line: line.strip(), _default_styles.split("\n"))) - return map(style_reader.read_style, lines) + return lists.map(style_reader.read_style, lines) _default_styles = """ p.Heading1 => h1:fresh diff --git a/mammoth/lists.py b/mammoth/lists.py index a1e188e..28889a9 100644 --- a/mammoth/lists.py +++ b/mammoth/lists.py @@ -13,3 +13,11 @@ def _collect(values, result): _collect(value, result) elif value is not None: result.append(value) + + +if sys.version_info[0] == 2: + map = map +else: + import builtins + def map(*args, **kwargs): + return list(builtins.map(*args, **kwargs)) |
