Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_importer(fileuris, doc):
importers = docimport.get_possible_importers(fileuris, current_doc=doc)
if len(importers) <= 0:
raise Exception("Don't know how to import {}".format(fileuris))
if len(importers) == 1:
return importers[0]
elif not is_interactive():
raise Exception(
"Many way to import {} and running in batch mode."
" Can't import.\n{}"
.format(
fileuris,
", ".join([str(importer) for importer in importers])
)
)
else:
verbose("Import of {}:")