Skip to content

Commit 49e3a3b

Browse files
committed
Fix python 3 compatibility
Fixes GH-9
1 parent 95ebb1f commit 49e3a3b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sourcemap/decoder.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222

2323
__all__ = ('SourceMapDecoder',)
2424

25-
# True if we are running on Python 3.
26-
PY3 = sys.version_info[0] == 3
27-
text_type = str if PY3 else unicode
25+
if sys.version_info[0] == 2:
26+
from itertools import imap as map
27+
text_type = unicode
28+
else:
29+
text_type = str
2830

2931

3032
class SourceMapDecoder(object):
@@ -115,7 +117,7 @@ def decode(self, source):
115117
lines = mappings.split(';')
116118

117119
if sourceRoot is not None:
118-
sources = map(partial(os.path.join, sourceRoot), sources)
120+
sources = list(map(partial(os.path.join, sourceRoot), sources))
119121

120122
# List of all tokens
121123
tokens = []

0 commit comments

Comments
 (0)