コード例 #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)
コード例 #3
0
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)
コード例 #4
0
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)