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_library_name():
try:
return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL
except KeyError:
raise errors.UnsupportedConfigurationError
except errors.InvalidRepeatedCapabilityError:
pass
try:
convert_repeated_capabilities(('5', '6-8-10'))
assert False
except errors.InvalidRepeatedCapabilityError:
pass
try:
convert_repeated_capabilities('5,6-8-10')
assert False
except errors.InvalidRepeatedCapabilityError:
pass
try:
convert_repeated_capabilities(5.0)
assert False
except errors.InvalidRepeatedCapabilityError:
pass
try:
convert_repeated_capabilities([5.0, '0'])
assert False
except errors.InvalidRepeatedCapabilityError:
pass
try:
convert_repeated_capabilities((5.0, '0'))
assert False
except errors.InvalidRepeatedCapabilityError:
pass
Returns the library.Library singleton for nidigital.
'''
global _instance
global _instance_lock
with _instance_lock:
if _instance is None:
try:
library_type = _get_library_type()
if library_type == 'windll':
ctypes_library = ctypes.WinDLL(_get_library_name())
else:
assert library_type == 'cdll'
ctypes_library = ctypes.CDLL(_get_library_name())
except OSError:
raise errors.DriverNotInstalledError()
_instance = _library.Library(ctypes_library)
return _instance