Skip to content
Snippets Groups Projects
Commit f8ea4e0c authored by Florian Obersteiner's avatar Florian Obersteiner :8ball:
Browse files

revision of nlines method

parent 970ef9e2
No related branches found
No related tags found
1 merge request!15updated normal comments handling
......@@ -189,13 +189,13 @@ class StandardNormalComments(collections.UserList):
@property
def nlines(self):
"""calculates the number of lines in the normal comments section"""
n = 1 # shortnames line
n += len(self.freeform) # freeform comment
# shortnames line is always there:
n = 1
# freeform comment might or might not be there:
n += sum(len(s.split('\n')) for s in self.freeform)
# tagged comments have at least one line:
for k in self.keywords.values():
try:
n += len(k.data[0].split("\n")) # and keywords might be multiline...
except IndexError: # ok we have no list,
n += 1 # just add 1
n += sum(len(s.split('\n')) for s in k.data) or 1
return n
@property
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment