try:
if OS.getenv('TRIPE_FORCE_RMCR') is not None:
- raise ImportError
+ raise ImportError()
from py.magic import greenlet as _Coroutine
except ImportError:
from rmcr import Coroutine as _Coroutine
"""
me.dcr = Coroutine.getcurrent().parent
if me.dcr is None:
- raise ValueError, 'must invoke from coroutine'
+ raise ValueError('must invoke from coroutine')
me.filter = filter or (lambda x: x)
if bg:
words = [words[0], '-background', dispatcher.bgtag()] + list(words[1:])
if code == 'INFO':
return me.filter(rest)
elif code == 'OK':
- raise StopIteration
+ raise StopIteration()
elif code == 'CONNERR':
if rest is None:
- raise TripeConnectionError, 'connection terminated by user'
+ raise TripeConnectionError('connection terminated by user')
else:
raise rest
elif code == 'FAIL':
raise TripeError(*rest)
else:
- raise TripeInternalError \
- ('unexpected tripe response %r' % ([code] + rest))
+ raise TripeInternalError('unexpected tripe response %r' %
+ ([code] + rest))
### Simple utility functions for the TripeCommandIterator convenience
### methods.
"""
if (me.min is not None and len(args) < me.min) or \
(me.max is not None and len(args) > me.max):
- raise TripeSyntaxError
+ raise TripeSyntaxError()
me.func(*args)
class TripeServiceJob (Coroutine):
if len(me.args) == 0 or \
len(me.args[0]) < 2 or \
not me.args[0].startswith('-'):
- raise StopIteration
+ raise StopIteration()
opt = me.args.pop(0)
if opt == '--':
- raise StopIteration
+ raise StopIteration()
if opt not in me.allowed:
- raise TripeSyntaxError
+ raise TripeSyntaxError()
return opt
def arg(me):
If none is available, raise `TripeSyntaxError'.
"""
if len(me.args) == 0:
- raise TripeSyntaxError
+ raise TripeSyntaxError()
return me.args.pop(0)
def rest(me, min = None, max = None):
"""
if (min is not None and len(me.args) < min) or \
(max is not None and len(me.args) > max):
- raise TripeSyntaxError
+ raise TripeSyntaxError()
return me.args
###----- That's all, folks --------------------------------------------------