Skip to content

Commit 5281b06

Browse files
Add logic explaination comment
Co-authored-by: Stanislav Terliakov <[email protected]>
1 parent adeccb4 commit 5281b06

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mypy/suggestions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,10 @@ def find_node(self, key: str) -> tuple[str, str, FuncDef]:
550550
# TODO: Also return OverloadedFuncDef -- currently these are ignored.
551551
node: SymbolNode | None = None
552552
if ":" in key:
553+
# A colon might be part of a drive name on Windows (like `C:/foo/bar`)
554+
# and is also used as a delimiter between file path and lineno.
555+
# If a colon is there for any of those reasons, it must be a file+line
556+
# reference.
553557
platform_key_count = 2 if sys.platform == "win32" else 1
554558
if key.count(":") > platform_key_count:
555559
raise SuggestionFailure(

0 commit comments

Comments
 (0)