예제 #1
0
def comparison(
    comparator: ComparisonOperator,
    rhs: IntegerMatcherArg,
) -> IntegerMatcherArg:
    return args.SequenceOfArguments([
        args.Singleton(comparator.name),
        rhs,
    ])
예제 #2
0
def _arguments(path: PathArgument,
               matcher: ArgumentElementsRenderer,
               ) -> ArgumentElementsRenderer:
    return arg_rends.SequenceOfArguments([
        path,
        arg_rends.Singleton(reserved_words.COLON),
        matcher,
    ])
예제 #3
0
def comparison2(
    comparator: ComparisonOperator,
    rhs: int,
) -> IntegerMatcherArg:
    return args.SequenceOfArguments([
        args.Singleton(comparator.name),
        args.Singleton(str(rhs)),
    ])
예제 #4
0
def program_followed_by_transformation(
        program_wo_transformation: ArgumentElementsRenderer,
        transformation: ArgumentElementsRenderer) -> ArgumentElementsRenderer:
    return primitive_ab.SeparatedByNewLine(
        program_wo_transformation,
        primitive_ab.SequenceOfArguments([
            ab.option(WITH_TRANSFORMED_CONTENTS_OPTION_NAME),
            transformation,
        ]))
예제 #5
0
def recursive(path: PathArgument,
              files_matcher: MatcherArgument,
              recursion_options: ArgumentElementsRenderer
              = RECURSION_OPTION_ARG,
              ) -> ArgumentElementsRenderer:
    return _arguments(
        path,
        arg_rends.SequenceOfArguments([recursion_options, files_matcher]),
    )
예제 #6
0
 def elements(self) -> List[WithToString]:
     render = args_rend.SequenceOfArguments([
         args_rend.OptionArgument(str_src_defs.FILE_OPTION),
         self.file,
     ])
     return render.elements
예제 #7
0
def within_paren(expression: ArgumentElementsRenderer) -> ArgumentElementsRenderer:
    return arg_r.SequenceOfArguments([
        arg_r.Singleton('('),
        expression,
        arg_r.Singleton(')'),
    ])
예제 #8
0
def sequence__r(arguments: Sequence[ArgumentElementsRenderer]) -> ArgumentElementsRenderer:
    return arg_r.SequenceOfArguments(arguments)
예제 #9
0
def copy(
    src: PathArgument,
    dst: Optional[PathArgument] = None,
) -> ArgumentElementsRenderer:
    return (src if dst is None else argument_renderer.SequenceOfArguments(
        [src, dst]))