Пример #1
0
def _find_variable_command(variable_name):
    """When a command is entered that doesn't match any existing command it
    might be a variable name in which case we should call typlot with that
    variable as the first argument."""
    def call_typlot(*args, **kwargs):
        args = list(args)
        args.insert(0, variable_name)
        typlot(*args, **kwargs)
    call_typlot.__name__ = typlot.__name__
    call_typlot.__doc__ = typlot.__doc__

    var = blot_common.find_variable(state.reader, variable_name)
    if var: return call_typlot
    return None
Пример #2
0
def _find_variable_command(variable_name):
    """When a command is entered that doesn't match any existing command it
    might be a variable name in which case we should call typlot with that
    variable as the first argument."""
    def call_typlot(*args, **kwargs):
        args = list(args)
        args.insert(0, variable_name)
        typlot(*args, **kwargs)

    call_typlot.__name__ = typlot.__name__
    call_typlot.__doc__ = typlot.__doc__

    var = blot_common.find_variable(state.reader, variable_name)
    if var: return call_typlot
    return None
Пример #3
0
def _find_variable_or_raise_exception(reader, name):
    """Returns a valid blot_common.Variable instance or raises a BlotishError."""
    var = blot_common.find_variable(reader, name)
    if not var:
        raise BlotishError("'%s' is an invalid variable name" % name)
    return var
Пример #4
0
def _find_variable_or_raise_exception(reader, name):
    """Returns a valid blot_common.Variable instance or raises a BlotishError."""
    var = blot_common.find_variable(reader, name)
    if not var:
        raise BlotishError("'%s' is an invalid variable name" % name)
    return var