Skip to content

Commit 62df7bb

Browse files
committed
Rename unreachable_lines to skipped_lines
1 parent 304997b commit 62df7bb

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

mypy/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2238,7 +2238,7 @@ def semantic_analysis_pass1(self) -> None:
22382238
analyzer = SemanticAnalyzerPreAnalysis()
22392239
with self.wrap_context():
22402240
analyzer.visit_file(self.tree, self.xpath, self.id, options)
2241-
self.manager.errors.set_unreachable_lines(self.xpath, self.tree.unreachable_lines)
2241+
self.manager.errors.set_skipped_lines(self.xpath, self.tree.skipped_lines)
22422242
# TODO: Do this while constructing the AST?
22432243
self.tree.names = SymbolTable()
22442244
if not self.tree.is_stub:

mypy/errors.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ class Errors:
223223
# (path -> line -> error-codes)
224224
ignored_lines: dict[str, dict[int, list[str]]]
225225

226-
# Lines that are statically unreachable (e.g. due to platform/version check).
227-
unreachable_lines: dict[str, set[int]]
226+
# Lines that were skipped during semantic analysis (would not be type-checked).
227+
skipped_lines: dict[str, set[int]]
228228

229229
# Lines on which an error was actually ignored.
230230
used_ignored_lines: dict[str, dict[int, list[str]]]
@@ -281,7 +281,7 @@ def initialize(self) -> None:
281281
self.import_ctx = []
282282
self.function_or_member = [None]
283283
self.ignored_lines = {}
284-
self.unreachable_lines = {}
284+
self.skipped_lines = {}
285285
self.used_ignored_lines = defaultdict(lambda: defaultdict(list))
286286
self.ignored_files = set()
287287
self.only_once_messages = set()
@@ -330,8 +330,8 @@ def set_file_ignored_lines(
330330
if ignore_all:
331331
self.ignored_files.add(file)
332332

333-
def set_unreachable_lines(self, file: str, unreachable_lines: set[int]) -> None:
334-
self.unreachable_lines[file] = unreachable_lines
333+
def set_skipped_lines(self, file: str, skipped_lines: set[int]) -> None:
334+
self.skipped_lines[file] = skipped_lines
335335

336336
def current_target(self) -> str | None:
337337
"""Retrieves the current target from the associated scope.
@@ -631,7 +631,7 @@ def generate_unused_ignore_errors(self, file: str) -> None:
631631
ignored_lines = self.ignored_lines[file]
632632
used_ignored_lines = self.used_ignored_lines[file]
633633
for line, ignored_codes in ignored_lines.items():
634-
if line in self.unreachable_lines[file]:
634+
if line in self.skipped_lines[file]:
635635
continue
636636
if codes.UNUSED_IGNORE.code in ignored_codes:
637637
continue

mypy/nodes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ class MypyFile(SymbolNode):
287287
"names",
288288
"imports",
289289
"ignored_lines",
290-
"unreachable_lines",
290+
"skipped_lines",
291291
"is_stub",
292292
"is_cache_skeleton",
293293
"is_partial_stub_package",
@@ -314,8 +314,8 @@ class MypyFile(SymbolNode):
314314
# If the value is empty, ignore all errors; otherwise, the list contains all
315315
# error codes to ignore.
316316
ignored_lines: dict[int, list[str]]
317-
# Lines that are statically unreachable (e.g. due to platform/version check).
318-
unreachable_lines: set[int]
317+
# Lines that were skipped during semantic analysis (would not be type-checked).
318+
skipped_lines: set[int]
319319
# Is this file represented by a stub file (.pyi)?
320320
is_stub: bool
321321
# Is this loaded from the cache and thus missing the actual body of the file?
@@ -348,7 +348,7 @@ def __init__(
348348
self.ignored_lines = ignored_lines
349349
else:
350350
self.ignored_lines = {}
351-
self.unreachable_lines = set()
351+
self.skipped_lines = set()
352352

353353
self.path = ""
354354
self.is_stub = False

mypy/semanal_pass1.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def visit_file(self, file: MypyFile, fnam: str, mod_id: str, options: Options) -
6262
self.cur_mod_node = file
6363
self.options = options
6464
self.is_global_scope = True
65-
self.unreachable_lines: set[int] = set()
65+
self.skipped_lines: set[int] = set()
6666

6767
for i, defn in enumerate(file.defs):
6868
defn.accept(self)
@@ -74,10 +74,10 @@ def visit_file(self, file: MypyFile, fnam: str, mod_id: str, options: Options) -
7474
next_def, last = file.defs[i + 1], file.defs[-1]
7575
if last.end_line is not None:
7676
# We are on a Python version recent enough to support end lines.
77-
self.unreachable_lines |= set(range(next_def.line, last.end_line + 1))
77+
self.skipped_lines |= set(range(next_def.line, last.end_line + 1))
7878
del file.defs[i + 1 :]
7979
break
80-
file.unreachable_lines = self.unreachable_lines
80+
file.skipped_lines = self.skipped_lines
8181

8282
def visit_func_def(self, node: FuncDef) -> None:
8383
old_global_scope = self.is_global_scope
@@ -127,7 +127,7 @@ def visit_block(self, b: Block) -> None:
127127
if b.is_unreachable:
128128
if b.end_line is not None:
129129
# We are on a Python version recent enough to support end lines.
130-
self.unreachable_lines |= set(range(b.line, b.end_line + 1))
130+
self.skipped_lines |= set(range(b.line, b.end_line + 1))
131131
return
132132
super().visit_block(b)
133133

mypy/server/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ def key(node: FineGrainedDeferredNode) -> int:
986986
manager.errors.set_file_ignored_lines(
987987
file_node.path, file_node.ignored_lines, options.ignore_errors or state.ignore_all
988988
)
989-
manager.errors.set_unreachable_lines(file_node.path, file_node.unreachable_lines)
989+
manager.errors.set_skipped_lines(file_node.path, file_node.skipped_lines)
990990

991991
targets = set()
992992
for node in nodes:

0 commit comments

Comments
 (0)