def prepare():
"""Prepare tagger for run.
This should be after installation to initialize tagger's resources.
"""
import nltk
import requests
from libarchive import extract_memory
import os
from shutil import move
from f8a_tagger.utils import get_files_dir
nltk.download("punkt")
nltk.download("wordnet")
maven_index_checker_url = 'https://github.com/fabric8-analytics/' \
'maven-index-checker/files/1275145/' \
'maven-index-checker-v0.1-alpha.zip'
response = requests.get(maven_index_checker_url)
if response.ok is not True:
raise RemoteDependencyMissingError("Failed to download maven-index-checker with "
"response code %s",
response.status_code)
# Unfortunately no way how to know name or path of extracted file,
# so assume it's maven-index-checker.jar
jar_name = "maven-index-checker.jar"
jar_path = get_files_dir()
extract_memory(response.content)
move(jar_name, os.path.join(jar_path, jar_name))
__init__.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录