| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # portions copyright 2001, Autonomous Zones Industries, Inc., all rights... | 3 # portions copyright 2001, Autonomous Zones Industries, Inc., all rights... |
| 4 # err... reserved and offered to the public under the terms of the | 4 # err... reserved and offered to the public under the terms of the |
| 5 # Python 2.2 license. | 5 # Python 2.2 license. |
| 6 # Author: Zooko O'Whielacronx | 6 # Author: Zooko O'Whielacronx |
| 7 # http://zooko.com/ | 7 # http://zooko.com/ |
| 8 # mailto:zooko@zooko.com | 8 # mailto:zooko@zooko.com |
| 9 # | 9 # |
| 10 # Copyright 2000, Mojam Media, Inc., all rights reserved. | 10 # Copyright 2000, Mojam Media, Inc., all rights reserved. |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 outfile.write(" ") | 370 outfile.write(" ") |
| 371 outfile.write(lines[i].expandtabs(8)) | 371 outfile.write(lines[i].expandtabs(8)) |
| 372 outfile.close() | 372 outfile.close() |
| 373 | 373 |
| 374 return n_hits, n_lines | 374 return n_hits, n_lines |
| 375 | 375 |
| 376 def find_lines_from_code(code, strs): | 376 def find_lines_from_code(code, strs): |
| 377 """Return dict where keys are lines in the line number table.""" | 377 """Return dict where keys are lines in the line number table.""" |
| 378 linenos = {} | 378 linenos = {} |
| 379 | 379 |
| 380 line_increments = [ord(c) for c in code.co_lnotab[1::2]] | 380 line_increments = [c if c < 128 else c - 256 |
| 381 for c in map(ord, code.co_lnotab[1::2])] |
| 381 table_length = len(line_increments) | 382 table_length = len(line_increments) |
| 382 docstring = False | 383 docstring = False |
| 383 | 384 |
| 384 lineno = code.co_firstlineno | 385 lineno = code.co_firstlineno |
| 385 for li in line_increments: | 386 for li in line_increments: |
| 386 lineno += li | 387 lineno += li |
| 387 if lineno not in strs: | 388 if lineno not in strs: |
| 388 linenos[lineno] = 1 | 389 linenos[lineno] = 1 |
| 389 | 390 |
| 390 return linenos | 391 return linenos |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 except SystemExit: | 805 except SystemExit: |
| 805 pass | 806 pass |
| 806 | 807 |
| 807 results = t.results() | 808 results = t.results() |
| 808 | 809 |
| 809 if not no_report: | 810 if not no_report: |
| 810 results.write_results(missing, summary=summary, coverdir=coverdir) | 811 results.write_results(missing, summary=summary, coverdir=coverdir) |
| 811 | 812 |
| 812 if __name__=='__main__': | 813 if __name__=='__main__': |
| 813 main() | 814 main() |
| OLD | NEW |