Changeset 554
- Timestamp:
- 08/25/05 03:37:16
- Files:
-
- trunk/cherrypy/lib/covercp.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/lib/covercp.py
r551 r554 285 285 if not _skip_file(path, exclude) and not os.path.isdir(path): 286 286 _graft(path, tree) 287 print tree288 287 return tree 289 288 … … 331 330 def annotated_file(self, filename, statements, excluded, missing): 332 331 source = open(filename, 'r') 333 lineno = 0 334 while 1: 335 line = source.readline() 336 if line == '': 337 break 338 line = line[:-1] 339 lineno = lineno + 1 340 if line == '': 341 yield ' ' 342 continue 332 buffer = [] 333 for lineno, line in enumerate(source.readlines()): 334 lineno += 1 335 line = line.strip("\n\r") 336 empty_the_buffer = True 343 337 if lineno in excluded: 344 338 template = TEMPLATE_LOC_EXCLUDED 345 339 elif lineno in missing: 346 340 template = TEMPLATE_LOC_NOT_COVERED 341 elif lineno in statements: 342 template = TEMPLATE_LOC_COVERED 347 343 else: 348 template = TEMPLATE_LOC_COVERED 349 yield template % (lineno, cgi.escape(line)) 344 empty_the_buffer = False 345 buffer.append((lineno, line)) 346 if empty_the_buffer: 347 for lno, pastline in buffer: 348 yield template % (lno, cgi.escape(pastline)) 349 buffer = [] 350 yield template % (lineno, cgi.escape(line)) 350 351 351 352 def report(self, name):

