Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _run_interface(self, runtime):
import bids
from bids.analysis import auto_model
models = self.inputs.model
if not isinstance(models, list):
database_path = self.inputs.database_path
layout = bids.BIDSLayout.load(database_path=database_path)
if not isdefined(models):
# model is not yet standardized, so validate=False
# Ignore all subject directories and .git/ and .datalad/ directories
small_layout = bids.BIDSLayout(
layout.root, derivatives=[d.root for d in layout.derivatives.values()],
validate=False,
ignore=[re.compile(r'sub-'),
re.compile(r'\.(git|datalad)')])
# PyBIDS can double up, so find unique models
models = list(set(small_layout.get(suffix='smdl', return_type='file')))
if not models:
raise ValueError("No models found")
elif models == 'default':
models = auto_model(layout)
models = [_ensure_model(m) for m in models]
if self.inputs.selectors:
# This is almost certainly incorrect
models = [model for model in models