mirror of https://github.com/cowrie/cowrie.git
iterator that works on python 2 and 3 (#1111)
This commit is contained in:
parent
d5ca8321e4
commit
25eba0aab0
|
@ -307,12 +307,15 @@ class shlex:
|
|||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def next(self):
|
||||
def __next__(self):
|
||||
token = self.get_token()
|
||||
if token == self.eof:
|
||||
raise StopIteration
|
||||
return token
|
||||
|
||||
# For Python 2.x
|
||||
next = __next__
|
||||
|
||||
|
||||
def split(s, comments=False, posix=True):
|
||||
lex = shlex(s, posix=posix)
|
||||
|
|
Loading…
Reference in New Issue