From c6d5436a58a1a7e7af4970421d4b9509d0030866 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Sun, 20 Aug 2017 17:41:41 +0200 Subject: [PATCH] Cython API: fixed a bug where iteration on a NUC_SEQS view would not be done correctly (bug appeared with optimization modifications done lately) --- .../dms/view/typed_view/view_NUC_SEQS.pyx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/python/obitools3/dms/view/typed_view/view_NUC_SEQS.pyx b/python/obitools3/dms/view/typed_view/view_NUC_SEQS.pyx index bc0f89a..508bc6f 100644 --- a/python/obitools3/dms/view/typed_view/view_NUC_SEQS.pyx +++ b/python/obitools3/dms/view/typed_view/view_NUC_SEQS.pyx @@ -58,12 +58,25 @@ cdef class View_NUC_SEQS(View): return view -# TODO + # TODO test time gain without + @OBIWrapper.checkIsActive def __getitem__(self, object item) : if type(item) == int : return Nuc_Seq_Stored(self, item) else : # TODO assume str or bytes for optimization? return self.get_column(item) # TODO hyper lent dans la pratique + + + @OBIWrapper.checkIsActive + def __iter__(self): + # Iteration on each line of all columns + + # Declarations + cdef index_t line_nb + + # Yield each line + for line_nb in range(self.line_count) : + yield Nuc_Seq_Stored(self, line_nb) # TODO? test if efficiency gain