module documentation

Undocumented

Function add_additional_orm_attributes Apply __init__, __table__ and other attributes to the mapped class.
Function apply_mypy_mapped_attr Undocumented
Function apply_type_to_mapped_statement Apply the Mapped[<type>] annotation and right hand object to a declarative assignment statement.
Function re_apply_declarative_assignments For multiple class passes, re-apply our left-hand side types as mypy seems to reset them in place.
Function _apply_placeholder_attr_to_class Undocumented
def add_additional_orm_attributes(cls: ClassDef, api: SemanticAnalyzerPluginInterface, attributes: List[util.SQLAlchemyAttribute]): (source)

Apply __init__, __table__ and other attributes to the mapped class.

def apply_mypy_mapped_attr(cls: ClassDef, api: SemanticAnalyzerPluginInterface, item: Union[NameExpr, StrExpr], attributes: List[util.SQLAlchemyAttribute]): (source)

Undocumented

def apply_type_to_mapped_statement(api: SemanticAnalyzerPluginInterface, stmt: AssignmentStmt, lvalue: NameExpr, left_hand_explicit_type: Optional[ProperType], python_type_for_type: Optional[ProperType]): (source)

Apply the Mapped[<type>] annotation and right hand object to a declarative assignment statement. This converts a Python declarative class statement such as:: class User(Base): # ... attrname = Column(Integer) To one that describes the final Python behavior to Mypy:: class User(Base): # ... attrname : Mapped[Optional[int]] = <meaningless temp node>

def re_apply_declarative_assignments(cls: ClassDef, api: SemanticAnalyzerPluginInterface, attributes: List[util.SQLAlchemyAttribute]): (source)

For multiple class passes, re-apply our left-hand side types as mypy seems to reset them in place.

def _apply_placeholder_attr_to_class(api: SemanticAnalyzerPluginInterface, cls: ClassDef, qualified_name: str, attrname: str): (source)

Undocumented