Skip to content

Commit

Permalink
Merge pull request nipreps#1201 from nipreps/fix/sloppy-last-merges-2
Browse files Browse the repository at this point in the history
HOTFIX: Revise porting to Loader
  • Loading branch information
oesteban authored Mar 19, 2024
2 parents a833602 + 21cc46c commit 7921651
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions mriqc/data/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class GroupTemplate:
def __init__(self):
import jinja2

self.template_str = Loader("mriqc")("data/reports/group.html")
self.template_str = Loader(__package__)("reports/group.html").absolute()
self.env = jinja2.Environment(
loader=jinja2.FileSystemLoader(searchpath="/"),
trim_blocks=True,
Expand All @@ -46,7 +46,7 @@ def __init__(self):

def compile(self, configs):
"""Generates a string with the replacements"""
template = self.env.get_template(self.template_str)
template = self.env.get_template(str(self.template_str))
return template.render(configs)

def generate_conf(self, configs, path):
Expand Down
4 changes: 2 additions & 2 deletions mriqc/interfaces/common/ensure_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _run_interface(self, runtime):
input_image=self.inputs.in_file,
reference_image=REF_FILE_NAME,
interpolation="LanczosWindowedSinc",
transforms=[load_data("data/itk_identity.tfm")],
transforms=[str(load_data("data/itk_identity.tfm").absolute())],
output_image=out_file,
).run()

Expand All @@ -168,7 +168,7 @@ def _run_interface(self, runtime):
input_image=self.inputs.in_mask,
reference_image=REF_MASK_NAME,
interpolation="NearestNeighbor",
transforms=[load_data("data/itk_identity.tfm")],
transforms=[str(load_data("data/itk_identity.tfm").absolute())],
output_image=out_mask,
).run()

Expand Down
18 changes: 9 additions & 9 deletions mriqc/reports/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,15 @@ def gen_html(csv_file, mod, csv_failed=None, out_file=None):
"version": ver,
"csv_groups": csv_groups,
"failed": failed,
"boxplots_js": open(
load_data("data/reports/embed_resources/boxplots.js"),
).read(),
"d3_js": open(
load_data("data/reports/embed_resources/d3.min.js"),
).read(),
"boxplots_css": open(
load_data("data/reports/embed_resources/boxplots.css"),
).read(),
"boxplots_js": load_data(
"data/reports/embed_resources/boxplots.js"
).read_text(),
"d3_js": load_data(
"data/reports/embed_resources/d3.min.js"
).read_text(),
"boxplots_css": load_data(
"data/reports/embed_resources/boxplots.css"
).read_text(),
},
out_file,
)
Expand Down
2 changes: 1 addition & 1 deletion mriqc/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def mock_config():
"""Create a mock config for documentation and testing purposes."""
from . import config

filename = Path(_load_data("data/config-example.toml"))
filename = _load_data("data/config-example.toml")
settings = loads(filename.read_text())
for sectionname, configs in settings.items():
if sectionname != "environment":
Expand Down

0 comments on commit 7921651

Please sign in to comment.