(I'm aware that red-knot is not yet stable).
This was tested with 7dbd8f0f8e725d05cc1d15e6ef1c6cc2ed2b2090 with no Ruff settings.
Code:
import datetime
def get_weeks() -> list[datetime.date]:
raise NotImplementedError
def get_week_groups() -> list[list[datetime.date]]:
pass
def main():
weeks = get_weeks()
all_week_groups = get_week_groups()
for week in weeks:
for group in all_week_groups:
if any(d == week for d in group):
print("Blah")
red-knot output:
/t/ruff ❯❯❯ ./target/release/red_knot --current-directory=z/
ERROR /private/tmp/ruff/z/t.py:17:25: Name `week` used when possibly not defined
But obviously week is always defined there.
(I'm aware that red-knot is not yet stable).
This was tested with
7dbd8f0f8e725d05cc1d15e6ef1c6cc2ed2b2090with no Ruff settings.Code:
red-knot output:
But obviously
weekis always defined there.