def _get_file_by_alias(part, files):
    """ Given a command part, find the file it represents. If not found,
    then returns a new token representing that file.
    :throws ValueError: if the value is not a command file alias.
    """
    # Make Output
    if _is_output(part):
        return Output.from_string(part.pop())

    # Search/Make Input
    else:
        inputs = [[]]

        if part.magic_or:
            and_or = 'or'
        else:
            and_or = 'and'

        for cut in part.asList():
            if cut == OR_TOKEN:
                inputs.append([])
                continue
            if cut == AND_TOKEN:
                continue

            input = Input(cut, filename=cut, and_or=and_or)
            for file in files:
                if file.alias == cut:
                    # Override the filename
                    input.filename = file.filename
                    inputs[-1].append(input)
                    break
            else:
                inputs[-1].append(input)


        return [input for input in inputs if input]
def _get_file_by_alias ( part , files ) : if _is_output ( part ) : return Output . from_string ( part . pop ( ) ) else : inputs = [ [ ] ] if part . magic_or : and_or = 'or' else : and_or = 'and' for cut in part . asList ( ) : if cut == OR_TOKEN : inputs . append ( [ ] ) continue if cut == AND_TOKEN : continue input = Input ( cut , filename = cut , and_or = and_or ) for file in files : if file . alias == cut : input . filename = file . filename inputs [ - 1 ] . append ( input ) break else : inputs [ - 1 ] . append ( input ) return [ input for input in inputs if input ]
Given a command part, find the file it represents. If not found,
    then returns a new token representing that file.
    :throws ValueError: if the value is not a command file alias.