예제 #1
0
def color(parser, token):
    args = token.split_contents()
    is_simple = len(args) == 2
    is_complex = len(args) == 4 and args[2] == 'in'
    is_valid = is_simple or is_complex
    validate_param_number(is_valid, args[0], "one or three arguments")
    return ColorNode(args[1], args[3] if is_complex else None)
예제 #2
0
파일: console.py 프로젝트: ambv/kitdjango
def color(parser, token):
    args = token.split_contents()
    is_simple = len(args) == 2
    is_complex = len(args) == 4 and  args[2] == 'in'
    is_valid = is_simple or is_complex
    validate_param_number(is_valid, args[0], "one or three arguments")
    return ColorNode(args[1], args[3] if is_complex else None)
예제 #3
0
def _set(parser, token):
    args = token.split_contents()
    is_valid = len(args) == 3
    validate_param_number(is_valid, args[0], "two arguments")
    return SetNode(args[1], args[2])
예제 #4
0
def incr(parser, token):
    args = token.split_contents()
    is_valid = len(args) == 2
    validate_param_number(is_valid, args[0], "one argument")
    return IncrNode(args[1])
예제 #5
0
파일: git.py 프로젝트: ambv/kitdjango
def git_version(parser, token):
    args = token.split_contents()
    is_valid = len(args) == 1
    validate_param_number(is_valid, args[0], "no arguments")
    return GitVersionNode()