示例#1
0
文件: logging.py 项目: rjnw/pycket
def make_logger(args):
    parser = ArgParser("make-logger", args)

    topic           = values.w_false
    parent          = values.w_false
    propagate_level = DEBUG

    try:
        topic           = parser.symbol_or_false()
        parent          = parser.logger_or_false()
        propagate_level = parser.log_level()
    except EndOfInput:
        pass

    # Any remaining arguments are propagate topics
    propagate_topic = parser._symbol_or_false()

    return values.W_Logger(topic, parent, propagate_level, propagate_topic)
示例#2
0
文件: control.py 项目: uternet/pycket
def call_with_continuation_prompt(args, env, cont):
    if len(args) < 1:
        raise SchemeException("call-with-continuation-prompt: not given enough values")
    parser  = ArgParser("call-with-continuation-prompt", args)
    tag     = values.w_default_continuation_prompt_tag
    handler = default_continuation_prompt_handler
    fun     = parser.object()

    try:
        tag     = parser.prompt_tag()
        handler = parser.object()
    except EndOfInput:
        pass

    args = parser._object()
    if not fun.iscallable():
        raise SchemeException("call-with-continuation-prompt: not given callable function")
    if not handler.iscallable():
        raise SchemeException("call-with-continuation-prompt: not given callable handler")
    cont = Prompt(tag, handler, env, cont)
    return fun.call(args, env, cont)