Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def autoconstructURI():
if Config.getOption(ConfigOptions.SBOL_COMPLIANT_URIS) is False and hasHomespace():
return getHomespace() + os.sep + randomIdentifier()
elif Config.getOption(ConfigOptions.SBOL_COMPLIANT_URIS) is False and not hasHomespace():
raise SBOLError('The autoconstructURI method requires a valid namespace authority. Use setHomespace().',
SBOLErrorCode.SBOL_ERROR_COMPLIANCE)
else:
raise SBOLError('The autoconstructURI method only works when SBOLCompliance flag is false. '
'Use setOption to disable SBOL-compliant URIs.', SBOLErrorCode.SBOL_ERROR_COMPLIANCE)
def constructCompliantURI(sbol_type, display_id, version):
if Config.getOption(ConfigOptions.SBOL_COMPLIANT_URIS.value) is True:
return getHomespace() + os.sep + parseClassName(sbol_type) + os.sep + display_id + os.sep + version
else:
return ''