Helpers
Assets
Exemple simple avec recherche des rapports html générés
import logging
import os
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(levelname)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
from cglblens.helpers.assets import Assets
current_dir = os.path.dirname(os.path.realpath(__file__))
# Setup Assets Helper with the target folder
assets = Assets(
os.path.join(current_dir, "assets"),
force_clean=True,
force_create=True
)
# Copy the tree where we found report of cglblens
assets.copy(
assets.report_discover(current_dir)
)
# Create an index of those reports
assets.create_html_index(
os.path.join(assets.path, "index.html"),
assets.path,
assets.report_get_name(),
title="Test Reports",
)
Exemple avec recherche des rapports html générés et une copie d'une sous arborecence
import logging
import os
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(levelname)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
from cglblens.helpers.assets import Assets
current_dir = os.path.dirname(os.path.realpath(__file__))
# Setup Assets Helper with the target folder
assets = Assets(
os.path.join(current_dir, "assets"),
force_clean=True,
force_create=True
)
# Copy the tree where we found report of cglblens, but only the report and one subfolder
assets.copy(
assets.report_discover(current_dir),
items_only=[
assets.report_get_name(),
"reference/outputs",
"test/outputs",
]
)
# Create an index of those reports
assets.create_html_index(
os.path.join(assets.path, "index.html"),
assets.path,
assets.report_get_name(),
title="Test Reports",
)