obi less: fixed bug when the length of a view would be less than the

default number of lines printed
This commit is contained in:
Celine Mercier
2017-07-10 17:04:02 +02:00
parent b6b95f26b6
commit b729b8928f

View File

@ -1,7 +1,7 @@
#cython: language_level=3 #cython: language_level=3
from obitools3.dms.dms import DMS # TODO cimport doesn't work from obitools3.dms.dms cimport DMS # TODO cimport doesn't work
from obitools3.dms.view.view import View # TODO cimport doesn't work from obitools3.dms.view.view cimport View # TODO cimport doesn't work
# TODO with URIs # TODO with URIs
@ -42,16 +42,25 @@ def addOptions(parser):
def run(config): def run(config):
cdef DMS d
cdef View view
cdef int n
# Open DMS # Open DMS
d = DMS.open(config['obi']['defaultdms']) d = DMS.open(config['obi']['defaultdms'])
# Open input view # Open input view
iview = View.open(d, config['obi']['view']) view = View.open(d, config['obi']['view'])
if config['less']['print'] > len(view) :
n = len(view)
else :
n = config['less']['print']
# Print # Print
for i in range(config['less']['print']) : for i in range(n) :
print(repr(iview[i])) print(repr(view[i]))
d.close() d.close()