Skip to content

Commit

Permalink
Add some TLineNo annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdrozd committed Jul 22, 2023
1 parent fbae61d commit e893213
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions coverage/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _raw_parse(self) -> None:
excluding = False
excluding_decorators = False
prev_toktype = token.INDENT
first_line = None
first_line: Optional[TLineNo] = None
empty = True
first_on_line = True
nesting = 0
Expand Down Expand Up @@ -182,11 +182,11 @@ def _raw_parse(self) -> None:
# http://stackoverflow.com/questions/1769332/x/1769794#1769794
self.raw_docstrings.update(range(slineno, elineno+1))
elif toktype == token.NEWLINE:
if first_line is not None and elineno != first_line: # type: ignore[unreachable]
if first_line is not None and elineno != first_line:
# We're at the end of a line, and we've ended on a
# different line than the first line of the statement,
# so record a multi-line range.
for l in range(first_line, elineno+1): # type: ignore[unreachable]
for l in range(first_line, elineno+1):
self._multiline[l] = first_line
first_line = None
first_on_line = True
Expand Down Expand Up @@ -416,7 +416,7 @@ def _line_numbers(self) -> Iterable[TLineNo]:
byte_increments = self.code.co_lnotab[0::2]
line_increments = self.code.co_lnotab[1::2]

last_line_num = None
last_line_num: Optional[TLineNo] = None
line_num = self.code.co_firstlineno
byte_num = 0
for byte_incr, line_incr in zip(byte_increments, line_increments):
Expand Down
2 changes: 1 addition & 1 deletion coverage/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def _line_ranges(
lines = sorted(lines)

pairs = []
start = None
start: Optional[TLineNo] = None
lidx = 0
for stmt in statements:
if lidx >= len(lines):
Expand Down

0 comments on commit e893213

Please sign in to comment.