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, expected_size_or_value):
_BufferMatcher.__init__(self, _visatype.ViInt32, expected_size_or_value)
def __init__(self, expected_value):
_ScalarMatcher.__init__(self, _visatype.ViInt32, expected_value)
def __init__(self):
_PointerMatcher.__init__(self, _visatype.ViInt32)
def _convert_timedelta(value, library_type, scaling):
try:
# We first assume it is a timedelta object
scaled_value = value.total_seconds() * scaling
except AttributeError:
# If that doesn't work, assume it is a value in seconds
# cast to float so scaled_value is always a float. This allows `timeout=10` to work as expected
scaled_value = float(value) * scaling
# ctype integer types don't convert to int from float so we need to
if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]:
scaled_value = int(scaled_value)
return library_type(scaled_value)
sync_pulse_clock_source
exported_sync_pulse_output_terminal
Returns:
value (str): The value that you are getting
'''
session_ctype = _visatype.ViSession(self._session_number) # case S110
channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010
attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150
buf_size_ctype = _visatype.ViInt32() # case S170
value_ctype = None # case C050
error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype)
errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False)
buf_size_ctype = _visatype.ViInt32(error_code) # case S180
value_ctype = (_visatype.ViChar * buf_size_ctype.value)() # case C060
error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return value_ctype.value.decode(self._encoding)
def convert_timedelta_to_milliseconds_int32(value):
return _convert_timedelta(value, _visatype.ViInt32, 1000)
Args:
attribute_id (int): The ID of the property that you want to get Supported Properties
sync_pulse_source
sync_pulse_clock_source
exported_sync_pulse_output_terminal
Returns:
value (str): The value that you are getting
'''
session_ctype = _visatype.ViSession(self._session_number) # case S110
channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010
attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150
buf_size_ctype = _visatype.ViInt32() # case S170
value_ctype = None # case C050
error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype)
errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False)
buf_size_ctype = _visatype.ViInt32(error_code) # case S180
value_ctype = (_visatype.ViChar * buf_size_ctype.value)() # case C060
error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return value_ctype.value.decode(self._encoding)
sync_pulse_clock_source
exported_sync_pulse_output_terminal
Returns:
value (str): The value that you are getting
'''
session_ctype = _visatype.ViSession(self._session_number) # case S110
channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010
attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150
buf_size_ctype = _visatype.ViInt32() # case S170
value_ctype = None # case C050
error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype)
errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False)
buf_size_ctype = _visatype.ViInt32(error_code) # case S180
value_ctype = (_visatype.ViChar * buf_size_ctype.value)() # case C060
error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return value_ctype.value.decode(self._encoding)
Args:
attribute_id (int): The ID of the property that you want to get Supported Properties
sync_pulse_source
sync_pulse_clock_source
exported_sync_pulse_output_terminal
Returns:
value (str): The value that you are getting
'''
session_ctype = _visatype.ViSession(self._session_number) # case S110
channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010
attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150
buf_size_ctype = _visatype.ViInt32() # case S170
value_ctype = None # case C050
error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype)
errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False)
buf_size_ctype = _visatype.ViInt32(error_code) # case S180
value_ctype = (_visatype.ViChar * buf_size_ctype.value)() # case C060
error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return value_ctype.value.decode(self._encoding)