Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, serialNumber=None, connect=True):
"""Load DLLs."""
self.handle = None
if platform.system() == 'Linux':
from ctypes import cdll
# ok I don't know what is wrong with my installer,
# but I need to include .so.2
self.lib = cdll.LoadLibrary("lib" + self.LIBNAME + ".so.2")
elif platform.system() == 'Darwin':
from picoscope.darwin_utils import LoadLibraryDarwin
self.lib = LoadLibraryDarwin("lib" + self.LIBNAME + ".dylib")
else:
from ctypes import windll
self.lib = windll.LoadLibrary(str(self.LIBNAME + ".dll"))
super(PS4000, self).__init__(serialNumber, connect)
# check to see which model we have and use special functions if needed
unit_number = self.getUnitInfo('VariantInfo')
if unit_number == '4262':
self.getTimestepFromTimebase = self._getTimestepFromTimebase4262
self.getTimeBaseNum = self._getTimeBaseNum4262
elif unit_number in {'4223', '4224', '4423', '4424'}:
self.getTimestepFromTimebase = self._getTimestepFromTimebase4223
self.getTimeBaseNum = self._getTimeBaseNum4223
else:
raise NotImplementedError('Timebase functions have not been '
'written for the ' + unit_number)