Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
raise DaxError('File %s does not exists.' % filepath)
if filepath.endswith('.py'):
test = imp.load_source('test', filepath)
try:
#print('evaling:' + _tmp.format(os.path.basename(filepath)[:-3]))
return eval(_tmp.format(os.path.basename(filepath)[:-3]))
except AttributeError as e:
#print('attribute error', str(e))
pass
err = '[ERROR] Module or processor NOT FOUND in the python file {}.'
logger.error(err.format(filepath))
elif filepath.endswith('.yaml'):
return processors.load_from_yaml(
XnatUtils, filepath, args, singularity_imagedir)
return None
if filepath.endswith('yaml'):
doc = utilities.read_yaml(filepath)
if 'projects' in list(doc.keys()):
try:
return bin.read_yaml_settings(filepath, LOGGER)
except AutoProcessorError:
print('[ERROR]')
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.print_exception(exc_type, exc_value, exc_traceback,
limit=2, file=sys.stdout)
else:
# So far only auto processor:
try:
return processors.load_from_yaml(XnatUtils, filepath)
except AutoProcessorError:
print('[ERROR]')
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.print_exception(exc_type, exc_value, exc_traceback,
limit=2, file=sys.stdout)
elif filepath.endswith('.py') or is_python_file(filepath):
test = imp.load_source('test', filepath)
# Check if processor file
try:
return eval('test.{}()'.format(test.__processor_name__))
except AttributeError:
pass
# Check if it's a settings file.py
try:
return test.myLauncher