Skip to content

Commit 340c39c

Browse files
committed
futurize stage 2
1 parent ea5b46e commit 340c39c

4 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/bd2k/util/d32.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
# Inspired by Dominic Tarr's JavaScript at https://github.com/dominictarr/d64
2020

21-
from builtins import str
2221
from builtins import range
2322
from builtins import object
2423
from past.utils import old_div
@@ -109,7 +108,7 @@ def decode( self, e ):
109108
d[ i + 4 ] = g[ 6 ] << 5 & 255 | g[ 7 ]
110109
j += 8
111110
i += 5
112-
return bytes( d[ :-padding ] )
111+
return str( d[ :-padding ] )
113112

114113

115114
# A variant of Base64 that maintains the lexicographical ordering such that for any given list of

src/bd2k/util/d64.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222

2323

24-
from builtins import str
2524
from builtins import range
2625
from builtins import object
2726
from past.utils import old_div
@@ -116,7 +115,7 @@ def decode( self, e ):
116115
j += 1
117116
else:
118117
assert False
119-
return bytes( b )
118+
return str( b )
120119

121120

122121
standard = D64( '._' )

src/bd2k/util/hashes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def hash_json( hash_obj, value ):
6161
ValueError: Type <type 'object'> is not supported
6262
"""
6363
try:
64-
items = iter(value.items( ))
64+
items = iter(list(value.items( )))
6565
except AttributeError:
6666
# Must check for string before testing iterability since strings are iterable
6767
if isinstance( value, basestring ):

src/bd2k/util/iterables.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def common_prefix( xs, ys ):
2525
>>> list( common_prefix('A','B') )
2626
[]
2727
"""
28-
return map( lambda x_y: x_y[0], takewhile( lambda a_b: a_b[0] == a_b[1], zip( xs, ys ) ) )
28+
return [x_y[0] for x_y in takewhile( lambda a_b: a_b[0] == a_b[1], list(zip( xs, ys )) )]
2929

3030

3131
def disparate_suffix( xs, ys ):
@@ -128,7 +128,7 @@ def expand( x ):
128128
i = x,
129129
return i
130130

131-
return flatten( map( expand, self.args ) )
131+
return flatten( list(map( expand, self.args )) )
132132

133133

134134
# noinspection PyPep8Naming
@@ -173,4 +173,4 @@ def expand( x ):
173173
except AttributeError:
174174
return x,
175175

176-
return flatten( map( expand, self.iterables ) )
176+
return flatten( list(map( expand, self.iterables )) )

0 commit comments

Comments
 (0)