本文整理汇总了Python中utilstest.UtilsTest.download_images方法的典型用法代码示例。如果您正苦于以下问题:Python UtilsTest.download_images方法的具体用法?Python UtilsTest.download_images怎么用?Python UtilsTest.download_images使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utilstest.UtilsTest
的用法示例。
在下文中一共展示了UtilsTest.download_images方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: download_images
# 需要导入模块: from utilstest import UtilsTest [as 别名]
# 或者: from utilstest.UtilsTest import download_images [as 别名]
def download_images():
"""
Download all test images and
"""
root_dir = os.path.dirname(os.path.abspath(__file__))
test_dir = os.path.join(root_dir, PROJECT, "test")
sys.path.insert(0, test_dir)
from utilstest import UtilsTest
image_home = os.path.join(root_dir, "testimages")
testimages = os.path.join(root_dir, "all_testimages.json")
UtilsTest.image_home = image_home
UtilsTest.testimages = testimages
if os.path.exists(testimages):
import json
with open(testimages) as f:
all_files = set(json.load(f))
else:
raise(RuntimeError("Please run 'python setup.py build test' to download all images"))
for afile in all_files.copy():
if afile.endswith(".bz2"):
all_files.add(afile[:-4] + ".gz")
all_files.add(afile[:-4])
elif afile.endswith(".gz"):
all_files.add(afile[:-3] + ".bz2")
all_files.add(afile[:-3])
else:
all_files.add(afile + ".gz")
all_files.add(afile + ".bz2")
UtilsTest.download_images(all_files)
return list(all_files)
示例2: download_images
# 需要导入模块: from utilstest import UtilsTest [as 别名]
# 或者: from utilstest.UtilsTest import download_images [as 别名]
def download_images():
"""
Download all test images and
"""
test_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test")
sys.path.insert(0, test_dir)
from utilstest import UtilsTest
UtilsTest.download_images()
return list(UtilsTest.ALL_DOWNLOADED_FILES)
示例3: download_images
# 需要导入模块: from utilstest import UtilsTest [as 别名]
# 或者: from utilstest.UtilsTest import download_images [as 别名]
def download_images():
"""
Download all test images and
"""
test_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test")
sys.path.insert(0, test_dir)
from utilstest import UtilsTest
for afile in UtilsTest.ALL_DOWNLOADED_FILES.copy():
if afile.endswith(".bz2"):
UtilsTest.ALL_DOWNLOADED_FILES.add(afile[:-4] + ".gz")
UtilsTest.ALL_DOWNLOADED_FILES.add(afile[:-4])
elif afile.endswith(".gz"):
UtilsTest.ALL_DOWNLOADED_FILES.add(afile[:-3] + ".bz2")
UtilsTest.ALL_DOWNLOADED_FILES.add(afile[:-3])
else:
UtilsTest.ALL_DOWNLOADED_FILES.add(afile + ".gz")
UtilsTest.ALL_DOWNLOADED_FILES.add(afile + ".bz2")
UtilsTest.download_images()
return list(UtilsTest.ALL_DOWNLOADED_FILES)