Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
infer.cpython-313.pyc192 linesDownload Raw Back to __pycache__
1�

2��j�M���SSKJr SSKJr SSKJr SSKJr SSKJr SSKJ	r	 SSKJ3r4 SSKJr SS	KJr SS5KJ
r
 SSKJr SSKJr SS
KJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSK J!r! SSK J"r" S(Sjr#S)Sjr$S)Sjr%S(S jr&S)S!jr'S*S+S#jjr(S,S-S$jjr)S.S%jr*S/S&jr+S0S'jr,g")1�)�annotations)�Optional)�Sequence)�map_instance_to_supertype)�AssignmentStmt)�CallExpr)�6Expression)�FuncDef)�7LambdaExpr)�8MemberExpr)�NameExpr)�RefExpr)�StrExpr)�TypeInfo)�Var)�SemanticAnalyzerPluginInterface)�9is_subtype)�AnyType)�CallableType)�get_proper_type)�Instance)�NoneType)�10ProperType)�	TypeOfAny)�	UnionType�)�names)�utilc���[R"U5nUcgU[RLa[XX#U5nU$U[RLa[XX#5nU$U[RLa[XX#5nU$U[RLa[XX#5nU$U[RLa[XU5nU$U[RLa[XX#5nU$g�N)r�type_id_for_callee�MAPPED�_infer_type_from_mapped�COLUMN�_infer_type_from_decl_column�RELATIONSHIP�_infer_type_from_relationship�COLUMN_PROPERTY�%_infer_type_from_decl_column_property�SYNONYM_PROPERTY�#infer_type_from_left_hand_type_only�COMPOSITE_PROPERTY�(_infer_type_from_decl_composite_property)�api�stmt�node�left_hand_explicit_type�infer_from_right_side�type_id�python_type_for_types       �_D:\code\apps\devtools\python\user_packages\Python313\site-packages\sqlalchemy/ext/mypy/infer.py�#infer_type_from_right_hand_nameexprr6(s���&�&�'<�=�G����	�E�L�L�	 �6��t�6K� 11��4 ��/12�E�L�L�	 �;��t� 13��, ��'14�E�&�&�	&�<��t� 15��$ ��16�E�)�)�	)�D��t� 17�� ��18�E�*�*�	*�B��.� 19�� ��20�E�,�,�	,�G��t� 21�� ���c�N�[UR[5(deURRSnSn[U[5(a7[UR22[5(aUR23n[U/5n[R"URS5n[R"URS5nSn	Ub?URU5SLa+Uc(Sn	Ub!UR[RU/5nGO5UbURU5SLGa�UGb�Sn	[U[5(aURn[U[5(a;[UR24[5(aUb[UR25U/5nGO�[U[5(a�[UR26[5(a�UR27R b�Ub�[UR28R ["5(a[%UR29R R&5n30[U31["5(aA[%U32R&5n[U[5(a[UR U/5nO�[R("USUR5 SnO�UbRURU5SLa>Ub"[R("USUR5 Ub[+U[-5/5nO5Uc2S	n[R("XR/UR05U5 Uc[3XU5$UbOU	(a:[U[5(de[U[5(de[5XX55$[7UUUU5$U$)33arInfer the type of mapping from a relationship.34 35E.g.::36 37    @reg.mapped38    class MyClass:39        # ...40 41        addresses = relationship(Address, uselist=True)42 43        order: Mapped["Order"] = relationship("Order")44 45Will resolve in mypy as::46 47    @reg.mapped48    class MyClass:49        # ...50 51        addresses: Mapped[List[Address]]52 53        order: Mapped["Order"]54 55rN�uselist�collection_classFTz>Expected Python collection type for collection_class parameterzOSending uselist=False and collection_class at the same time does not make sensez�Can't infer scalar or collection for ORM mapped expression assigned to attribute '{}' if both 'uselist' and 'collection_class' arguments are absent from the relationship(); please specify a type annotation on the left hand side.)�56isinstance�rvaluer�argsr
r0rrr�get_callexpr_kwarg�57parse_bool�58named_typer�NAMED_TYPE_BUILTINS_LIST�calleer59�typerr�ret_type�failrr�format�namer+�3_infer_collection_type_from_left_and_inferred_right�(_infer_type_from_left_and_inferred_right)
r.r/r0r1�target_cls_argr4�related_object_type�uselist_arg�collection_cls_arg�type_is_a_collection�rt�callable_ret_type�msgs
             r5r'r'Psg��<�d�k�k�8�,�,�,�,��[�[�%�%�a�(�N�15���.�(�+�+�60����X�1�1�-�1�1��'�(;�R�@�� �)�)�$�+�+�y�A�K�/3�/F�/F����'�0��!��	���N�N�;�'�4�/��&�#���+�#&�>�>��.�.�1E�0F�$� ��	��s�~�~�k�:�d�B�61�62(�#���(�(�3�3�!3�!:�!:���(�(�3�3�63��#�#�X�964�965�$�/�(0�&�+�+�.B�-C�(�$��
�)�8�4�4��-�2�2�G�<�<�"�'�'�,�,�8�#�/�66�0�5�5�:�:�L�I�I�(�);�)@�)@�)E�)E�)N�)N�O�B�!�"�l�3�3�,;�B�K�K�,H�)�%�&7��B�B�3;� 1� 6� 6�!5� 6�4�0��67
�I�I��-����	
�$(� �	�	 �S�^�^�K�%@�E�%I��)��I�I��&����	
� �+�#,�%�x�z�2�$� ��68#�*�9�
�
�I�I�c�:�:�d�i�i�0�$�7��#�2��.�69�	70�71!�	,���5�x�@�@�@�@��2�H�=�=�=�=�F��2��
�<���'�$�	�
�$�#r7c�X�[UR[5(deURRSnSn[U[5(a8[UR72[5(aUR73n[U/5nOSnUc[XU5$Ub[XX55$U$)z+Infer the type of mapping from a Composite.rN)74r;r<rr=r
r0rrr+rI)r.r/r0r1rJr4rKs       r5r-r-�s����d�k�k�8�,�,�,�,��[�[�%�%�a�(�N����.�(�+�+�75����X�1�1�-�1�1��'�(;�R�@��#���#�2��.�76�	77�78!�	,�7��.�79�	80�$�#r7c��[UR[5(de[R"U5n[XU5$)zNInfer the type of mapping from a right side expression81that returns Mapped.82 83 84)r;r<rr�type_for_calleer+)r.r/r0r1r2�the_mapped_types      r5r#r#sA���d�k�k�8�,�,�,�,��*�*�+@�A�O�.��*��r7c�B�[UR[5(deURR(anURRSn[U[5(a@[R85"UR5nU[RLa
[UUUUUS9$[UR[5(aK[R86"URR5nU[RLa[UUUU5$[XU5$)z�Infer the type of mapping from a ColumnProperty.87 88This includes mappings against ``column_property()`` as well as the89``deferred()`` function.90 91r)�right_hand_expression)r;r<rr=rr!rBr$r%�QUERY_EXPRESSIONr+)r.r/r0r1�first_prop_argr3s      r5r)r)6s����d�k�k�8�,�,�,�,��{�{������)�)�!�,���n�h�/�/��.�.�~�/D�/D�E�G��%�,�,�&�3����+�*8����$�+�+�x�(�(��*�*�4�;�;�+=�+=�>���e�,�,�,�/����'�	�
�/��*��r7Nc��[U[5(deSnUc,[UR[5(dgURnURSSH�n[U[5(a;[UR92[5(aUR93nURn OxMS[U[[45(a'[UR[5(aUnSn O6M�[U[45(aM�[U[45(aM�e Ucg[UR[5(ax[R"URR[R 5(a:[#XRW5nUb[%XX85$['U[)5/5$[+XU5$)a�Infer the type of mapping from a Column.94 95E.g.::96 97    @reg.mapped98    class MyClass:99        # ...100 101        a = Column(Integer)102 103        b = Column("b", String)104 105        c: Mapped[int] = Column(Integer)106 107        d: bool = Column(Boolean)108 109Will resolve in MyPy as::110 111    @reg.mapped112    class MyClass:113        # ...114 115        a: Mapped[int]116 117        b: Mapped[str]118 119        c: Mapped[int]120 121        d: Mapped[bool]122 123Nr��)r;rr<rr=rBrr
rr0rrrr�124mro_has_id�mro�125TYPEENGINE�#extract_python_type_from_typeenginerIrrr+)	r.r/r0r1rWrB�126column_arg�	type_argsr4s	         r5r%r%gs���L�d�C� � � � �
�F��$��$�+�+�x�0�0�� $����+�0�0��1�5�127��j�(�+�+��*�+�+�W�5�5�#�*�*��2<�/�/�	��	6�128�129�X�z�$:�
;�
;��*�/�/�8�4�4�#���	���
�130�W�J�
/�
/��
�131�Z�M�
2�
2�
��5�16�4�~���&�+�+�x�(�(�U�-=�-=�������)�)�.�.� C����i� 132��#�.�;��2��
�133�2�H�J�?�@�@�3��.�134�	135r7c�^�UcUnUcUn[X#5(d�UR[RU/5nSn[R136"UUR
UR[R"X@R5[R"X`R55U5 U$)z�Validate type when a left hand annotation is present and we also137could infer the right hand side::138 139    attrname: SomeType = Column(SomeDBType)140 141zRLeft hand assignment '{}: {}' not compatible with ORM mapped expression of type {})142rr@r�NAMED_TYPE_SQLA_MAPPEDrrErFrG�format_type�options)r.r0r1r4�orig_left_hand_type�orig_python_type_for_type�effective_typerQs        r5rIrI�s����"�5�� �(�$8�!��-�D�D�����(�(�+D�*E�143��144
4�	�	
�	�	���J�J��	�	�� � �!4�k�k�B�� � ����=�
�145
�	146��r7c	�&�UnUnUR(a1[URS5n[URS5nOUnUn[U[[45(de[U[[45(de[UUUUUUS9$)Nr)rgrh)r=rr;rrrI)r.r0r1r4rgrh�
left_hand_arg�python_type_args        r5rHrH�s���2�� 4���#�#�'�(?�(D�(D�Q�(G�H�
�)�*>�*C�*C�A�*F�G��/�
�.���m�h�	�%:�;�;�;�;��o��)�'<�=�=�=�=�3�����/�";�
�r7c���UcjSn[R"XRUR5U5 UR	[147R[[R5/5$U$)z�Determine the type based on explicit annotation only.148 149if no annotation were present, note that we need one there to know150the type.151 152z�Can't infer type from ORM mapped expression assigned to attribute '{}'; please specify a Python type or Mapped[<python type>] on the left hand side.)153rrErFrGr@rrdrr�special_form)r.r0r1rQs    r5r+r+sc���&�
;�	�	
�	�	�#�z�z�$�)�)�,�d�3��~�~��(�(�7�9�3I�3I�+J�*K�154�	155�'�&r7c��URS:Xa�U(a�USn[U[5(ae[UR[5(aFURR156H+nURS:XdM[
UR/5s $ O UR[R/5$URS5(d157SU-5eURS5nUb[UR[5(de[[
U/5UR5n[URS5$)Nzsqlalchemy.sql.sqltypes.Enumrz	enum.Enumz"sqlalchemy.sql.type_api.TypeEnginez+could not extract Python type from node: %s�����)�fullnamer;rr0rr^rr@r�NAMED_TYPE_BUILTINS_STR�has_base�lookup_fully_qualified_or_nonerrr=)r.r0rb�	first_arg�base_�type_engine_sym�type_engines       r5r`r`.s$��158�}�}�6�6�9��a�L�	��i��)�)�j��N�N�H�/159�/160�#���+�+���>�>�[�0�#�I�N�N�B�7�7�,�161�>�>�%�"?�"?��D�D��=�=�=�>�>��5��<��>��8�8�,��O��&�:����h�,�,���,���r������K��;�+�+�B�/�0�0r7)r.rr/rr0rr1�Optional[ProperType]r2r�returnry)162r.rr/rr0rr1ryrzryr )r.rr/rr0rr1ryrWzOptional[CallExpr]rzry)NN)r.rr0rr1rr4rrgryrhryrzry)163r.rr0rr1rr4rrzry)r.rr0rr1ryrzry)r.rr0rrbzSequence[Expression]rzr)-�164__future__r�typingrr�mypy.maptyper�165mypy.nodesrrr	r166rrr
rrrr�mypy.pluginr�
mypy.subtypesr�167mypy.typesrrrrrrrr�rrr6r'r-r#r)r%rIrHr+r`r\r7r5�<module>r�s���#���2�%��!��!�!������7�$��#�&���!� � ���% �	(�% �168�% ��% �2�	% �169#�% ��
% �Pc$�	(�c$�170�c$��c$�2�	c$�171�c$�L$�	(�$�172�$��$�2�	$�173�$�@�	(��174����2�	�175#���
�@.�	(�.�176�.��.�2�	.�177�.�l15�`178�	(�`179�180�`181��`182�2�	`183�184.�`185��
`186�P15�6:�
'�	(�'�187
�'�(�'�%�	'�188.�'� 4�
'��'�T�	(��189
��&��#�	�190��:'�	(�'�191
�'�2�'��	'�: 1�	(� 1�192� 1�$� 1��	 1r7
codekingpro/portable-devtools · Team Ai