Skip to content

Commit

Permalink
Code cleanup in response to code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark R. Tuttle authored and markrtuttle committed May 4, 2022
1 parent 3f93049 commit 6f48fe0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/cbmc_viewer/coveraget.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def update_coverage(coverage, path, func, line, status):
# subelements of the goal in CBMC's xml or json coverage output.

def parse_lines(string):
"Extract line numbers from the string encoding of line numbers used in coverage output"
"""Extract line numbers from the string encoding of line numbers used in coverage output"""

# string is an encoding of a set of line numbers like
# "1,3,6" -> {1, 3, 6}
Expand All @@ -492,15 +492,14 @@ def parse_lines(string):
bounds = group.split('-')
if len(bounds) == 1:
lines.add(int(bounds[0]))
continue
if len(bounds) == 2:
elif len(bounds) == 2:
lines.update(range(int(bounds[0]), int(bounds[1])+1))
continue
raise UserWarning(f"Unexpected encoding of line numbers: {string}")
else:
raise UserWarning(f"Unexpected encoding of line numbers: {string}")
return sorted(lines)

def parse_description(description):
"Extract basic block source lines from a coverage goal's textual description"
"""Extract basic block source lines from a coverage goal's textual description"""

try:
# description is "block N (lines BASIC_BLOCK)"
Expand All @@ -526,7 +525,7 @@ def parse_description(description):
raise UserWarning(f'Unexpected coverage goal description: "{description}"') from error

def parse_basic_block_lines(basic_block_lines):
"Extract basic block source lines from a coverage goal's xml subelement"
"""Extract basic block source lines from a coverage goal's xml subelement"""

if basic_block_lines is None:
return []
Expand All @@ -548,7 +547,7 @@ def parse_basic_block_lines(basic_block_lines):
raise UserWarning(f'Unexpected coverage goal xml data: "{basic_block_lines}"') from error

def parse_basicBlockLines(basicBlockLines): # pylint: disable=invalid-name
"Extract basic block source lines from a coverage goal's json data"
"""Extract basic block source lines from a coverage goal's json data"""

if basicBlockLines is None:
return []
Expand Down

0 comments on commit 6f48fe0

Please sign in to comment.