def download_and_install_dependencies():
try:<EOL><INDENT>import requests<EOL><DEDENT>except ImportError:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>dependencies = {"<STR_LIT>": HMM_URL}<EOL>if sys.platform.startswith("<STR_LIT>") or "<STR_LIT>" in sys.platform:<EOL><INDENT>dependencies["<STR_LIT>"] = "<STR_LIT>".format(BASE_PRODIGAL)<EOL>dependencies["<STR_LIT>"] = (<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>elif sys.platform == "<STR_LIT>":<EOL><INDENT>dependencies["<STR_LIT>"] = "<STR_LIT>".format(BASE_PRODIGAL)<EOL>dependencies["<STR_LIT>"] = (<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>elif sys.platform.startswith("<STR_LIT>") or sys.platform == "<STR_LIT>":<EOL><INDENT>dependencies["<STR_LIT>"] = "<STR_LIT>"<EOL>dependencies["<STR_LIT>"] = (<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError(<EOL>"<STR_LIT>".format(sys.platform)<EOL>)<EOL><DEDENT>cache_dir = pathlib.Path.cwd() / pathlib.Path("<STR_LIT>")<EOL>try:<EOL><INDENT>print("<STR_LIT>")<EOL>cache_dir.mkdir()<EOL>for dependency_name, url in dependencies.items():<EOL><INDENT>print("<STR_LIT>".format(dependency_name, url))<EOL>request = requests.get(url)<EOL>basename = url.split("<STR_LIT:/>")[-<NUM_LIT:1>]<EOL>with open(cache_dir / basename, "<STR_LIT:wb>") as handle:<EOL><INDENT>print(dependency_name, basename, cache_dir / basename)<EOL>handle.write(request.content)<EOL><DEDENT><DEDENT><DEDENT>except FileExistsError:<EOL><INDENT>print("<STR_LIT>")<EOL><DEDENT>share_dir = pathlib.Path.cwd()<EOL>tools_dir = share_dir / "<STR_LIT>"<EOL>louvain_dir = tools_dir / "<STR_LIT>"<EOL>louvain_dir.mkdir(parents=True, exist_ok=True)<EOL>louvain_basename = dependencies["<STR_LIT>"].split("<STR_LIT:/>")[-<NUM_LIT:1>]<EOL>louvain_path = louvain_dir / louvain_basename<EOL>(cache_dir / louvain_basename).replace(louvain_path)<EOL>with tarfile.open(louvain_path, "<STR_LIT>") as tar:<EOL><INDENT>tar.extractall()<EOL><DEDENT>hmm_basename = dependencies["<STR_LIT>"].split("<STR_LIT:/>")[-<NUM_LIT:1>]<EOL>hmm_path = share_dir / hmm_basename<EOL>(cache_dir / hmm_basename).replace(hmm_path)<EOL>prodigal_basename = dependencies["<STR_LIT>"].split("<STR_LIT:/>")[-<NUM_LIT:1>]<EOL>prodigal_path = tools_dir / "<STR_LIT>"<EOL>(cache_dir / prodigal_basename).replace(prodigal_path)<EOL>
Setup URLS and download dependencies for Python 3.6+