Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
interfaces.cpython-313.pyc679 linesDownload Raw Back to __pycache__
1�

2��j���3�Z�SrSSKJr SSKrSSKrSSKrSSKJr SSKJr SSKJr SSKJ	r	 SSKJ4r5 SS	KJr SS6KJr SSKJ
r
 SSKJr SS
KJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJ r  SSKJ!r! SSKJ"r" SSKJ#r# SS KJ$r$ SS!KJ%r% SS"KJ&r& SS#KJ'r' SS$KJ(r( SS%KJ)r) SS&KJ*r* SS'KJ+r+ S(S)KJ,r, S(SKJr- S(S*KJ.r. S(S+KJ/r/ S(S,K0J1r1 S(S-K0J2r2 S(S.K0J3r3 S(S/K4J5r5 S(S0K4J6r6 S(S1K7J8r8 S(S2K9J:r: S(S3K;J<r< S(S4K=J>r> S(S5K/J?r? S(S6K@JArA S(S7K@JBrB \R,(a�SS8KCJDrD SS9KCJErE SS:KCJFrF SS;KCJGrG SS<KCJHrH SS=KIJJrJ SS>KJKrK SS?KLJMrM SS@KLJNrN SSAKLJOrO SSBKPJQrQ SSCKRJSrS SSDKTJUrU SSEKVJWrW SSFKJXrX SSGKYJZrZ SSHK[J\r\ SSIK]J^r^ SSJK_J`r` SSKK/Jara SSLK/Jbrb S(SMKcJdrd S(SNKeJfrf S(SOKeJgrg S(SPKeJhrh S(SQKeJiri S(SRK9Jjrj S(SSKkJlrl S(STK@Jmrm \\SU4rn\"SV\SW9ro\"SX\SYSZ9rp\"S[S\SW9rq"S]S^\2R�5rs"S_S`\2R�\2R�\o5rv"SaSb\v\o5rw"ScSd\2R�5ry"SeSf\B5rz"SgSh5r{"SiSj\5r|\|"\5R�\5R�\5R�\5R�\5R�\5R�\5R�\5R�5r~\|"Sk\5R�\5R�\5R�\5R�\5R�\5R�\5R�5r"SlSm5r�"SnSo\�\\o5r�\.GR"SpSq\8\�\\o\#\/GR55r�\.GR"SrSs\+\p\\p\:55r�"StSu\�\o5r�"SvSw\65r�"SxSy\8\�5r�"SzS{\�5r�"S|S}\�5r�"S~S\�5r�\/GR"S�S�SS�9"S�S�\�55r�"S�S�5r�g)�z�7 8Contains various base classes used throughout the ORM.9 10Defines some key base classes prominent within the internals.11 12This module and the classes within are mostly private, though some attributes13are exposed when inspecting mappings.14 15�)�annotationsN)�Any)�Callable)�cast)�ClassVar)�Dict)�Generic)�Iterator)�List)�Mapping)�16NamedTuple)�NoReturn)�Optional)�Sequence)�Set)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union�)�exc)�
path_registry)�_MappedAttribute)�EXT_CONTINUE)�EXT_SKIP)�EXT_STOP)�InspectionAttr)�InspectionAttrInfo)�17MANYTOMANY)�	MANYTOONE)�NO_KEY)�NO_VALUE)�NotExtension)�	ONETOMANY)�RelationshipDirection)�SQLORMOperations�)�
ColumnElement)�18inspection)�util)�	operators)�roles)�visitors)�_NoArg)�ExecutableOption)�HasCacheKey)�ColumnOperators)�Column)�19TypeEngine)�warn_deprecated)�RODescriptorReference)�	TypedDict)�_EntityType)�_IdentityKeyType)�
_InstanceDict)�_InternalEntityType)�_ORMAdapterProto)�InstrumentedAttribute)�Mapped)�
_MapperEntity)�ORMCompileState)�QueryContext)�RegistryType)�_ClassScanMapperConfig)�_PopulatorDict)�Mapper)�AbstractEntityRegistry)�Query)�Session)�
InstanceState)�_LoadElement)�AliasedInsp)�20ORMAdapter)�Result)�_ColumnExpressionArgument)�_ColumnsClauseArgument)�_DMLColumnArgument)�	_InfoType)�OperatorType)�_TraverseInternalsType)�_AnnotationScanType.�_T)�bound�_T_coT)rV�	covariant�_TLS�Type[LoaderStrategy]c��\rSrSrSrSrSrg)�ORMStatementRole�t�z?Executable SQL or text() construct, including ORM aware objectsN��__name__�21__module__�__qualname__�__firstlineno__�	__slots__�22_role_name�__static_attributes__r^��_D:\code\apps\devtools\python\user_packages\Python313\site-packages\sqlalchemy/orm/interfaces.pyr\r\ts���I�I�rgr\c��\rSrSrSrSrSrg)�ORMColumnsClauseRole�{r^z7ORM mapped entity, aliased entity, or Column expressionNr_r^rgrhrjrj{s���I�J�Jrgrjc��\rSrSrSrSrSrg)�ORMEntityColumnsClauseRole�r^zORM mapped or aliased entityNr_r^rgrhrmrm�s���I�/�Jrgrmc��\rSrSrSrSrSrg)�ORMFromClauseRole�r^z5ORM mapped entity, aliased entity, or FROM expressionNr_r^rgrhrprp�s���I�H�Jrgrpc�H�\rSrSr%S\S'S\S'S\S'S\S	'S23\S'Srg
)�ORMColumnDescription��str�namez!Union[Type[Any], TypeEngine[Any]]�type�bool�aliasedz_ColumnsClauseArgument[Any]�exprz%Optional[_ColumnsClauseArgument[Any]]�entityr^N)r`rarbrc�__annotations__rfr^rgrhrsrs�s ��24
�I�,�+�
�M�25%�%�1�1rgrsc�r�\rSrSrSr\SSj5rS	SjrS26SjrSSjr	Sr27g)�_IntrospectsAnnotations�r^c��UR$�N)r`)�clss rh�_mapper_property_name�-_IntrospectsAnnotations._mapper_property_name�s���|�|�rgc�>�[SUR5<S35e)zjreturn a copy of this object to use in declarative when the28object is found inside of an Annotated object.zUse of the z> construct inside of an Annotated object is not yet supported.)�NotImplementedErrorr���selfs rh�found_in_pep593_annotated�1_IntrospectsAnnotations.found_in_pep593_annotated�s.��"��$�4�4�6�9�:L�
L�29�	30rgc31��g)zbPerform class-specific initialization at early declarative scanning32time.33 34.. versionadded:: 2.035 36Nr^)37r��	decl_scan�registryr��originating_module�key�mapped_container�38annotation�extracted_mapped_annotation�is_dataclass_fields39          rh�declarative_scan�(_IntrospectsAnnotations.declarative_scan���rgc	�r�[R"SURSUSUR5S35e)Nz4Python typing annotation is required for attribute "�.z " when primary argument(s) for "z#" construct are None or not present)�sa_exc�
ArgumentErrorr`r�)r�r�r�s   rh�_raise_for_required�+_IntrospectsAnnotations._raise_for_required�sG���"�"�����~�Q�s�e�$��*�*�,�-�.0�
0�40�	41rgN��returnru)r�r)r�rCr�rBr��	Type[Any]r��
Optional[str]r�rur�zOptional[Type[Mapped[Any]]]r��Optional[_AnnotationScanType]r�r�r�rxr��None)r�rur�r�r�r)r`rarbrcrd�classmethodr�r�r�r�rfr^rgrhr~r~�s����I�����42��)�����	�43*���
�6��2��&C��!��44��&45rgr~c��\rSrSr%SrS\S'S\S'S\S'S\S	'S\S46'S\S'S\S
'S\S'SSjr\SSj5rSr	g)�_AttributeOptions��z�define Python-local attribute behavior options common to all47:class:`.MapperProperty` objects.48 49Currently this includes dataclass-generation arguments.50 51.. versionadded:: 2.052 53zUnion[_NoArg, bool]�dataclasses_init�dataclasses_reprzUnion[_NoArg, Any]�dataclasses_defaultz Union[_NoArg, Callable[[], Any]]�dataclasses_default_factory�dataclasses_compare�dataclasses_kw_onlyzUnion[_NoArg, bool, None]�dataclasses_hashz&Union[_NoArg, Mapping[Any, Any], None]�dataclasses_dataclass_metadatac��^�0nUR[RLaURUS'UR[RLaURUS'UR[RLaURUS'UR54[RLaUR55US'UR[RLaURUS'UR[RLaURUS'UR[RLaURUS'UR[RLaURUS'SU;a$[US5(a[S	U<S563S5 SU;aCUS(d9SU;a3[US5(d SU;aURS5mU4SjUS'[R"S
0UD6$)z<Return a ``dataclasses.Field`` object given these arguments.�default_factory�default�init�repr�compare�kw_only�hash�metadatazBCallable object passed to the ``default`` parameter for attribute a� in a ORM-mapped Dataclasses context is ambiguous, and this use will raise an error in a future release.  If this callable is intended to produce Core level INSERT default values for an underlying ``Column``, use the ``mapped_column.insert_default`` parameter instead.  To establish this callable as providing a default value for instances of the dataclass itself, use the ``default_factory`` dataclasses parameter.z2.0c�>�T$r�r^)r�s�rh�<lambda>�7_AttributeOptions._as_dataclass_field.<locals>.<lambda>s���Grgr^)r�r/�NO_ARGr�r�r�r�r�r�r��callabler5�pop�dataclasses�field)r�r��kwr�s   @rh�_as_dataclass_field�%_AttributeOptions._as_dataclass_field�s���� ���+�+�6�=�=�@�$(�$D�$D�B� �!��#�#�6�=�=�8� �4�4�B�y�M�� � ��
�
�5��.�.�B�v�J�� � ��
�
�5��.�.�B�v�J��#�#�6�=�=�8� �4�4�B�y�M��#�#�6�=�=�8� �4�4�B�y�M�� � ��
�
�5��.�.�B�v�J��.�.�f�m�m�C�!�@�@�B�z�N���?�x��9�
�6�6�
�� �G�$=�	=��
�
�b�L��v�J��R���R�	�]�+�+�!��+��f�f�Y�'�G�$3�B� �!�� � �&�2�&�&rgc��[U[5(aURRU5nXU4$U[R57LaXU4$UbS5eX4$)z�given attribute key, annotation, and value from a class, return58the argument tuple we would pass to dataclasses.make_dataclass()59for this attribute.60 61z/Mapped[] received without a mapping declaration)�62isinstance�_DCAttributeOptions�_attribute_optionsr�r/r�)r�r�r�r��elem�dc_fields      rh�!_get_arguments_for_make_dataclass�3_AttributeOptions._get_arguments_for_make_dataclasssi�� �d�/�0�0��.�.�B�B�3�G�H��X�.�.�
����
&��T�*�*�
�
)�
L�K�K�5��$�$rgr^N)r�rur�r)63r�rur�rTr��
Optional[Any]r�rr�z_Union[Tuple[str, _AnnotationScanType], Tuple[str, _AnnotationScanType, dataclasses.Field[Any]]])64r`rarbrc�__doc__r|r�r�r�rfr^rgrhr�r��s����*�)�)�)�+�+�!A�A�,�,�,�,�/�/�$J�J�1'�f�%%�
�%%�(�%%�(�	%%�65�%%�66�
%%��%%rgr�Fc�4�\rSrSr%SrSrS\S'S\S'Srg)	r�iHa_mixin for descriptors or configurational objects that include dataclass67field options.68 69This includes :class:`.MapperProperty`, :class:`._MapsColumn` within70the ORM, but also includes :class:`.AssociationProxy` within ext.71Can in theory be used for other descriptors that serve a similar role72as association proxy.   (*maybe* hybrids, not sure yet.)73 74r^r�r�rx�_has_dataclass_argumentsN)r`rarbrcr�rdr|rfr^rgrhr�r�Hs!����I�)�)��#�"rgr�c�D�\rSrSrSrSr\SSj5r\SSj5rSr	g)	�_MapsColumnsi_z�interface for declarative-capable construct that delivers one or more75Column objects to the declarative process to be part of a Table.76r^c��[5e)zAreturn a MapperProperty to be assigned to the declarative mapping�r�r�s rh�mapper_property_to_assign�&_MapsColumns.mapper_property_to_assignfs
��"�#�#rgc��[5e)zVA list of Column objects that should be declaratively added to the77new Table object.78 79r�r�s rh�columns_to_assign�_MapsColumns.columns_to_assignks
��"�#�#rgN)r�zOptional[MapperProperty[_T]])r�zList[Tuple[Column[_T], int]])80r`rarbrcr�rd�propertyr�r�rfr^rgrhr�r�_s4����I�
�$��$��$��$rgr�c��\rSrSr%SrSrS\RR4S\RR4/r81S\S'\(dSr
S	rS82\S'S\S'S
\S'SrS\S'S\S'S\S'S#SjrS$SjrS%SjrS&S'SjjrS(SjrS)SjrS*S+SjjrS,Sjr\S-Sj5rS,SjrS)SjrS.S jrS/S!jrS"rg)0�MapperPropertyi}a�Represent a particular class attribute mapped by :class:`_orm.Mapper`.83 84The most common occurrences of :class:`.MapperProperty` are the85mapped :class:`_schema.Column`, which is represented in a mapping as86an instance of :class:`.ColumnProperty`,87and a reference to another class produced by :func:`_orm.relationship`,88represented in the mapping as an instance of89:class:`.Relationship`.90 91)�_configure_started�_configure_finishedr�r��parentr��info�docr�r�rS�_cache_key_traversalNTzPropComparator[_T]�92comparatorru�Mapper[Any]Frx�_links_to_entityr�r�rQr�c��0$)a�Info dictionary associated with the object, allowing user-defined93data to be associated with this :class:`.InspectionAttr`.94 95The dictionary is generated when first accessed.  Alternatively,96it can be specified as a constructor argument to the97:func:`.column_property`, :func:`_orm.relationship`, or98:func:`.composite`99functions.100 101.. seealso::102 103    :attr:`.QueryableAttribute.info`104 105    :attr:`.SchemaItem.info`106 107r^r�s rh�_memoized_attr_info�"MapperProperty._memoized_attr_info�s	��"�	rgc��g)z�Called by Query for the purposes of constructing a SQL statement.108 109Each MapperProperty associated with the target mapper processes the110statement referenced by the query context, adding columns and/or111criterion as appropriate.112 113Nr^)r��context�query_entity�path�adapter�kwargss      rh�setup�MapperProperty.setup�r�rgc��g)zSProduce row processing functions and append to the given114set of populators lists.115 116Nr^)r�r�r�r��mapper�resultr��117populatorss        rh�create_row_processor�#MapperProperty.create_row_processor�r�rgc��[S5$)afIterate through instances related to the given instance for118a particular 'cascade', starting with this MapperProperty.119 120Return an iterator3-tuples (instance, mapper, state).121 122Note that the 'cascade' collection on this MapperProperty is123checked first for the given type before cascade_iterator is called.124 125This method typically only applies to Relationship.126 127r^)�iter)r��type_�state�dict_�visited_states�halt_ons      rh�cascade_iterator�MapperProperty.cascade_iterators
��,�B�x�rgc��Xlg)z�Set the parent mapper that references this MapperProperty.128 129This method is overridden by some subclasses to perform extra130setup when the mapper is first known.131 132N)r�)r�r�r�s   rh�133set_parent�MapperProperty.set_parents	���rgc��g)a�Hook called by the Mapper to the property to initiate134instrumentation of the class attribute managed by this135MapperProperty.136 137The MapperProperty here will typically call out to the138attributes module to set up an InstrumentedAttribute.139 140This step is the first of two steps to set up an InstrumentedAttribute,141and is called early in the mapper setup process.142 143The second step is typically the init_class_attribute step,144called from StrategizedProperty via the post_instrument_class()145hook.  This step assigns additional state to the InstrumentedAttribute146(specifically the "impl") which has been determined after the147MapperProperty has determined what kind of persistence148management it needs to do (e.g. scalar, object, collection, etc).149 150Nr^�r�r�s  rh�instrument_class�MapperProperty.instrument_class#r�rgc��SUlSUlU(a[nO[nU(aX:waSUlXlgSUlX0lg)NFT)r�r��#_DEFAULT_READONLY_ATTRIBUTE_OPTIONS�_DEFAULT_ATTRIBUTE_OPTIONSr�r�)r��attribute_options�_assume_readonly_dc_attributes�
default_attrss    rh�__init__�MapperProperty.__init__7sF��151#(���#(�� �)�?�M�6�M��!2�!C�,0�D�)�&7�#�,1�D�)�&3�#rgc�@�SUlUR5 SUlg)z�Called after all mappers are created to assemble152relationships between mappers and perform other post-mapper-creation153initialization steps.154 155 156TN)r��do_initr�r�s rhr��MapperProperty.initKs��#'�������#'�� rgc�V�[URRUR5$)a>Return the class-bound descriptor corresponding to this157:class:`.MapperProperty`.158 159This is basically a ``getattr()`` call::160 161    return getattr(self.parent.class_, self.key)162 163I.e. if this :class:`.MapperProperty` were named ``addresses``,164and the class to which it is mapped is ``User``, this sequence165is possible::166 167    >>> from sqlalchemy import inspect168    >>> mapper = inspect(User)169    >>> addresses_property = mapper.attrs.addresses170    >>> addresses_property.class_attribute is User.addresses171    True172    >>> User.addresses.property is addresses_property173    True174 175 176)�getattrr��class_r�r�s rh�class_attribute�MapperProperty.class_attributeVs��0�t�{�{�)�)�4�8�8�4�4rgc��g)z�Perform subclass-specific initialization post-mapper-creation177steps.178 179This is a template method called by the ``MapperProperty``180object's init() method.181 182Nr^r�s rhr�MapperProperty.do_initpr�rgc��g)a�Perform instrumentation adjustments that need to occur183after init() has completed.184 185The given Mapper is the Mapper invoking the operation, which186may not be the same Mapper as self.parent in an inheritance187scenario; however, Mapper will always at least be a sub-mapper of188self.parent.189 190This method is typically used by StrategizedProperty, which delegates191it to LoaderStrategy.init_class_attribute() to perform final setup192on the class-bound InstrumentedAttribute.193 194Nr^rs  rh�post_instrument_class�$MapperProperty.post_instrument_classyr�rgc	��g)z_Merge the attribute represented by this ``MapperProperty``195from source to destination object.196 197Nr^)	r��session�source_state�source_dict�198dest_state�	dest_dict�load�199_recursive�_resolve_conflict_maps	         rh�merge�MapperProperty.merge�r�rgc�b�SURR[U5[USS54-$)Nz<%s at 0x%x; %s>r�zno key)�	__class__r`�idrr�s rh�__repr__�MapperProperty.__repr__�s4��!��N�N�#�#��t�H��D�%��*�%200�201�	202rg)r�r�r�r�r��r�rQ�r�r@r�r?r�rFr��Optional[ORMAdapter]r�rr�r��r�r@r�r?r�rFr�r�r��Result[Any]r�r,r�rDr�r�r�)r�rur��InstanceState[Any]r�r:r�zSet[InstanceState[Any]]r�z.Optional[Callable[[InstanceState[Any]], bool]]r�zGIterator[Tuple[object, Mapper[Any], InstanceState[Any], _InstanceDict]])r�r�r�rxr�r��r�r�r�r��NF)rzOptional[_AttributeOptions]r	rxr�r��r�r�)r�zInstrumentedAttribute[_T])rrHrr/rr:rr/rr:r rxr!zDict[Any, object]r"z#Dict[_IdentityKeyType[Any], object]r�r�r�)r`rarbrcr�rdr.�ExtendedInternalTraversal�dp_has_cache_key�	dp_stringr�r|r�cascade�is_property�_is_relationshipr�r�r�r�r�rrr�r�rrrr#r(rfr^rgrhr�r�}s:��	�	�I�203�8�5�5�F�F�G�	��2�2�<�<�=�4��0��204����K��205#�"�C�206
�H�!���6������207��'�208�O�� �&� ��$��%�	�209&���
�210�� 
� �
�$�
�%�	
�211�
��

