Skip to content

Commit 8189da3

Browse files
committed
Fixed aliasing of next to __next__ and raw_input for IPython
1 parent dcb2b0f commit 8189da3

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

lancet/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class is designed to launch commands on Sun Grid Engine clusters.
5252

5353
__version__ = "2013.11.2"
5454

55-
import os, subprocess
55+
import os, sys, subprocess
5656
import param
5757

5858
from lancet.core import * # pyflakes:ignore (appropriate import)
@@ -133,6 +133,10 @@ def load_ipython_extension(ip):
133133
global _loaded
134134
if not _loaded:
135135
_loaded = True
136+
from lancet import launch
137+
if sys.version_info[0] == 2:
138+
launch.input = lambda *args, **kwargs: raw_input(*args, **kwargs)
139+
136140
plaintext_formatter = ip.display_formatter.formatters['text/plain']
137141
plaintext_formatter.for_type(Args, repr_pretty_annotated)
138142
plaintext_formatter.for_type(Command, repr_pretty_unannotated)

lancet/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ def __next__(self):
185185
"""
186186
raise StopIteration
187187

188-
# Python 2 support
189188
next = __next__
190189

191190
def copy(self):
@@ -332,6 +331,8 @@ def __next__(self):
332331
self._exhausted=True
333332
return self.specs
334333

334+
next = __next__
335+
335336
def _unique(self, sequence, idfun=repr):
336337
"""
337338
Note: repr() must be implemented properly on all objects. This

lancet/dynamic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ def __next__(self):
7474
self._next_val = StopIteration
7575
return current_val
7676

77-
# Python 2 support
7877
next = __next__
7978

8079

@@ -319,7 +318,6 @@ def __next__(self):
319318
else:
320319
return next(self.second)
321320

322-
# Python 2 support
323321
next = __next__
324322

325323

@@ -364,3 +362,4 @@ def __next__(self):
364362
else:
365363
second_spec = next(self.second)
366364
return self._cartesian_product(self._first_cached, second_spec)
365+
next = __next__

0 commit comments

Comments
 (0)