def _always_decorator(func):
     if not isinstance(func, FunctionType):
         raise AlwaysError(_error.ArgType)
     if _isGenFunc(func):
         raise AlwaysError(_error.ArgType)
     if func.__code__.co_argcount > 0:
         raise AlwaysError(_error.NrOfArgs)
     return _Always(func, args, callinfo=callinfo, sigdict=sigdict)
Example #2
0
 def _always_decorator(func):
     if not isinstance(func, FunctionType):
         raise AlwaysError(_error.ArgType)
     if _isGenFunc(func):
         raise AlwaysError(_error.ArgType)
     if func.func_code.co_argcount > 0:
         raise AlwaysError(_error.NrOfArgs)
     return _Always(func, args)
def always(*args):
    callinfo = _getCallInfo()
    sigargs = []
    for arg in args:
        if isinstance(arg, _Signal):
            arg._read = True
            arg._used = True
            sigargs.append(arg)
        elif isinstance(arg, _WaiterList):
            arg.sig._read = True
            arg.sig._used = True
            sigargs.append(arg.sig)
        elif not isinstance(arg, delay):
            raise AlwaysError(_error.DecArgType)
    sigdict = _get_sigdict(sigargs, callinfo.symdict)

    def _always_decorator(func):
        if not isinstance(func, FunctionType):
            raise AlwaysError(_error.ArgType)
        if _isGenFunc(func):
            raise AlwaysError(_error.ArgType)
        if func.__code__.co_argcount > 0:
            raise AlwaysError(_error.NrOfArgs)
        return _Always(func, args, callinfo=callinfo, sigdict=sigdict)

    return _always_decorator
Example #4
0
def always(*args):
    for arg in args:
        if isinstance(arg, _Signal):
            arg._read = True
            arg._used = True
        elif isinstance(arg, _WaiterList):
            arg.sig._read = True
            arg.sig._used = True
        elif not isinstance(arg, delay):
            raise AlwaysError(_error.DecArgType)

    def _always_decorator(func):
        if not isinstance(func, FunctionType):
            raise AlwaysError(_error.ArgType)
        if _isGenFunc(func):
            raise AlwaysError(_error.ArgType)
        if func.__code__.co_argcount > 0:
            raise AlwaysError(_error.NrOfArgs)
        return _Always(func, args)

    return _always_decorator