Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parse_scalar(self, cell):
scalar_type = int(cell[0])
value = cell[1]
scalar = None
if scalar_type == ResultSetScalarTypes.VALUE_NULL:
scalar = None
elif scalar_type == ResultSetScalarTypes.VALUE_STRING:
if isinstance(value, bytes):
scalar = value.decode()
elif not isinstance(value, str):
scalar = str(value)
else:
scalar = value
elif scalar_type == ResultSetScalarTypes.VALUE_INTEGER:
scalar = int(value)
elif scalar_type == ResultSetScalarTypes.VALUE_BOOLEAN:
value = value.decode() if isinstance(value, bytes) else value
if value == "true":