�&�
�#�
�212�
�*CG�
���"���	�2130��@�
�214��0��,:>�/4�4�6�4�)-�4�215�	4�(	(��5��5�2�
����)��#�	�216'��!�
���&�� C��217�� 218rgr�c��\rSrSr%SrSrSrS\S'S\S'S	\S219'SS Sjjr\	RS!S
j5rS"SjrS#Sjr
S$Sjr\	RS%Sj5rSS&Sjjr\	RS'Sj5r\	RS(Sj5r\S)Sj5r\S*Sj5r\S+Sj5r\"\R4\5r\"\R4\5r\"\R4\5r\R>(aS,Sjr S,Sjr!S-Sjr"S.Sjr#SS/Sjjr$SS/Sjjr%Sr&g)0�PropComparatori�aDefines SQL operations for ORM mapped attributes.220 221SQLAlchemy allows for operators to222be redefined at both the Core and ORM level.  :class:`.PropComparator`223is the base class of operator redefinition for ORM-level operations,224including those of :class:`.ColumnProperty`,225:class:`.Relationship`, and :class:`.Composite`.226 227User-defined subclasses of :class:`.PropComparator` may be created. The228built-in Python comparison and math operator methods, such as229:meth:`.operators.ColumnOperators.__eq__`,230:meth:`.operators.ColumnOperators.__lt__`, and231:meth:`.operators.ColumnOperators.__add__`, can be overridden to provide232new operator behavior. The custom :class:`.PropComparator` is passed to233the :class:`.MapperProperty` instance via the ``comparator_factory``234argument. In each case,235the appropriate subclass of :class:`.PropComparator` should be used::236 237    # definition of custom PropComparator subclasses238 239    from sqlalchemy.orm.properties import (240        ColumnProperty,241        Composite,242        Relationship,243    )244 245 246    class MyColumnComparator(ColumnProperty.Comparator):247        def __eq__(self, other):248            return self.__clause_element__() == other249 250 251    class MyRelationshipComparator(Relationship.Comparator):252        def any(self, expression):253            "define the 'any' operation"254            # ...255 256 257    class MyCompositeComparator(Composite.Comparator):258        def __gt__(self, other):259            "redefine the 'greater than' operation"260 261            return sql.and_(262                *[263                    a > b264                    for a, b in zip(265                        self.__clause_element__().clauses,266                        other.__composite_values__(),267                    )268                ]269            )270 271 272    # application of custom PropComparator subclasses273 274    from sqlalchemy.orm import column_property, relationship, composite275    from sqlalchemy import Column, String276 277 278    class SomeMappedClass(Base):279        some_column = column_property(280            Column("some_column", String),281            comparator_factory=MyColumnComparator,282        )283 284        some_relationship = relationship(285            SomeOtherClass, comparator_factory=MyRelationshipComparator286        )287 288        some_composite = composite(289            Column("a", String),290            Column("b", String),291            comparator_factory=MyCompositeComparator,292        )293 294Note that for column-level operator redefinition, it's usually295simpler to define the operators at the Core level, using the296:attr:`.TypeEngine.comparator_factory` attribute.  See297:ref:`types_operators` for more detail.298 299.. seealso::300 301    :class:`.ColumnProperty.Comparator`302 303    :class:`.Relationship.Comparator`304 305    :class:`.Composite.Comparator`306 307    :class:`.ColumnOperators`308 309    :ref:`types_operators`310 311    :attr:`.TypeEngine.comparator_factory`312 313��prop�
_parententity�_adapt_to_entity�orm_prop_comparator�_InternalEntityType[Any]r=�Optional[AliasedInsp[Any]]r>z,RODescriptorReference[MapperProperty[_T_co]]r<Nc�<�XlU=(d UUlX0lgr�r;)r�r<�parentmapper�adapt_to_entitys    rhr�PropComparator.__init__314s���	�,�<���� /�rgc��UR$)z�Return the :class:`.MapperProperty` associated with this315:class:`.PropComparator`.316 317 318Return values here will commonly be instances of319:class:`.ColumnProperty` or :class:`.Relationship`.320 321 322)r<r�s rhr��PropComparator.propertys���y�y�rgc��[SU-5e)Nz%rr�r�s rh�__clause_element__�!PropComparator.__clause_element__!s��!�$��+�.�.rgc�<�[SUR55U4/$)z�Receive a SQL expression that represents a value in the SET323clause of an UPDATE statement.324 325Return a tuple that can be passed to a :class:`_expression.Update`326construct.327 328rP)rrI)r��values  rh�_bulk_update_tuples�"PropComparator._bulk_update_tuples$s#���*�D�,C�,C�,E�F��N�O�Orgc�P�URURURU5$)zzReturn a copy of this PropComparator which will use the given329:class:`.AliasedInsp` to produce corresponding expressions.330)r&r<r=)r�rDs  rhrD�PropComparator.adapt_to_entity1s!���~�~�d�i�i��);�);�_�M�Mrgc�.�URR$)zRlegacy; this is renamed to _parententity to be331compatible with QueryableAttribute.)r=r�r�s rh�
_parentmapper�PropComparator._parentmapper9s���!�!�(�(�(rgc�P�URRR"U40UD6$r�)r<r��_criterion_exists�r��	criterionr�s   rhrU� PropComparator._criterion_exists?s$��332�y�y�#�#�5�5�i�J�6�J�Jrgc�J�URcgURR$)zbProduce a callable that adapts column expressions333to suit an aliased version of this comparator.334 335N)r>�_orm_adapt_elementr�s rhr��PropComparator.adapterFs%��� � �(���(�(�;�;�;rgc�.�URR$r�)r<r�r�s rhr��PropComparator.infoQs���y�y�~�~�rgc�(�UR"U40UD6$r�)�any)�a�br�s   rh�_any_op�PropComparator._any_opUs���u�u�Q�!�&�!�!rgc�(�UR"U40UD6$r�)�has)�left�otherr�s   rh�_has_op�PropComparator._has_opYs���x�x��(��(�(rgc�$�URU5$r�)�of_type)r`rs  rh�_of_type_op�PropComparator._of_type_op]s���y�y�� � rgc��gr�r^�r��oprgr�s    rh�operate�PropComparator.operateg���!$rgc��gr�r^ros    rh�reverse_operate�PropComparator.reverse_operatekrsrgc�B�UR[RU5$)a5Redefine this object in terms of a polymorphic subclass,336:func:`_orm.with_polymorphic` construct, or :func:`_orm.aliased`337construct.338 339Returns a new PropComparator from which further criterion can be340evaluated.341 342e.g.::343 344    query.join(Company.employees.of_type(Engineer)).filter(345        Engineer.name == "foo"346    )347 348:param \class_: a class or mapper indicating that criterion will be349    against this specific subclass.350 351.. seealso::352 353    :ref:`orm_queryguide_joining_relationships_aliased` - in the354    :ref:`queryguide_toplevel`355 356    :ref:`inheritance_of_type`357 358)rqr:�359of_type_op)r�rs  rhrk�PropComparator.of_typeos��4�|�|�N�5�5�v�>�>rgc�D�UR"[R/UQ76$)a�Add additional criteria to the ON clause that's represented by this360relationship attribute.361 362E.g.::363 364 365    stmt = select(User).join(366        User.addresses.and_(Address.email_address != "foo")367    )368 369    stmt = select(User).options(370        joinedload(User.addresses.and_(Address.email_address != "foo"))371    )372 373.. versionadded:: 1.4374 375.. seealso::376 377    :ref:`orm_queryguide_join_on_augmented`378 379    :ref:`loader_option_criteria`380 381    :func:`.with_loader_criteria`382 383)rqr,�and_)r��criterias  rhr{�PropComparator.and_�s��8�|�|�I�N�N�6�X�6�6rgc�F�UR"[RU40UD6$)a�Return a SQL expression representing true if this element384references a member which meets the given criterion.385 386The usual implementation of ``any()`` is387:meth:`.Relationship.Comparator.any`.388 389:param criterion: an optional ClauseElement formulated against the390  member class' table or attributes.391 392:param \**kwargs: key/value pairs corresponding to member class393  attribute names which will be compared via equality to the394  corresponding values.395 396)rqr:�any_oprVs   rhr_�PropComparator.any�� ��(�|�|�N�1�1�9�G��G�Grgc�F�UR"[RU40UD6$)a�Return a SQL expression representing true if this element397references a member which meets the given criterion.398 399The usual implementation of ``has()`` is400:meth:`.Relationship.Comparator.has`.401 402:param criterion: an optional ClauseElement formulated against the403  member class' table or attributes.404 405:param \**kwargs: key/value pairs corresponding to member class406  attribute names which will be compared via equality to the407  corresponding values.408 409)rqr:�has_oprVs   rhre�PropComparator.has�r�rg)r>r=r<r�)r<zMapperProperty[_T]rCr@rDrA)r�zMapperProperty[_T_co])r�zroles.ColumnsClauseRole)rLrr�z(Sequence[Tuple[_DMLColumnArgument, Any]])rDzAliasedInsp[Any]r��PropComparator[_T_co])r�r�)rW�)Optional[_ColumnExpressionArgument[bool]]r�rr��ColumnElement[Any])r�zOptional[_ORMAdapterProto]r*)r`rrarr�rr�r)rfrrgrr�rr�r)r`rrrr�r)rprRrgrr�rr�r�)rz_EntityType[Any]r�r�)r|z_ColumnExpressionArgument[bool]r�zPropComparator[bool])rWr�r�rr�zColumnElement[bool])'r`rarbrcr�rd�__visit_name__r|rr+�non_memoized_propertyr�rIrMrD�ro_non_memoized_propertyrRrUr�r��staticmethodrbrhrlrr,rRrr�rx�typingrrqrurkr{r_rerfr^rgrhr:r:�sV��^�@<�I�*�N�+�+�0�0�4106�6�7;�	0� �0�/�0�4�	0�411���412� �413�/�P��P�	1�P�N�/�N�	�N�414�"�"�)�#�)�@D�K�<�K��K�415�	K�416�"�"�<�#�<�417�"�"��#���"��"��)��)��!��!��)�(�(�'�
2�F�
�)�(�(�'�
2�F��i�,�,�k�:�J�
���	%�"�	%�,/�	%�;>�	%�
�	%�	%�"�	%�+.�	%�:=�	%�
�	%�?�87�8�7�	�7�@@D�H�<�H��H�418�	H�0@D�H�<�H��H�419�	H�Hrgr:c�:�\rSrSr%SrSrSrS\S'S\S'S	\S420'SSjrSSjr	SS
jr421SSjrSSjrSSjr
SSjrS Sjr\R""\5rS\S'\S!Sj5r\S"Sj5rSrg)#�StrategizedPropertyi�a`A MapperProperty which uses selectable strategies to affect422loading behavior.423 424There is a single strategy selected by default.  Alternate425strategies can be selected at Query time through the usage of426``StrategizedOption`` objects via the Query.options() method.427 428The mechanics of StrategizedProperty are used for every Query429invocation for every mapped attribute participating in that Query,430to determine first how the attribute will be rendered in SQL431and secondly how the attribute will retrieve a value from a result432row and apply it to a mapped object.  The routines here are very433performance-critical.434 435)�_strategies�strategy�_wildcard_token�_default_path_loader_key�strategy_keyTz
ClassVar[str]�strategy_wildcard_key�_StrategyKeyr�z"Dict[_StrategyKey, LoaderStrategy]r�c�B�URS[R34$)N�:)r�r�_WILDCARD_TOKENr�s rh�_memoized_attr__wildcard_token�2StrategizedProperty._memoized_attr__wildcard_token�s(���)�)�*�!�M�,I�,I�+J�K�436�	437rgc�F�SURS[R344$)N�loaderr�)r�r�_DEFAULT_TOKENr�s rh�'_memoized_attr__default_path_loader_key�;StrategizedProperty._memoized_attr__default_path_loader_key�s0��
��*�*�+�1�]�-I�-I�,J�
K�M�438�	439rgc��SnX nURURUR4H$nXQR;dMURUn U$ U$r�)�_loader_key�_wildcard_path_loader_keyr��440attributes)r�r�r�r �search_path�path_keys      rh�_get_context_loader�'StrategizedProperty._get_context_loadersh��(,���j��441
�#�#��1�1��0�0�442�H�443�-�-�-��)�)�(�3�����!444� �rgc��URU$![a Of=fUR"U/UQ76nU"X5=URU'nU$r�)r��KeyError�_strategy_lookup)r�r�r�r�s    rh�
_get_strategy�!StrategizedProperty._get_strategysa��	��#�#�C�(�(���	��	���#�#�D�/�3�/��,/�t�>�9��������s��445�c���URX5nU(a-UR(aURUR5nOURnUR"XX6U40UD6 gr�)r�r�r��setup_query)r�r�r�r�r�r�r��strats        rhr��StrategizedProperty.setup+sW���)�)�'�8���f�o�o��&�&�v���7�E��M�M�E�
����4��	446�<B�	447rgc448���URX5nU(a-UR(aURUR5n	OURn	U	RUUUUUUUU5 gr�)r�r�r�r�)449r�r�r�r�r�r�r�r�r�r�s450          rhr��(StrategizedProperty.create_row_processor<s`���)�)�'�8���f�o�o��&�&�v���7�E��M�M�E�
�"�"���������		451rgc�R�0UlURUR5Ulgr�)r�r�r�r�r�s rhr�StrategizedProperty.do_initVs"������*�*�4�+<�+<�=��
rgc���URR(dGURRUR5(dUR452R
U5 gggr�)r��non_primary�
class_manager�_attr_has_implr�r��init_class_attributers  rhr�)StrategizedProperty.post_instrument_classZsG�����'�'��(�(�7�7����A�A��M�M�.�.�v�6�B�(rgz\collections.defaultdict[Type[MapperProperty[Any]], Dict[_StrategyKey, Type[LoaderStrategy]]]�_all_strategiesc�^^�SUU4SjjnU$)Nc��>�SUR;a/Ul[[TR	555nUTR453TU'URR
U5 U$)N�_strategy_keys)�__dict__r��tuple�sorted�itemsr��append)�dec_clsr�r�r�s  ��rh�decorate�2StrategizedProperty.strategy_for.<locals>.decorategs^��� �w�'7�'7�7�)+��&���r�x�x�z�*�+�C�,3�C����$�S�)��"�"�)�)�#�.��Nrg)r�rYr�rYr^)r�r�r�s`` rh�strategy_for� StrategizedProperty.strategy_fores���	�	��rgc��URR URHJnX0R;dM[(a[U[5(deURUnXBs $ URR5HupVX&;dMUnXbn O SnSn[R"UUUUU5e![a M�f=fr�)r��_with_polymorphic_mappers�__mro__r�r�454issubclassr�r�r��orm_exc�LoaderStrategyException)	r��requesting_propertyr��prop_cls�455strategies�
property_type�strats�intended_property_type�actual_strategys	         rhr��$StrategizedProperty._strategy_lookupss���	�"�"�<�<����H��.�.�.� �=�%�h��?�?�?�?� �0�0��:�456��%�?�*�
$�&)�%8�%8�%>�%>�%@�!�M��}�)6�&�"(�+���	&A�&*�"�"�O��-�-���"���457�	458�� ����s�)B?�?459C
�C
)r�r�N)r�z460Tuple[str])r�zTuple[str, Tuple[str]])r�r@r�rFr��Optional[_LoadElement])r�r�r��LoaderStrategyr+r-r2r0)r�rr�zCallable[[_TLS], _TLS])r��MapperProperty[Any]r�rr�rZ)r`rarbrcr�rd�
inherit_cacher|r�r�r�r�r�r�rr�collections�defaultdict�dictr�r�r�r�rfr^rgrhr�r��sV��� �I��M�(�(���3�3�461�462463�	�464��&��.D��	��6�465� �466�$�467�%�	468�469&�470��
471�472�473�"474� �475�$�476�%�	477�478�479��
480�&�481�#�482�483�484�4>�7�	����%���&������485�"5�486�=@�487�	�488��489rgr�c�P�\rSrSrSrSrSrSrSrSr	Sr490SrSrSSjr
Srg)�	ORMOptioni�a�Base class for option objects that are passed to ORM queries.491 492These options may be consumed by :meth:`.Query.options`,493:meth:`.Select.options`, or in a more general sense by any494:meth:`.Executable.options` method.   They are interpreted at495statement compile time or execution time in modern use.  The496deprecated :class:`.MapperOption` is consumed at ORM query construction497time.498 499.. versionadded:: 1.4500 501r^Fc��UbU$U$)a�adapt this option to the "uncached" version of itself in a502loader strategy context.503 504given "self" which is an option from a cached query, as well as the505corresponding option from the uncached version of the same query,506return the option we should use in a new query, in the context of a507loader strategy being asked to load related rows on behalf of that508cached query, which is assumed to be building a new query based on509entities passed to us from the cached query.510 511Currently this routine chooses between "self" and "uncached" without512manufacturing anything new. If the option is itself a loader strategy513option which has a path, that path needs to match to the entities being514passed to us by the cached query, so the :class:`_orm.Load` subclass515overrides this to return "self". For all other options, we return the516uncached form which may have changing state, such as a517with_loader_criteria() option which will very often have new state.518 519This routine could in the future involve520generating a new option based on both inputs if use cases arise,521such as if with_loader_criteria() needed to match up to522``AliasedClass`` instances given in the parent query.523 524However, longer term it might be better to restructure things such that525``AliasedClass`` entities are always matched up on their cache key,526instead of identity, in things like paths and such, so that this whole527issue of "the uncached option does not match the entities" goes away.528However this would make ``PathRegistry`` more complicated and difficult529to debug as well as potentially less performant in that it would be530hashing enormous cache keys rather than a simple AliasedInsp. UNLESS,531we could get cache keys overall to be reliably hashed into something532like an md5 key.533 534.. versionadded:: 1.4.41535 536r^)r�r��uncached_opts   rh�'_adapt_cached_option_to_uncached_option�1ORMOption._adapt_cached_option_to_uncached_option�s��N�#����KrgN)r�rAr�r�r�r�)r`rarbrcr�rd�_is_legacy_option�propagate_to_loaders�_is_core�_is_user_defined�_is_compile_state�_is_criteria_option�_is_strategy_optionr�rfr^rgrhr�r��s[����I��� ����H���������*�#�*�3<�*�	�*rgr�c�@�\rSrSrSrSrSrSSjrS	SjrSr	g)537�CompileStateOptioni�a�base for :class:`.ORMOption` classes that affect the compilation of538a SQL query and therefore need to be part of the cache key.539 540.. note::  :class:`.CompileStateOption` is generally non-public and541   should not be used as a base class for user-defined options; instead,542   use :class:`.UserDefinedOption`, which is easier to use as it does not543   interact with ORM compilation internals or caching.544 545:class:`.CompileStateOption` defines an internal attribute546``_is_compile_state=True`` which has the effect of the ORM compilation547routines for SELECT and other statements will call upon these options when548a SQL string is being compiled. As such, these classes implement549:class:`.HasCacheKey` and need to provide robust ``_cache_key_traversal``550structures.551 552The :class:`.CompileStateOption` class is used to implement the ORM553:class:`.LoaderOption` and :class:`.CriteriaOption` classes.554 555.. versionadded:: 1.4.28556 557 558r^Tc��g)z�Apply a modification to a given :class:`.ORMCompileState`.559 560This method is part of the implementation of a particular561:class:`.CompileStateOption` and is only invoked internally562when an ORM query is compiled.563 564Nr^)r��
compile_states  rh�process_compile_state�(CompileStateOption.process_compile_stater�rgc��g)a9Apply a modification to a given :class:`.ORMCompileState`,565given entities that were replaced by with_only_columns() or566with_entities().567 568This method is part of the implementation of a particular569:class:`.CompileStateOption` and is only invoked internally570when an ORM query is compiled.571 572.. versionadded:: 1.4.19573 574Nr^�r�r��mapper_entitiess   rh�'process_compile_state_replaced_entities�:CompileStateOption.process_compile_state_replaced_entities575r�rgN)r�r@r�r��r�r@r�zSequence[_MapperEntity]r�r�)576r`rarbrcr�rdr�r�r�rfr^rgrhr�r��s:���.�I�����&��1��577�	rgr�c�2�\rSrSrSrSrSSjrSrg)�LoaderOptioniz`Describe a loader modification to an ORM statement at compilation time.578 579.. versionadded:: 1.4580 581r^c�&�URU5 gr�)r�r�s   rhr��4LoaderOption.process_compile_state_replaced_entities%s��582	
�"�"�=�1rgNr�)r`rarbrcr�rdr�rfr^rgrhr�r�s/����I�2�&�2�1�2�583�	2rgr�c�*�\rSrSrSrSrSrSSjrSrg)�CriteriaOptioni-zhDescribe a WHERE criteria modification to an ORM statement at584compilation time.585 586.. versionadded:: 1.4587 588r^Tc��g)zOupdate additional entity criteria options in the given589attributes dictionary.590 591Nr^)r�r�s  rh�get_global_criteria�"CriteriaOption.get_global_criteria9r�rgN)r�zDict[str, Any]r�r�)	r`rarbrcr�rdr�r�rfr^rgrhr�r�-s����I���rgr�c�8�\rSrSrSrSrSrSrSrSS	Sjjr	Sr592g)593�UserDefinedOptioni@zvBase class for a user-defined option that can be consumed from the594:meth:`.SessionEvents.do_orm_execute` event hook.595 596��payloadFTNc��Xlgr�r)r�rs  rhr�UserDefinedOption.__init__Ss���rgr�)rr�)r`rarbrcr�rdr�r�r�rrfr^rgrhrr@s/���597�I����� ����rgrz1.4aKThe :class:`.MapperOption class is deprecated and will be removed in a future release.   For modifications to queries on a per-execution basis, use the :class:`.UserDefinedOption` class to establish state within a :class:`.Query` or other Core statement, then use the :meth:`.SessionEvents.before_orm_execute` hook to consume them.)�constructorc�:�\rSrSrSrSrSrSrS	SjrS	Sjr	Sr598g)599�MapperOptioniWz"Describe a modification to a Queryr^TFc��g)z8Apply a modification to the given :class:`_query.Query`.Nr^�r��querys  rh�
process_query�MapperOption.process_queryor�rgc�&�URU5 g)a?same as process_query(), except that this option may not600apply to the given query.601 602This is typically applied during a lazy load or scalar refresh603operation to propagate options stated in the original Query to the604new Query being used for the load.  It occurs for those options that605specify propagate_to_loaders=True.606 607N)rr608s  rh�process_query_conditionally�(MapperOption.process_query_conditionallyrs��	
���5�!rgN)rz609Query[Any]r�r�)r`rarbrcr�rdr�r�rrrfr^rgrhrrWs(��-��I��� ���G�"rgrc��\rSrSr%SrSrS\S'S
SjrSSjrSSjr	SS	jr610SS611jrSrg)r�i�a�Describe the loading behavior of a StrategizedProperty object.612 613The ``LoaderStrategy`` interacts with the querying process in three614ways:615 616* it controls the configuration of the ``InstrumentedAttribute``617  placed on a class to handle the behavior of the attribute.  this618  may involve setting up class-level callable functions to fire619  off a select operation when the attribute is first accessed620  (i.e. a lazy load)621 622* it processes the ``QueryContext`` at statement construction time,623  where it can modify the SQL statement that is being produced.624  For example, simple column attributes will add their represented625  column to the list of selected columns, a joined eager loader626  may establish join clauses to add to the statement.627 628* It produces "row processor" functions at result fetching time.629  These "row processor" functions populate a particular attribute630  on a particular mapped instance.631 632)�parent_property�is_class_levelr�r�r��
strategy_optszClassVar[List[_StrategyKey]]r�c��XlSUlURRUlURRUlX l[U5Ulgr1)rrr�r�r�r�r)r�r�r�s   rhr�LoaderStrategy.__init__�sK�� &��#����*�*�1�1����'�'�+�+���(��!�,�/��rgc��gr�r^rs  rhr��#LoaderStrategy.init_class_attribute�s��rgc��g)z�Establish column and other state for a given QueryContext.633 634This method fulfills the contract specified by MapperProperty.setup().635 636StrategizedProperty delegates its setup() method637directly to this method.638 639Nr^)r�r�r�r��loadoptr�r�s       rhr��LoaderStrategy.setup_query�r�rgc	��g)z�Establish row processing functions for a given QueryContext.640 641This method fulfills the contract specified by642MapperProperty.create_row_processor().643 644StrategizedProperty delegates its create_row_processor() method645directly to this method.646 647Nr^)	r�r�r�r�rr�r�r�r�s	         rhr��#LoaderStrategy.create_row_processor�r�rgc�,�[UR5$r�)rurr�s rh�__str__�LoaderStrategy.__str__�s���4�'�'�(�(rg)rr�r�rr�rN)r�r�r�r�r0)r�r@r�r?r�rFrr�r�r,r�rr�r�)r�r@r�r?r�rFrr�r�r�r�r.r�r,r�rDr�r�r�)
r`rarbrcr�rdr|rr�r�r�rrfr^rgrhr�r��s����.�I�1�0�0�)�0�9E�0�
��&��$��%�	�648(��&�
���649��$� ��$��%�	�650(���
���&��#��651��*)rgr�)�r��652__future__rr�r�r�rrrrrr	r653rrr
rrrrrrrrr�rr�r�baserrrrrrr r!r"r#r$r%r&r'r)r�r*r+�sqlr,r-r.�sql.baser/r0�
sql.cache_keyr1�
sql.operatorsr2�654sql.schemar3�sql.type_apir4r5�util.typingr6r7�_typingr8r9r:r;r<r�r=r>r�r?r@rA�decl_apirB�	decl_baserC�loadingrDr�rErFrrGrrHr�rI�strategy_optionsrJrKrL�
engine.resultrM�sql._typingrNrOrPrQrR�sql.visitorsrSrTr�rUrWrY�
StatementRoler\�ColumnsClauseRole�TypedColumnsClauseRolerjrm�StrictFromClauseRolerprsr~r�r�rrr�r��_self_inspects�
MemoizedSlotsr�r:r�r�r�r�r�r�deprecated_clsrr�r^rgrh�<module>r:sv��	�#���
����������������� �����6�.�&�&�2�:�*�(�"�&�.�(�@�"���������'�'�+��%�"�/�#�	���$�)�&�,�)�1��&�(�%�&�1�'��5�� �$�.�!� �&�7�4�0�'�,�5�1��S�#�X����T������s�d�3���v�3�4���u�*�*��K�	���U�9�9�"�=�K�0�!5�b�!9�0�655I��2�2�I�6562�9�2�)657�)658�Xl%�659�l%�^/�660�M�M�661�M�M�662�M�M�663�M�M�664�M�M�665�M�M�666�M�M�667�M�M�	��'8�	�668�M�M�669�M�M�670�M�M�671�M�M�672�M�M�673�M�M�674�M�M�	'�#�#�#�.$�&�(8��(<�$�<���_675����R������_676��_677�D	���rH�%�e�,�g�e�n�o�rH��rH�j	|678�.��,�|679�~M� �M�`4��i�4�n2�%�2�"�'��&�	��.���	�F��	�"�9�"�	�"�>X)�X)rg
codekingpro/portable-devtools · Team Ai