Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix find occurrences flag #15528

Merged
merged 3 commits into from
Jun 29, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1336,12 +1336,13 @@ def set_strict_flags() -> None:

# Set build flags.
if special_opts.find_occurrences:
state.find_occurrences = special_opts.find_occurrences.split(".")
assert state.find_occurrences is not None
if len(state.find_occurrences) < 2:
_find_occurrences = tuple(special_opts.find_occurrences.split("."))
assert _find_occurrences is not None
hauntsaninja marked this conversation as resolved.
Show resolved Hide resolved
if len(_find_occurrences) < 2:
parser.error("Can only find occurrences of class members.")
if len(state.find_occurrences) != 2:
if len(_find_occurrences) != 2:
parser.error("Can only find occurrences of non-nested class members.")
state.find_occurrences = _find_occurrences # type: ignore[assignment]

# Set reports.
for flag, val in vars(special_opts).items():
Expand Down