Skip to content

Commit

Permalink
MAINT: Cleanup python2 references
Browse files Browse the repository at this point in the history
  • Loading branch information
sethtroisi committed Jan 21, 2020
1 parent 19b96a1 commit 1383d5e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
17 changes: 2 additions & 15 deletions numpy/core/tests/test_mem_overlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ def _indices_for_axis():
res = []
for nelems in (0, 2, 3):
ind = _indices_for_nelems(nelems)

# no itertools.product available in Py2.4
res.extend([(a, b) for a in ind for b in ind]) # all assignments of size "nelems"
res.extend(itertools.product(ind, ind)) # all assignments of size "nelems"

return res

Expand All @@ -53,18 +51,7 @@ def _indices(ndims):
"""Returns ((axis0_src, axis0_dst), (axis1_src, axis1_dst), ... ) index pairs."""

ind = _indices_for_axis()

# no itertools.product available in Py2.4

res = [[]]
for i in range(ndims):
newres = []
for elem in ind:
for others in res:
newres.append([elem] + others)
res = newres

return res
return itertools.product(ind, repeat=ndims)


def _check_assignment(srcidx, dstidx):
Expand Down
5 changes: 1 addition & 4 deletions numpy/core/tests/test_scalarprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ def userinput():
orig_stdout, orig_stderr = sys.stdout, sys.stderr
sys.stdout, sys.stderr = fo, fe

# py2 code.interact sends irrelevant internal DeprecationWarnings
with suppress_warnings() as sup:
sup.filter(DeprecationWarning)
code.interact(local={'np': np}, readfunc=input_func, banner='')
code.interact(local={'np': np}, readfunc=input_func, banner='')

sys.stdout, sys.stderr = orig_stdout, orig_stderr

Expand Down
2 changes: 1 addition & 1 deletion numpy/lib/npyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ def savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='',
delimiter = asstr(delimiter)

class WriteWrap:
"""Convert to unicode in py2 or to bytes on bytestream inputs.
"""Convert to bytes on bytestream inputs.
"""
def __init__(self, fh, encoding):
Expand Down

0 comments on commit 1383d5e

Please sign in to comment.