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:
@ -1,7 +1,7 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from obitools3.dms.dms import DMS # TODO cimport doesn't work
|
||||
from obitools3.dms.view.view import View # TODO cimport doesn't work
|
||||
from obitools3.dms.dms cimport DMS # TODO cimport doesn't work
|
||||
from obitools3.dms.view.view cimport View # TODO cimport doesn't work
|
||||
|
||||
|
||||
# TODO with URIs
|
||||
@ -42,16 +42,25 @@ def addOptions(parser):
|
||||
|
||||
|
||||
def run(config):
|
||||
|
||||
cdef DMS d
|
||||
cdef View view
|
||||
cdef int n
|
||||
|
||||
# Open DMS
|
||||
d = DMS.open(config['obi']['defaultdms'])
|
||||
|
||||
# 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
|
||||
for i in range(config['less']['print']) :
|
||||
print(repr(iview[i]))
|
||||
for i in range(n) :
|
||||
print(repr(view[i]))
|
||||
|
||||
d.close()
|
||||
|
||||
|
Reference in New Issue
Block a user