Major update: obiarrays with columns containing indices referring to

character strings.
This commit is contained in:
Celine Mercier
2015-11-06 17:55:15 +01:00
parent 456551ffeb
commit 9b066f4327
35 changed files with 632 additions and 532 deletions

View File

@ -16,7 +16,7 @@ from cpython.int cimport PyInt_FromLong
cdef class OBIDMS_column_int(OBIDMS_column):
cpdef object get_line(self, size_t line_nb):
cpdef object get_line(self, index_t line_nb):
cdef obiint_t value
cdef object result
value = obi_column_get_obiint_with_elt_idx(self.pointer, line_nb, 0)
@ -28,7 +28,7 @@ cdef class OBIDMS_column_int(OBIDMS_column):
result = PyInt_FromLong(value)
return result
cpdef set_line(self, size_t line_nb, object value):
cpdef set_line(self, index_t line_nb, object value):
raise Exception("Column is read-only")
cpdef close(self):
@ -38,7 +38,7 @@ cdef class OBIDMS_column_int(OBIDMS_column):
cdef class OBIDMS_column_int_writable(OBIDMS_column_int):
cpdef set_line(self, size_t line_nb, object value):
cpdef set_line(self, index_t line_nb, object value):
if obi_column_set_obiint_with_elt_idx(self.pointer, line_nb, 0, <obiint_t> value) < 0:
raise Exception("Problem setting a value in a column")
@ -49,7 +49,7 @@ cdef class OBIDMS_column_int_writable(OBIDMS_column_int):
cdef class OBIDMS_column_int_multi_elts(OBIDMS_column_int):
cpdef object get_item(self, size_t line_nb, str element_name):
cpdef object get_item(self, index_t line_nb, str element_name):
cdef obiint_t value
cdef object result
value = obi_column_get_obiint_with_elt_name(self.pointer, line_nb, str2bytes(element_name))
@ -61,10 +61,10 @@ cdef class OBIDMS_column_int_multi_elts(OBIDMS_column_int):
result = PyInt_FromLong(value)
return result
cpdef object get_line(self, size_t line_nb) :
cpdef object get_line(self, index_t line_nb) :
cdef obiint_t value
cdef object result
cdef size_t i
cdef index_t i
cdef bint all_NA
result = {}
all_NA = True
@ -79,20 +79,20 @@ cdef class OBIDMS_column_int_multi_elts(OBIDMS_column_int):
result = None
return result
cpdef set_item(self, size_t line_nb, str element_name, obiint_t value):
cpdef set_item(self, index_t line_nb, str element_name, obiint_t value):
raise Exception("Column is read-only")
cpdef set_line(self, size_t line_nb, object values):
cpdef set_line(self, index_t line_nb, object values):
raise Exception("Column is read-only")
cdef class OBIDMS_column_int_multi_elts_writable(OBIDMS_column_int_multi_elts):
cpdef set_item(self, size_t line_nb, str element_name, obiint_t value):
cpdef set_item(self, index_t line_nb, str element_name, obiint_t value):
if obi_column_set_obiint_with_elt_name(self.pointer, line_nb, str2bytes(element_name), value) < 0:
raise Exception("Problem setting a value in a column")
cpdef set_line(self, size_t line_nb, object values):
cpdef set_line(self, index_t line_nb, object values):
cdef obiint_t value
for element_name in values :
value = <obiint_t> values[element_name]