def _get_all_files(filename_regex,<EOL>path,<EOL>base_dir,<EOL>excluded_paths=None,<EOL>excluded_filename_regex=None):
<EOL>def replace_backslashes(string):<EOL><INDENT>return string.replace('<STR_LIT:\\>', '<STR_LIT:/>')<EOL><DEDENT>excluded_paths = _normalize_excluded_paths(base_dir, excluded_paths)<EOL>if excluded_paths:<EOL><INDENT>logger.info('<STR_LIT>', excluded_paths)<EOL><DEDENT>logger.info('<STR_LIT>',<EOL>filename_regex, os.path.join(base_dir, path))<EOL>if excluded_filename_regex:<EOL><INDENT>logger.info('<STR_LIT>', excluded_filename_regex)<EOL><DEDENT>path_expression = re.compile(replace_backslashes(path))<EOL>target_files = []<EOL>for root, _, files in os.walk(base_dir):<EOL><INDENT>if not root.startswith(tuple(excluded_paths))and path_expression.search(replace_backslashes(root)):<EOL><INDENT>for filename in files:<EOL><INDENT>filepath = os.path.join(root, filename)<EOL>is_file, matched, excluded_filename, excluded_path =_set_match_parameters(<EOL>filename,<EOL>filepath,<EOL>filename_regex,<EOL>excluded_filename_regex,<EOL>excluded_paths)<EOL>if is_file and matched and not excluded_filenameand not excluded_path:<EOL><INDENT>logger.debug('<STR_LIT>',<EOL>filepath)<EOL>target_files.append(filepath)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return target_files<EOL>
Get all files for processing.

    This starts iterating from `base_dir` and checks for all files
    that look like `filename_regex` under `path` regex excluding
    all paths under the `excluded_paths` list, whether they are files
    or folders. `excluded_paths` are explicit paths, not regex.
    `excluded_filename_regex` are files to be excluded as well.