obi_errno_to_exception function now properly reads obi_errno global
variable directly
This commit is contained in:
@ -30,7 +30,7 @@ cdef class Column_idx(Column):
|
||||
cdef index_t value
|
||||
cdef object result
|
||||
value = obi_get_index_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
if value == OBIIdx_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -42,7 +42,7 @@ cdef class Column_idx(Column):
|
||||
if value is None :
|
||||
value = OBIIdx_NA
|
||||
if obi_set_index_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, <index_t> value) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_multi_elts_idx(Column_multi_elts):
|
||||
@ -57,7 +57,7 @@ cdef class Column_multi_elts_idx(Column_multi_elts):
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
value = obi_get_index_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
if value == OBIIdx_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -81,7 +81,7 @@ cdef class Column_multi_elts_idx(Column_multi_elts):
|
||||
elements_names = self._elements_names
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_get_index_with_elt_idx_and_col_p_in_view(view_p, column_p, line_nb, i)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
if value != OBIIdx_NA :
|
||||
value_in_result = PyLong_FromLongLong(value)
|
||||
result[elements_names[i]] = value_in_result
|
||||
@ -98,11 +98,11 @@ cdef class Column_multi_elts_idx(Column_multi_elts):
|
||||
value = OBIIdx_NA
|
||||
if type(elt_id) == int :
|
||||
if obi_set_index_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_id, <index_t> value) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
if obi_set_index_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name, <index_t> value) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
|
||||
cpdef set_line_idx(self, index_t line_nb, object values):
|
||||
if values is None :
|
||||
|
@ -51,7 +51,7 @@ cdef class Column_bool(Column):
|
||||
cdef obibool_t value
|
||||
cdef object result
|
||||
value = obi_get_bool_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
if value == OBIBool_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -63,7 +63,7 @@ cdef class Column_bool(Column):
|
||||
if value is None :
|
||||
value = OBIBool_NA
|
||||
if obi_set_bool_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, <obibool_t> value) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_multi_elts_bool(Column_multi_elts):
|
||||
@ -78,7 +78,7 @@ cdef class Column_multi_elts_bool(Column_multi_elts):
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
value = obi_get_bool_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
if value == OBIBool_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -102,7 +102,7 @@ cdef class Column_multi_elts_bool(Column_multi_elts):
|
||||
elements_names = self._elements_names
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_get_bool_with_elt_idx_and_col_p_in_view(view_p, column_p, line_nb, i)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
if value != OBIBool_NA :
|
||||
value_in_result = PyBool_FromLong(value)
|
||||
result[elements_names[i]] = value_in_result
|
||||
@ -119,11 +119,11 @@ cdef class Column_multi_elts_bool(Column_multi_elts):
|
||||
value = OBIBool_NA
|
||||
if type(elt_id) == int :
|
||||
if obi_set_bool_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_id, <obibool_t> value) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
if obi_set_bool_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name, <obibool_t> value) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_tuples_bool(Column):
|
||||
@ -140,7 +140,7 @@ cdef class Column_tuples_bool(Column):
|
||||
result = []
|
||||
|
||||
array = <obibool_t*>obi_get_array_with_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, &value_length)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
|
||||
if array == OBITuple_NA :
|
||||
return None
|
||||
@ -179,7 +179,7 @@ cdef class Column_tuples_bool(Column):
|
||||
j+=1
|
||||
|
||||
if obi_set_array_with_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, <obibool_t*> array, sizeof(obibool_t)*8, value_length) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
if array != <obibool_t*>OBITuple_NA:
|
||||
free(array)
|
||||
|
@ -50,7 +50,7 @@ cdef class Column_char(Column):
|
||||
cdef obichar_t value
|
||||
cdef object result
|
||||
value = obi_get_char_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
if value == OBIChar_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -65,7 +65,7 @@ cdef class Column_char(Column):
|
||||
else :
|
||||
value_b = <obichar_t> tobytes(value)[0]
|
||||
if obi_set_char_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, value_b) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_multi_elts_char(Column_multi_elts):
|
||||
@ -80,7 +80,7 @@ cdef class Column_multi_elts_char(Column_multi_elts):
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
value = obi_get_char_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
if value == OBIChar_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -104,7 +104,7 @@ cdef class Column_multi_elts_char(Column_multi_elts):
|
||||
elements_names = self._elements_names
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_get_char_with_elt_idx_and_col_p_in_view(view_p, column_p, line_nb, i)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
if value != OBIChar_NA :
|
||||
value_in_result = <bytes>value
|
||||
result[elements_names[i]] = value_in_result
|
||||
@ -124,11 +124,11 @@ cdef class Column_multi_elts_char(Column_multi_elts):
|
||||
value_b = <obichar_t> tobytes(value)[0]
|
||||
if type(elt_id) == int :
|
||||
if obi_set_char_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_id, value_b) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
if obi_set_char_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name, value_b) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_tuples_char(Column):
|
||||
@ -145,7 +145,7 @@ cdef class Column_tuples_char(Column):
|
||||
result = []
|
||||
|
||||
array = <obichar_t*>obi_get_array_with_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, &value_length)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
|
||||
if array == OBITuple_NA :
|
||||
return None
|
||||
@ -186,7 +186,7 @@ cdef class Column_tuples_char(Column):
|
||||
j+=1
|
||||
|
||||
if obi_set_array_with_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, <obichar_t*> array, sizeof(obichar_t)*8, value_length) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
if array != <obichar_t*>OBITuple_NA:
|
||||
free(array)
|
||||
|
@ -50,7 +50,7 @@ cdef class Column_float(Column):
|
||||
cdef obifloat_t value
|
||||
cdef object result
|
||||
value = obi_get_float_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
if value == OBIFloat_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -62,7 +62,7 @@ cdef class Column_float(Column):
|
||||
if value is None :
|
||||
value = OBIFloat_NA
|
||||
if obi_set_float_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, <obifloat_t> value) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_multi_elts_float(Column_multi_elts):
|
||||
@ -77,7 +77,7 @@ cdef class Column_multi_elts_float(Column_multi_elts):
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
value = obi_get_float_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
if value == OBIFloat_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -101,7 +101,7 @@ cdef class Column_multi_elts_float(Column_multi_elts):
|
||||
elements_names = self._elements_names
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_get_float_with_elt_idx_and_col_p_in_view(view_p, column_p, line_nb, i)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
if value != OBIFloat_NA :
|
||||
value_in_result = <double> value
|
||||
result[elements_names[i]] = value_in_result
|
||||
@ -118,11 +118,11 @@ cdef class Column_multi_elts_float(Column_multi_elts):
|
||||
value = OBIFloat_NA
|
||||
if type(elt_id) == int :
|
||||
if obi_set_float_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_id, <obifloat_t> value) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
if obi_set_float_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name, <obifloat_t> value) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_tuples_float(Column):
|
||||
@ -139,7 +139,7 @@ cdef class Column_tuples_float(Column):
|
||||
result = []
|
||||
|
||||
array = <obifloat_t*>obi_get_array_with_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, &value_length)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
|
||||
if array == OBITuple_NA :
|
||||
return None
|
||||
@ -178,7 +178,7 @@ cdef class Column_tuples_float(Column):
|
||||
j+=1
|
||||
|
||||
if obi_set_array_with_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, <obifloat_t*> array, sizeof(obifloat_t)*8, value_length) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
if array != <obifloat_t*>OBITuple_NA:
|
||||
free(array)
|
||||
|
@ -53,7 +53,7 @@ cdef class Column_int(Column):
|
||||
cdef obiint_t value
|
||||
cdef object result
|
||||
value = obi_get_int_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
if value == OBIInt_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -66,7 +66,7 @@ cdef class Column_int(Column):
|
||||
if value is None :
|
||||
value = OBIInt_NA
|
||||
if obi_set_int_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, <obiint_t> value) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_multi_elts_int(Column_multi_elts):
|
||||
@ -81,7 +81,7 @@ cdef class Column_multi_elts_int(Column_multi_elts):
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
value = obi_get_int_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
if value == OBIInt_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -105,7 +105,7 @@ cdef class Column_multi_elts_int(Column_multi_elts):
|
||||
elements_names = self._elements_names
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_get_int_with_elt_idx_and_col_p_in_view(view_p, column_p, line_nb, i)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
if value != OBIInt_NA :
|
||||
value_in_result = PyInt_FromLong(value)
|
||||
result[elements_names[i]] = value_in_result
|
||||
@ -122,11 +122,11 @@ cdef class Column_multi_elts_int(Column_multi_elts):
|
||||
value = OBIInt_NA
|
||||
if type(elt_id) == int :
|
||||
if obi_set_int_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_id, <obiint_t> value) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
if obi_set_int_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name, <obiint_t> value) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_tuples_int(Column):
|
||||
@ -143,7 +143,7 @@ cdef class Column_tuples_int(Column):
|
||||
result = []
|
||||
|
||||
array = <obiint_t*>obi_get_array_with_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, &value_length)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
|
||||
if array == OBITuple_NA :
|
||||
return None
|
||||
@ -182,7 +182,7 @@ cdef class Column_tuples_int(Column):
|
||||
j+=1
|
||||
|
||||
if obi_set_array_with_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, <obiint_t*> array, sizeof(obiint_t)*8, value_length) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
if array != <obiint_t*>OBITuple_NA:
|
||||
free(array)
|
||||
|
@ -57,7 +57,7 @@ cdef class Column_qual(Column_idx):
|
||||
cdef int value_length
|
||||
cdef object result
|
||||
value = obi_get_qual_int_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, &value_length)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
if value == OBIQual_int_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -73,7 +73,7 @@ cdef class Column_qual(Column_idx):
|
||||
cdef object result
|
||||
cdef int i
|
||||
value = obi_get_qual_char_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, offset)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
if value == OBIQual_char_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -88,14 +88,14 @@ cdef class Column_qual(Column_idx):
|
||||
cdef int value_length
|
||||
if value is None :
|
||||
if obi_set_qual_int_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, OBIQual_int_NA, 0) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
else :
|
||||
value_length = len(value)
|
||||
value_b = <uint8_t*> malloc(value_length * sizeof(uint8_t))
|
||||
for i in range(value_length) :
|
||||
value_b[i] = <uint8_t>value[i]
|
||||
if obi_set_qual_int_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, value_b, value_length) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
free(value_b)
|
||||
|
||||
|
||||
@ -104,11 +104,11 @@ cdef class Column_qual(Column_idx):
|
||||
cdef bytes value_b
|
||||
if value is None :
|
||||
if obi_set_qual_char_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, OBIQual_char_NA, offset) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
else :
|
||||
value_b = tobytes(value)
|
||||
if obi_set_qual_char_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, value_b, offset) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_multi_elts_qual(Column_multi_elts_idx):
|
||||
@ -124,7 +124,7 @@ cdef class Column_multi_elts_qual(Column_multi_elts_idx):
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
value = obi_get_qual_int_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name, &value_length)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
if value == OBIQual_int_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -143,7 +143,7 @@ cdef class Column_multi_elts_qual(Column_multi_elts_idx):
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
value = obi_get_qual_char_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name, offset)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
if value == OBIQual_char_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -171,7 +171,7 @@ cdef class Column_multi_elts_qual(Column_multi_elts_idx):
|
||||
elements_names = self._elements_names
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_get_qual_int_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, i, &value_length)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
if value != OBIQual_int_NA :
|
||||
value_in_result = []
|
||||
for j in range(value_length) :
|
||||
@ -201,7 +201,7 @@ cdef class Column_multi_elts_qual(Column_multi_elts_idx):
|
||||
elements_names = self._elements_names
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_get_qual_char_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, i, offset)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
if value != OBIQual_char_NA :
|
||||
value_in_result = value
|
||||
free(value)
|
||||
@ -230,11 +230,11 @@ cdef class Column_multi_elts_qual(Column_multi_elts_idx):
|
||||
|
||||
if type(elt_id) == int :
|
||||
if obi_set_qual_int_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_id, value_b, value_length) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
if obi_set_qual_int_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name, value_b, value_length) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
|
||||
if value is not None :
|
||||
free(value_b)
|
||||
@ -252,11 +252,11 @@ cdef class Column_multi_elts_qual(Column_multi_elts_idx):
|
||||
|
||||
if type(elt_id) == int :
|
||||
if obi_set_qual_char_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_id, value_b, offset) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
if obi_set_qual_char_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name, value_b, offset) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
def register_class():
|
||||
|
@ -54,7 +54,7 @@ cdef class Column_seq(Column_idx):
|
||||
cdef char* value
|
||||
cdef object result
|
||||
value = obi_get_seq_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
if value == OBISeq_NA :
|
||||
result = None
|
||||
else : # TODO
|
||||
@ -77,7 +77,7 @@ cdef class Column_seq(Column_idx):
|
||||
value_b = <char*>value_bytes
|
||||
|
||||
if obi_set_seq_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, value_b) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_multi_elts_seq(Column_multi_elts_idx):
|
||||
@ -91,7 +91,7 @@ cdef class Column_multi_elts_seq(Column_multi_elts_idx):
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
value = obi_get_seq_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
if value == OBISeq_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -119,7 +119,7 @@ cdef class Column_multi_elts_seq(Column_multi_elts_idx):
|
||||
elements_names = self._elements_names
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_get_seq_with_elt_idx_and_col_p_in_view(view_p, column_p, line_nb, i)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
if value != OBISeq_NA :
|
||||
try:
|
||||
value_in_result = <bytes> value
|
||||
@ -147,12 +147,12 @@ cdef class Column_multi_elts_seq(Column_multi_elts_idx):
|
||||
|
||||
if type(elt_id) == int :
|
||||
if obi_set_seq_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_id, value_b) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
if obi_set_seq_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name, value_b) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_tuples_seq(Column_idx):
|
||||
@ -169,7 +169,7 @@ cdef class Column_tuples_seq(Column_idx):
|
||||
result = []
|
||||
|
||||
array = <const char*>obi_get_array_with_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, &value_length)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
|
||||
if array == OBITuple_NA :
|
||||
return None
|
||||
@ -217,7 +217,7 @@ cdef class Column_tuples_seq(Column_idx):
|
||||
i = i + len(elt_b) + 1
|
||||
|
||||
if obi_set_array_with_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, <char*> array, sizeof(char)*8, value_length) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
if array != <char*>OBITuple_NA:
|
||||
free(array)
|
||||
|
@ -53,7 +53,7 @@ cdef class Column_str(Column_idx):
|
||||
cdef const_char_p value
|
||||
cdef object result
|
||||
value = obi_get_str_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
if value == OBIStr_NA :
|
||||
result = None
|
||||
# For columns containing character strings that should be evaluated:
|
||||
@ -76,7 +76,7 @@ cdef class Column_str(Column_idx):
|
||||
value_b = <char*>value_bytes
|
||||
|
||||
if obi_set_str_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, 0, value_b) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_multi_elts_str(Column_multi_elts_idx):
|
||||
@ -90,7 +90,7 @@ cdef class Column_multi_elts_str(Column_multi_elts_idx):
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
value = obi_get_str_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem getting a value from a column")
|
||||
if value == OBIStr_NA :
|
||||
result = None
|
||||
else :
|
||||
@ -115,7 +115,7 @@ cdef class Column_multi_elts_str(Column_multi_elts_idx):
|
||||
elements_names = self._elements_names
|
||||
for i in range(self.nb_elements_per_line) :
|
||||
value = obi_get_str_with_elt_idx_and_col_p_in_view(view_p, column_p, line_nb, i)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=i, error_message="Problem getting a value from a column")
|
||||
if value != OBIStr_NA :
|
||||
value_in_result = <bytes> value
|
||||
result[elements_names[i]] = value_in_result
|
||||
@ -140,11 +140,11 @@ cdef class Column_multi_elts_str(Column_multi_elts_idx):
|
||||
|
||||
if type(elt_id) == int :
|
||||
if obi_set_str_with_elt_idx_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_id, <char*>value_b) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
else :
|
||||
elt_name = tobytes(elt_id)
|
||||
if obi_set_str_with_elt_name_and_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, elt_name, <char*>value_b) < 0:
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=elt_id, error_message="Problem setting a value in a column")
|
||||
|
||||
|
||||
cdef class Column_tuples_str(Column_idx):
|
||||
@ -161,7 +161,7 @@ cdef class Column_tuples_str(Column_idx):
|
||||
result = []
|
||||
|
||||
array = <const char*>obi_get_array_with_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, &value_length)
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem getting a value from a column")
|
||||
|
||||
if array == OBITuple_NA :
|
||||
return None
|
||||
@ -209,7 +209,7 @@ cdef class Column_tuples_str(Column_idx):
|
||||
i = i + len(elt_b) + 1
|
||||
|
||||
if obi_set_array_with_col_p_in_view(self._view.pointer(), self.pointer(), line_nb, <char*> array, sizeof(char)*8, value_length) < 0 :
|
||||
obi_errno_to_exception(obi_errno, line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
obi_errno_to_exception(line_nb=line_nb, elt_id=None, error_message="Problem setting a value in a column")
|
||||
|
||||
if array != <char*>OBITuple_NA:
|
||||
free(array)
|
||||
|
@ -5,7 +5,7 @@ from obitools3.dms.capi.obitypes cimport obitype_t, index_t
|
||||
cpdef bytes format_separator(bytes format)
|
||||
cpdef int count_entries(file, bytes format)
|
||||
|
||||
cdef obi_errno_to_exception(int obi_errno, index_t line_nb=*, object elt_id=*, str error_message=*)
|
||||
cdef obi_errno_to_exception(index_t line_nb=*, object elt_id=*, str error_message=*)
|
||||
|
||||
cdef bytes str2bytes(str string)
|
||||
cdef str bytes2str(bytes string)
|
||||
|
@ -12,8 +12,8 @@ from obitools3.dms.capi.obitypes cimport is_a_DNA_seq, \
|
||||
index_t
|
||||
|
||||
from obitools3.dms.capi.obierrno cimport OBI_LINE_IDX_ERROR, \
|
||||
OBI_ELT_IDX_ERROR
|
||||
#obi_errno # TODO
|
||||
OBI_ELT_IDX_ERROR, \
|
||||
obi_errno
|
||||
|
||||
import re
|
||||
import mmap
|
||||
@ -83,7 +83,7 @@ cpdef int count_entries(file, bytes format):
|
||||
|
||||
|
||||
# TODO RollbackException?
|
||||
cdef obi_errno_to_exception(int obi_errno, index_t line_nb=-1, object elt_id=None, str error_message=None) :
|
||||
cdef obi_errno_to_exception(index_t line_nb=-1, object elt_id=None, str error_message=None) :
|
||||
global obi_errno
|
||||
if obi_errno > 0 :
|
||||
if obi_errno == OBI_LINE_IDX_ERROR :
|
||||
|
Reference in New Issue
Block a user