-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Closed
Copy link
Labels
bugSomething isn't workingSomething isn't workinglinterRelated to the linterRelated to the linterruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
The described behavior happens since 0.3.3. It might be related to #10340
It is triggered throughout my SQLAlchemy models in cases where a model is not defined yet while used in a type annotation
Minimal repro:
from __future__ import annotations
from sqlalchemy.orm import DeclarativeBase, Mapped
class Base(DeclarativeBase):
some_mapping: Mapped[list[Bar]] | None = None # F821 Undefined name `Bar`
simplified: list[Bar] | None = None # F821 Undefined name `Bar`
class Bar:
pass
I can only trigger the error when inheriting from DeclarativeBase
. Without this inheritance or when inheriting from another class, things are fine.
Rey8d01
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinglinterRelated to the linterRelated to the linterruleImplementing or modifying a lint ruleImplementing or modifying a lint rule