diff --git a/python/obitools3/commands/test.pyx b/python/obitools3/commands/test.pyx index 977912e..6a9d05d 100644 --- a/python/obitools3/commands/test.pyx +++ b/python/obitools3/commands/test.pyx @@ -93,7 +93,7 @@ def test_set_and_get(config, infos): print_test(config, ">>> Set and get test") col_name = random_column(infos) col = infos['view'][col_name] - element_names = col.get_elements_names() + element_names = col.elements_names data_type = col.get_data_type() if data_type == "OBI_QUAL" : print_test(config, "-") @@ -173,7 +173,7 @@ def random_col_type(): def fill_column(config, infos, col) : data_type = col.get_data_type() - element_names = col.get_elements_names() + element_names = col.elements_names if len(element_names) > 1 : for i in range(random_int(config)) : diff --git a/python/obitools3/obidms/_obidms.pxd b/python/obitools3/obidms/_obidms.pxd index 75eb272..01dce97 100644 --- a/python/obitools3/obidms/_obidms.pxd +++ b/python/obitools3/obidms/_obidms.pxd @@ -10,16 +10,15 @@ from ._obitaxo cimport OBI_Taxonomy cdef class OBIDMS_column: cdef str column_name - cdef str column_alias + cdef str column_alias # associated property: alias cdef OBIDMS_column_p* pointer cdef OBIDMS dms cdef OBIView view cdef str data_type cdef str dms_name cdef index_t nb_elements_per_line - cdef list elements_names + cdef list elements_names # associated property: elements_names - cpdef list get_elements_names(self) cpdef str get_data_type(self) cpdef index_t get_nb_lines_used(self) cpdef str get_creation_date(self) diff --git a/python/obitools3/obidms/_obidms.pyx b/python/obitools3/obidms/_obidms.pyx index cc3d1b9..19fb0af 100644 --- a/python/obitools3/obidms/_obidms.pyx +++ b/python/obitools3/obidms/_obidms.pyx @@ -124,10 +124,7 @@ cdef class OBIDMS_column : lines_used = (self.pointer)[0].header.lines_used for line_nb in range(lines_used): yield self.get_line(line_nb) - - cpdef list get_elements_names(self): - return self.elements_names - + cpdef str get_data_type(self): return self.data_type @@ -168,6 +165,11 @@ cdef class OBIDMS_column : def alias(self, new_alias): self.view.change_column_alias(self.column_alias, new_alias) + # Element names property getter + @property + def elements_names(self): + return self.elements_names + @staticmethod cdef object get_subclass_type(OBIDMS_column_p column_p) :