trepan/processor/cmdfns.py
def get_int(errmsg, arg, default=1, cmdname=None):
    """If arg is an int, use that otherwise take default."""
    if arg:
        try:
            # eval() is used so we will allow arithmetic expressions,
            # variables etc.
            default = int(eval(arg))
        except (SyntaxError, NameError, ValueError):
            if cmdname:
                errmsg("Command '%s' expects an integer; got: %s." %
                       (cmdname, str(arg)))
            else:
                errmsg('Expecting an integer, got: %s.' % str(arg))
                pass
            raise ValueError
    return default
def get_int(errmsg, arg, default=1, cmdname=None):
    if arg:
        try:
            # eval() is used so we will allow arithmetic expressions,
            # variables etc.
            default = int(eval(arg))
        except (SyntaxError, NameError, ValueError):
            if cmdname:
                errmsg("Command '%s' expects an integer; got: %s." %
                       (cmdname, str(arg)))
            else:
                errmsg('Expecting an integer, got: %s.' % str(arg))
                pass
            raise ValueError
    return default
def get_int ( errmsg , arg , default = 1 , cmdname = None ) : if arg : try : # eval() is used so we will allow arithmetic expressions, # variables etc. default = int ( eval ( arg ) ) except ( SyntaxError , NameError , ValueError ) : if cmdname : errmsg ( "Command '%s' expects an integer; got: %s." % ( cmdname , str ( arg ) ) ) else : errmsg ( 'Expecting an integer, got: %s.' % str ( arg ) ) pass raise ValueError return default
If arg is an int, use that otherwise take default.
If arg is an int use that otherwise take default .