@staticmethod<EOL><INDENT>def _sort_locations(locations, expand_dir=False):<EOL><DEDENT>
files = []<EOL>urls = []<EOL>def sort_path(path):<EOL><INDENT>url = path_to_url(path)<EOL>if mimetypes.guess_type(url, strict=False)[<NUM_LIT:0>] == '<STR_LIT>':<EOL><INDENT>urls.append(url)<EOL><DEDENT>else:<EOL><INDENT>files.append(url)<EOL><DEDENT><DEDENT>for url in locations:<EOL><INDENT>is_local_path = os.path.exists(url)<EOL>is_file_url = url.startswith('<STR_LIT>')<EOL>if is_local_path or is_file_url:<EOL><INDENT>if is_local_path:<EOL><INDENT>path = url<EOL><DEDENT>else:<EOL><INDENT>path = url_to_path(url)<EOL><DEDENT>if os.path.isdir(path):<EOL><INDENT>if expand_dir:<EOL><INDENT>path = os.path.realpath(path)<EOL>for item in os.listdir(path):<EOL><INDENT>sort_path(os.path.join(path, item))<EOL><DEDENT><DEDENT>elif is_file_url:<EOL><INDENT>urls.append(url)<EOL><DEDENT>else:<EOL><INDENT>logger.warning(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(path),<EOL>)<EOL><DEDENT><DEDENT>elif os.path.isfile(path):<EOL><INDENT>sort_path(path)<EOL><DEDENT>else:<EOL><INDENT>logger.warning(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>", url,<EOL>)<EOL><DEDENT><DEDENT>elif is_url(url):<EOL><INDENT>urls.append(url)<EOL><DEDENT>else:<EOL><INDENT>logger.warning(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>", url,<EOL>)<EOL><DEDENT><DEDENT>return files, urls<EOL>
Sort locations into "files" (archives) and "urls", and return
a pair of lists (files,urls)