U kf(@sUddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl m Z dd l m Z dd l m Z dd l m Z dd l mZdd l mZddl mZddl mZddl mZddl mZddl mZddl mZddlmZddlmZddlmZddlmZddlmZddlmZedZ de!d<edZ"de!d<edZ#de!d<edZ$de!d<ed Z%de!d!<ed"Z&de!d"<ed#Z'de!d#<ed$Z(de!d$<ed%Z)de!d%<ed&Z*de!d&<ed'Z+de!d'<ed(Z,de!d(<ed)Z-de!d)<ed*Z.de!d*<ed+Z/de!d+<ed,Z0de!d,<ed-Z1de!d-<d.Z2d/Z3d0Z4d1Z5d2d3d4d5d6hZ6e d7d8hfe"e6fe"e6fe"e6fe#d9d:hfe$d;dhfe$d;dhfe*d?d@dAdBhfe*d?d@dAdBhfe+dCdDdEdFhfe+dCdDdEdFhfe-dGdHhfe%dIhfe&e5hfe'dJdKdLhfe(dMdNdOhfe)dPdQhfe.dRdSdThfe/dUdVhfe,dWdXhfe0dYdZhfe1d[d\hfd]Z7d^e!d_<d`ddadbdcddZ8deddadfdgdhZ9didjdkdldmdndoZ:dpdldqdrdsZ;dtdldudvdwZdS)) annotations)Dict)List)Optional)Set)Tuple)Union)ARG_POS)CallExpr)ClassDef) Decorator) Expression)FuncDef) MemberExpr)NameExpr)OverloadedFuncDef) SymbolNode) TypeAlias)TypeInfo)SemanticAnalyzerPluginInterface) CallableType)get_proper_type)Instance) UnboundType)utilCOLUMNint RELATIONSHIPREGISTRYCOLUMN_PROPERTYZ TYPEENGNE TYPEENGINEMAPPEDDECLARATIVE_BASEDECLARATIVE_METAMAPPED_DECORATORSYNONYM_PROPERTYCOMPOSITE_PROPERTY DECLARED_ATTRMAPPER_PROPERTYAS_DECLARATIVEAS_DECLARATIVE_BASEDECLARATIVE_MIXINQUERY_EXPRESSIONzbuiltins.objectz builtins.strz builtins.listzsqlalchemy.orm.base.Mappedz)sqlalchemy.orm.relationships.Relationshipz1sqlalchemy.orm.relationships.RelationshipPropertyz2sqlalchemy.orm.relationships._RelationshipDeclaredzsqlalchemy.orm.Relationshipz#sqlalchemy.orm.RelationshipPropertyzsqlalchemy.sql.schema.Columnzsqlalchemy.sql.Columnz sqlalchemy.orm.decl_api.registryzsqlalchemy.orm.registryz-sqlalchemy.orm.properties.MappedSQLExpressionz"sqlalchemy.orm.MappedSQLExpressionz(sqlalchemy.orm.properties.ColumnPropertyzsqlalchemy.orm.ColumnPropertyz'sqlalchemy.orm.descriptor_props.Synonymzsqlalchemy.orm.Synonymz/sqlalchemy.orm.descriptor_props.SynonymPropertyzsqlalchemy.orm.SynonymPropertyz)sqlalchemy.orm.descriptor_props.Compositezsqlalchemy.orm.Compositez1sqlalchemy.orm.descriptor_props.CompositePropertyz sqlalchemy.orm.CompositePropertyz(sqlalchemy.orm.interfaces.MapperPropertyzsqlalchemy.orm.MapperPropertyz"sqlalchemy.sql.type_api.TypeEnginez+sqlalchemy.ext.declarative.declarative_basezsqlalchemy.orm.declarative_basez(sqlalchemy.orm.decl_api.declarative_basez*sqlalchemy.ext.declarative.DeclarativeMetazsqlalchemy.orm.DeclarativeMetaz'sqlalchemy.orm.decl_api.DeclarativeMetaz'sqlalchemy.orm.decl_api.registry.mappedzsqlalchemy.orm.registry.mappedz)sqlalchemy.ext.declarative.as_declarativez&sqlalchemy.orm.decl_api.as_declarativezsqlalchemy.orm.as_declarativez4sqlalchemy.orm.decl_api.registry.as_declarative_basez+sqlalchemy.orm.registry.as_declarative_basez%sqlalchemy.orm.decl_api.declared_attrzsqlalchemy.orm.declared_attrz)sqlalchemy.orm.decl_api.declarative_mixinz sqlalchemy.orm.declarative_mixinzsqlalchemy.orm.query_expressionz1sqlalchemy.orm._orm_constructors.query_expression)ColumnZ RelationshipZRelationshipPropertyZ_RelationshipDeclaredregistryZColumnPropertyZMappedSQLExpressionZSynonymZSynonymPropertyZ CompositeZCompositePropertyZMapperPropertyZ TypeEngineZMappedZdeclarative_baseZDeclarativeMetaZmappedZas_declarativeZas_declarative_baseZ declared_attrZdeclarative_mixinZquery_expressionzDict[str, Tuple[int, Set[str]]]_lookuprbool)infotype_idreturncCsD|jD]"}t|jd\}}||krq.qdS|dkr:dS|j|kSNNNF)mror0getnamefullname)r2r3mr check_type_id fullnamesr>I/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/ext/mypy/names.pyhas_base_type_ids r@zList[TypeInfo])r7r3r4cCsB|D]"}t|jd\}}||krq,qdS|dkr8dS|j|kSr5r0r8r9r:)r7r3r;r<r=r>r>r? mro_has_idsrBrr rz Optional[int])type_clsapir4cCs^||j|}|dk rZt|jtrDt|jj}t|trZt|j Snt|jt rZt|jSdSN) Zlookup_qualifiedr9 isinstancenoderrtargetrtype_id_for_named_nodetyper)rCrDrEsym target_typer>r>r?type_id_for_unbound_types      rNr )calleer4cCsft|ttfrbt|jtrnt|jjtrn|jjjrjt|jjjtrjt |jjjj }t|t rjt |jj SdSt|jtr|jjr|jjjrt|jjjtrt |jjjj }t|t rt |jj SdSt|jtr|jjrt|jjtrt |jjj }t|t rt |jj SdSt|jtrLt |jj}t|t rbt |jj Snt|jtrbt|SdSrF)rGrrrHr funcrrKrrret_typertype_id_for_fullnamer:rimplrrIrrJ)rOrQrMr>r>r?type_id_for_calleesJ          rTz'Union[NameExpr, MemberExpr, SymbolNode])rHr4cCs<t|jd\}}|dks"|dkr&dS|j|kr4|SdSdS)Nr6rA)rHr3r=r>r>r?rJ+s  rJstr)r:r4cCsJ|d}|d}t|d\}}|dks2|dkr6dS||krB|SdSdS)N.r6)splitr0r8)r:tokensZ immediater3r=r>r>r?rR8s rRr )exprr4cCs,td}t|_t|d}t||gtgdgS)NZ __sa_MappedZ_empty_constructorZarg1)rNAMED_TYPE_SQLA_MAPPEDr:rr r )rZZcolumn_descriptorZ member_exprr>r>r?expr_to_mapped_constructorFs r\N)? __future__rtypingrrrrrrZ mypy.nodesr r r r r rrrrrrrZ mypy.pluginrZ mypy.typesrrrrrsymbolr__annotations__rrr r!r"r#r$r%r&r'r(r)r*r+r,r-ZNAMED_TYPE_BUILTINS_OBJECTZNAMED_TYPE_BUILTINS_STRZNAMED_TYPE_BUILTINS_LISTr[Z _RelFullNamesr0r@rBrNrTrJrRr\r>r>r>r?sN                                   ,