Cython API: cleaner column rewriting API
This commit is contained in:
@ -237,7 +237,8 @@ def run(config):
|
|||||||
dcols[tag] = (view.rewrite_column_with_diff_attributes(old_column.name,
|
dcols[tag] = (view.rewrite_column_with_diff_attributes(old_column.name,
|
||||||
new_data_type=new_type,
|
new_data_type=new_type,
|
||||||
new_nb_elements_per_line=new_nb_elements_per_line,
|
new_nb_elements_per_line=new_nb_elements_per_line,
|
||||||
new_elements_names=new_elements_names),
|
new_elements_names=new_elements_names,
|
||||||
|
rewrite_last_line=False),
|
||||||
value_obitype)
|
value_obitype)
|
||||||
|
|
||||||
# Update the dictionary:
|
# Update the dictionary:
|
||||||
|
@ -32,7 +32,8 @@ cdef class View(OBIWrapper):
|
|||||||
object column_name,
|
object column_name,
|
||||||
obitype_t new_data_type=*,
|
obitype_t new_data_type=*,
|
||||||
index_t new_nb_elements_per_line=*,
|
index_t new_nb_elements_per_line=*,
|
||||||
list new_elements_names=*)
|
list new_elements_names=*,
|
||||||
|
bint rewrite_last_line=*)
|
||||||
|
|
||||||
cpdef Line_selection new_selection(self,
|
cpdef Line_selection new_selection(self,
|
||||||
list lines=*)
|
list lines=*)
|
||||||
|
@ -267,13 +267,17 @@ cdef class View(OBIWrapper) :
|
|||||||
object column_name,
|
object column_name,
|
||||||
obitype_t new_data_type=<obitype_t>OBI_VOID,
|
obitype_t new_data_type=<obitype_t>OBI_VOID,
|
||||||
index_t new_nb_elements_per_line=0,
|
index_t new_nb_elements_per_line=0,
|
||||||
list new_elements_names=None) :
|
list new_elements_names=None,
|
||||||
|
bint rewrite_last_line=False) :
|
||||||
|
|
||||||
cdef Column old_column
|
cdef Column old_column
|
||||||
cdef Column new_column
|
cdef Column new_column
|
||||||
cdef index_t length = len(self) - 1
|
cdef index_t length = len(self) # TODO because last line triggered error that triggered rewriting, but needs a cleaner way, or at least good documentation
|
||||||
cdef column_name_b = tobytes(column_name)
|
cdef column_name_b = tobytes(column_name)
|
||||||
|
|
||||||
|
if rewrite_last_line is False:
|
||||||
|
length-=1
|
||||||
|
|
||||||
if not self.active() :
|
if not self.active() :
|
||||||
raise OBIDeactivatedInstanceError()
|
raise OBIDeactivatedInstanceError()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user