Skip to content

Commit d0f3f77

Browse files
committed
2to3: Apply zip fixer.
In Python 3 zip returns an iterator instead of a list. Consequently, in places where an iterator won't do it must be enclosed in list(...). Lists instead of iterators are also used in array constructors as using iterators there usually results in an object array containing an iterator object. Closes #3094
1 parent 0ea0f78 commit d0f3f77

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

numpydoc/compiler_unparse.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
if sys.version_info[0] >= 3:
1919
from io import StringIO
2020
else:
21-
from io import StringIO
21+
from StringIO import StringIO
2222

2323
def unparse(ast, single_line_functions=False):
2424
s = StringIO()
@@ -106,13 +106,13 @@ def _And(self, t):
106106
if i != len(t.nodes)-1:
107107
self._write(") and (")
108108
self._write(")")
109-
109+
110110
def _AssAttr(self, t):
111111
""" Handle assigning an attribute of an object
112112
"""
113113
self._dispatch(t.expr)
114114
self._write('.'+t.attrname)
115-
115+
116116
def _Assign(self, t):
117117
""" Expression Assignment such as "a = 1".
118118
@@ -150,36 +150,36 @@ def _AssTuple(self, t):
150150
def _AugAssign(self, t):
151151
""" +=,-=,*=,/=,**=, etc. operations
152152
"""
153-
153+
154154
self._fill()
155155
self._dispatch(t.node)
156156
self._write(' '+t.op+' ')
157157
self._dispatch(t.expr)
158158
if not self._do_indent:
159159
self._write(';')
160-
160+
161161
def _Bitand(self, t):
162162
""" Bit and operation.
163163
"""
164-
164+
165165
for i, node in enumerate(t.nodes):
166166
self._write("(")
167167
self._dispatch(node)
168168
self._write(")")
169169
if i != len(t.nodes)-1:
170170
self._write(" & ")
171-
171+
172172
def _Bitor(self, t):
173173
""" Bit or operation
174174
"""
175-
175+
176176
for i, node in enumerate(t.nodes):
177177
self._write("(")
178178
self._dispatch(node)
179179
self._write(")")
180180
if i != len(t.nodes)-1:
181181
self._write(" | ")
182-
182+
183183
def _CallFunc(self, t):
184184
""" Function call.
185185
"""
@@ -254,7 +254,7 @@ def _From(self, t):
254254
self._write(name)
255255
if asname is not None:
256256
self._write(" as "+asname)
257-
257+
258258
def _Function(self, t):
259259
""" Handle function definitions
260260
"""

0 commit comments

Comments
 (0)