Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Returns the library.Library singleton for niscope.
'''
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
Returns the library.Library singleton for niscope.
'''
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