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.ViInt64, expected_size_or_value)
def __init__(self, expected_value):
_ScalarMatcher.__init__(self, _visatype.ViInt64, expected_value)
def __init__(self):
_PointerMatcher.__init__(self, _visatype.ViInt64)
def __init__(self, expected_size_or_value):
_BufferMatcher.__init__(self, _visatype.ViInt64, expected_size_or_value)
def __init__(self, expected_value):
_ScalarMatcher.__init__(self, _visatype.ViInt64, expected_value)
def __init__(self):
_PointerMatcher.__init__(self, _visatype.ViInt64)
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)