def _sort_locations(self, locations):
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>is_find_link = url in self.find_links<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 is_find_link and os.path.isdir(path):<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 and os.path.isdir(path):<EOL><INDENT>urls.append(url)<EOL><DEDENT>elif os.path.isfile(path):<EOL><INDENT>sort_path(path)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>urls.append(url)<EOL><DEDENT><DEDENT>return files, urls<EOL>
Sort locations into "files" (archives) and "urls", and return
a pair of lists (files,urls)