Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2��j����"�%SrSSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJ	r	 SS	KJ3r4 SS5KJr SSKJr SSKJ
r
 SS
KrSSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSK J!r! SSKJr" SSKJ#r# SS KJ$r$ SS!K%J&r& SS"K%J'r' \(aZSS#KJ(r( SS$KJ)r) SS%KJ*r* SS&K+J,r, SS'K+J-r- SS(KJ.r. SS)K/J0r0 SS*K1J2r2 SS+K3J4r4 SS,KJ5r5 SS-K6J7r7 SS.K8J9r9 SS/K:J;r; SS0K<J=r> SS1K<J?r? \(aS2\@S3'OS
rA\(dS
r>"S4S5\'5rB"S6S7\'\5rC\#R�"S8S9\R�\\55rF"S:S;5rG"S<S=5rHg
)>z�Defines instrumentation of instances.6 7This module is usually not directly visible to user applications, but8defines a large part of the ORM's interactivity.9 10�)�annotations)�Any)�Callable)�Dict)�Generic)�Iterable)�Optional)�Set)�Tuple)�
TYPE_CHECKING)�UnionN�)�base)�exc)�11interfaces)�_O)�is_collection_impl)�ATTR_WAS_SET)�INIT_OK)�LoaderCallableStatus)�	NEVER_SET)�NO_VALUE)�PASSIVE_NO_INITIALIZE)�PASSIVE_NO_RESULT)�PASSIVE_OFF)�SQL_OK)�PathRegistry�)�12inspection)�util)�Literal)�Protocol)�_IdentityKeyType)�
_InstanceDict)�_LoaderCallable)�
AttributeImpl)�History)�PassiveFlag)�_AdaptedCollectionProtocol)�IdentityMap)�ClassManager)�	ORMOption)�Mapper)�Session)�Row)�
async_session)�AsyncSessionz)weakref.WeakValueDictionary[int, Session]�	_sessionsc��\rSrSrSSjrSrg)�_InstanceDictProto�Pc��g�N���selfs �ZD:\code\apps\devtools\python\user_packages\Python313\site-packages\sqlalchemy/orm/state.py�__call__�_InstanceDictProto.__call__Qs���r8N)�return�Optional[IdentityMap])�__name__�13__module__�__qualname__�__firstlineno__r<�__static_attributes__r8r>r;r4r4Ps��4r>r4c�2�\rSrSrSrSSjrSrg)�_InstallLoaderCallableProto�Ta14used at result loading time to install a _LoaderCallable callable15upon a specific InstanceState, which will be used to populate an16attribute when that attribute is accessed.17 18Concrete examples are per-instance deferred column loaders and19relationship lazy loaders.20 21c��gr7r8)r:�state�dict_�rows    r;r<�$_InstallLoaderCallableProto.__call__^s��r>r8N�rJ�InstanceState[_O]rKr$rLzRow[Any]r?�None)rArBrCrD�__doc__r<rEr8r>r;rGrGTs,����&��/<��CK��	
�r>rGc��\rSrSr%SrSrS\S'SrS\S'SrS	\S22'Sr	S\S'Sr23S
\S'\Rr
S\S'SrS\S'SrS\S'S\S'S\S'SrS\S'SrS\S'SrS\S'SrS\S'SrS\S'SrS\S 'SrS!\S"'SrS#\S$'S%\S&'\(dS'rS(\S)'S*\S+'\(d\R6rS_S,jr\R<S`S-j5r\ SaS.j5r!\ SaS/j5r"\ SaS0j5r#\ SaS1j5r$\ SaS2j5r%\ SaS3j5r&\RN\RP"S45SaS5j55r)SbS6jr*\ ScS7j5r+\ SdS8j5r,\ SeS9j5r-\ SfS:j5r.\ SgS;j5r/\R<ShS<j5r0\R<SiS=j5r1\R<SjS>j5r2\R<SkS?j5r3\ SaS@j5r4\5SlSmSAjj5r6SnSoSBjjr7SpSCjr8SpSDjr9SqSEjr:\ SrSFj5r;SsSGjr<StSHjr=SuSIjr>SvSJjr?SwSKjr@SxSLjrASySMjrBSzSNjrC\5S{SOj5rDS|SPjrESlS}SQjjrFS~SRjrG\ SSSj5rHS�STjrI\ SSUj5rJ\ \R�"SVSW5SSXj55rL\ SSYj5rMS�S�SZjjrNS�S[jrOSnS�S\jjrP\5SnS�S]jj5rQS^rRg)��
InstanceState�ca�Tracks state information at the instance level.24 25The :class:`.InstanceState` is a key object used by the26SQLAlchemy ORM in order to track the state of an object;27it is created the moment an object is instantiated, typically28as a result of :term:`instrumentation` which SQLAlchemy applies29to the ``__init__()`` method of the class.30 31:class:`.InstanceState` is also a semi-public object,32available for runtime inspection as to the state of a33mapped instance, including information such as its current34status within a particular :class:`.Session` and details35about data on individual attributes.  The public API36in order to acquire a :class:`.InstanceState` object37is to use the :func:`_sa.inspect` system::38 39    >>> from sqlalchemy import inspect40    >>> insp = inspect(some_mapped_object)41    >>> insp.attrs.nickname.history42    History(added=['new nickname'], unchanged=(), deleted=['nickname'])43 44.. seealso::45 46    :ref:`orm_mapper_inspection_instancestate`47 48)�__dict__�__weakref__�class_�manager�obj�committed_state�expired_attributes�ClassManager[_O]rXNz
Optional[int]�49session_id�Optional[_IdentityKeyType[_O]]�key�runidr8zTuple[ORMOption, ...]�load_optionsr�	load_path�insert_orderzOptional[object]�_strong_obj�weakref.ref[_O]rY�Dict[str, Any]rZF�bool�modified�expired�_deleted�
_load_pending�_orphaned_outside_of_sessionT�is_instance�object�identity_tokenzOptional[Dict[str, Any]]�_last_known_valuesr4�_instance_dictc��g)z+default 'weak reference' for _instance_dictNr8r9s r;rq�InstanceState._instance_dict�s��r>�Set[str]r[z:Dict[str, Callable[[InstanceState[_O], PassiveFlag], Any]]�	callablesc��URUlX l[R"XR505Ul0Ul[5Ul	gr7)51�	__class__rWrX�weakref�ref�_cleanuprYrZ�setr[)r:rYrXs   r;�__init__�InstanceState.__init__�s8���m�m������;�;�s�M�M�2���!���"%�%��r>c52��[R"URVs0sHo[X5_M sn5$s snf)a)Return a namespace representing each attribute on53the mapped object, including its current value54and history.55 56The returned object is an instance of :class:`.AttributeState`.57This object allows inspection of the current data58within an attribute as well as attribute history59since the last flush.60 61)r �ReadOnlyPropertiesrX�AttributeState�r:r_s  r;�attrs�InstanceState.attrs�s8���&�&�7;�|�|�D�|��.��+�
+�|�D�62�	63��Ds�;c�N�URSL=(a UR(+$)zeReturn ``True`` if the object is :term:`transient`.64 65.. seealso::66 67    :ref:`session_object_states`68 69N�r_�	_attachedr9s r;�	transient�InstanceState.transient�s���x�x�4��6����$6�6r>c�D�URSL=(a UR$)zcReturn ``True`` if the object is :term:`pending`.70 71.. seealso::72 73    :ref:`session_object_states`74 75Nr�r9s r;�pending�InstanceState.pending�s���x�x�4��2�D�N�N�2r>c�j�URSL=(a UR=(a UR$)a`Return ``True`` if the object is :term:`deleted`.76 77An object that is in the deleted state is guaranteed to78not be within the :attr:`.Session.identity_map` of its parent79:class:`.Session`; however if the session's transaction is rolled80back, the object will be restored to the persistent state and81the identity map.82 83.. note::84 85    The :attr:`.InstanceState.deleted` attribute refers to a specific86    state of the object that occurs between the "persistent" and87    "detached" states; once the object is :term:`detached`, the88    :attr:`.InstanceState.deleted` attribute **no longer returns89    True**; in order to detect that a state was deleted, regardless90    of whether or not the object is associated with a91    :class:`.Session`, use the :attr:`.InstanceState.was_deleted`92    accessor.93 94.. versionadded: 1.195 96.. seealso::97 98    :ref:`session_object_states`99 100N�r_r�rjr9s r;�deleted�InstanceState.deleted�s%��8�x�x�t�#�H����H�4�=�=�Hr>c��UR$)a�Return True if this object is or was previously in the101"deleted" state and has not been reverted to persistent.102 103This flag returns True once the object was deleted in flush.104When the object is expunged from the session either explicitly105or via transaction commit and enters the "detached" state,106this flag will continue to report True.107 108.. seealso::109 110    :attr:`.InstanceState.deleted` - refers to the "deleted" state111 112    :func:`.orm.util.was_deleted` - standalone function113 114    :ref:`session_object_states`115 116)rjr9s r;�was_deleted�InstanceState.was_deleteds��&�}�}�r>c�t�URSL=(a$ UR=(a UR(+$)z�Return ``True`` if the object is :term:`persistent`.117 118An object that is in the persistent state is guaranteed to119be within the :attr:`.Session.identity_map` of its parent120:class:`.Session`.121 122.. seealso::123 124    :ref:`session_object_states`125 126Nr�r9s r;�127persistent�InstanceState.persistent)s(���x�x�t�#�L����L�t�}�}�;L�Lr>c�N�URSL=(a UR(+$)zdReturn ``True`` if the object is :term:`detached`.128 129.. seealso::130 131    :ref:`session_object_states`132 133Nr�r9s r;�detached�InstanceState.detached8s���x�x�t�#�:�D�N�N�(:�:r>zsqlalchemy.orm.sessionc��URSL=(a1 UR[RRR;$r7)r]r �	preloaded�orm_sessionr2r9s r;r��InstanceState._attachedCs7��
�O�O�4�'�
H����4�>�>�#=�#=�#G�#G�G�	134r>c�P�URnUc	0=UlnX;a	[X!'gg)zdTrack the last known value of a particular key after expiration135operations.136 137.. versionadded:: 1.3138 139N)rpr)r:r_�lkvs   r;�_track_last_known_value�%InstanceState._track_last_known_valueKs2���%�%���;�,.�.�D�#�c��>��C�H�r>c�n�UR(a[UR$g![a gf=f)a�Return the owning :class:`.Session` for this instance,140or ``None`` if none available.141 142Note that the result here can in some cases be *different*143from that of ``obj in session``; an object that's been deleted144will report as not ``in session``, however if the transaction is145still in progress, this attribute will still refer to that session.146Only when the transaction is completed does the object become147fully detached under normal circumstances.148 149.. seealso::150 151    :attr:`_orm.InstanceState.async_session`152 153N)r]r2�KeyErrorr9s r;�session�InstanceState.sessionYs;��"�?�?�
� ����1�1����
���
�s�'�1544�4c�H�[cgURnUb[U5$g)a�Return the owning :class:`_asyncio.AsyncSession` for this instance,155or ``None`` if none available.156 157This attribute is only non-None when the :mod:`sqlalchemy.ext.asyncio`158API is in use for this ORM object. The returned159:class:`_asyncio.AsyncSession` object will be a proxy for the160:class:`_orm.Session` object that would be returned from the161:attr:`_orm.InstanceState.session` attribute for this162:class:`_orm.InstanceState`.163 164.. versionadded:: 1.4.18165 166.. seealso::167 168    :ref:`asyncio_toplevel`169 170N)�_async_providerr�)r:�sesss  r;r0�InstanceState.async_sessionqs*��&�"���|�|����"�4�(�(�r>c�"�UR5$)z~Return the mapped object represented by this171:class:`.InstanceState`.172 173Returns None if the object has been garbage collected174 175)rYr9s r;rn�InstanceState.object�s���x�x�z�r>c�<�URcgURS$)a�Return the mapped identity of the mapped object.176This is the primary key identity as persisted by the ORM177which can always be passed directly to178:meth:`_query.Query.get`.179 180Returns ``None`` if the object has no primary key identity.181 182.. note::183    An object which is :term:`transient` or :term:`pending`184    does **not** have a mapped identity until it is flushed,185    even if its attributes include primary key values.186 187Nr�r_r9s r;�identity�InstanceState.identity�s���8�8����8�8�A�;�r>c��UR$)z�Return the identity key for the mapped object.188 189This is the key used to locate the object within190the :attr:`.Session.identity_map` mapping.   It contains191the identity as returned by :attr:`.identity` within it.192 193 194r�r9s r;�identity_key�InstanceState.identity_key�s
���x�x�r>c��0$r7r8r9s r;�parents�InstanceState.parents�����	r>c��0$r7r8r9s r;�_pending_mutations� InstanceState._pending_mutations�r�r>c��0$r7r8r9s r;�_empty_collections� InstanceState._empty_collections�r�r>c�.�URR$)z<Return the :class:`_orm.Mapper` used for this mapped object.)rX�mapperr9s r;r��InstanceState.mapper�s���|�|�"�"�"r>c�,�[UR5$)z�Return ``True`` if this object has an identity key.195 196This should always have the same value as the197expression ``state.persistent`` or ``state.detached``.198 199)rgr_r9s r;�has_identity�InstanceState.has_identity�s���D�H�H�~�r>c�R�URR=(d SnURR=(d SnURR=(d SnURR=(d SnUH�nUR200n	URSLn201U202(+=(a U	(+nSUlU(aUR(aU?U(aU(aUbU"X(5 O1UbU"X(5 O%U	(aUb	U"X(5 OU203(aUbU"X(5 SUlM� gr7)	�dispatch�persistent_to_detached�deleted_to_detached�pending_to_transient�persistent_to_transientrjr_r]rd)r:�statesr��to_transientr�r�r�r�rJr�r�r�s            r;�_detach_states�InstanceState._detach_states�s���
���3�3�;�t�	�&�.�.�B�B�J�d��&�/�/�D�D�L������4�4�<��	 ��E��n�n�G��i�i�4�'�G�$��4�W��J�#�E����	�	��I���.�:�/��?��+�7�*�7�:���0�<�#�G�3��1�=�$�W�4� $�E��)r>c�^�U(a[RU/U5 gS=UlUlgr7)rSr�r]rd)r:r�s  r;�_detach�InstanceState._detach�s&����(�(�$���9�15�5�D�O�d�.r>c�$�UR5 gr7)r�r9s r;�_dispose�InstanceState._dispose�s�����r>c��URbeUR5nUcgAURUR5 SUlg)z�Force this InstanceState to act as though its weakref has204been GC'ed.205 206this is used for test code that has to test reactions to objects207being GC'ed.  We can't reliably force GCs to happen under all208CI circumstances.209 210Nc��gr7r8r8r>r;�<lambda>�2InstanceState._force_dereference.<locals>.<lambda>s��4r>)rdrYrz)r:rYs  r;�_force_dereference� InstanceState._force_dereferencesC�����'�'�'��h�h�j���;����
�
�d�h�h����r>c�|�[cgUR5nUbURU5 U?S=UlUlg)z�Weakref callback cleanup.211 212This callable cleans out the state when it is being garbage213collected.214 215this _cleanup **assumes** that there are no strong refs to us!216Will not work otherwise!217 218N)�dictrq�
_fast_discardr]rd)r:ry�
instance_dicts   r;rz�InstanceState._cleanupsE���<���+�+�-�
��$��'�'��-��#�.2�1���$�*r>c�X�UR5nUb[R"U5$0$)aGReturn the instance dict used by the object.219 220Under normal circumstances, this is always synonymous221with the ``__dict__`` attribute of the mapped object,222unless an alternative instrumentation system has been223configured.224 225In the case that the actual object has been garbage226collected, this accessor returns a blank dictionary.227 228)rYrr�)r:�os  r;r��InstanceState.dict8s*��
�H�H�J���=��%�%�a�(�(��Ir>c�B�USUSUSSpCnURnURRX$U5 UR"USS0UD6 g! [R229"5 URR
X$U5 SSS5 g!,(df   g=f=f)Nrrr)rXr��init�
original_initr �safe_reraise�init_failure)�mixed�kwargsr:�instance�argsrXs      r;�_initialize_instance�"InstanceState._initialize_instanceKs���$�Q�x��q��5���9����,�,�������d�&�1�	B��!�!�5���9�7��7��	B��"�"�$�� � �-�-�d�&�A�%�$�$�$�s)�A�B�%B�B�230B	�B�Bc�h�URURRXRU5$r7)rX�impl�get_historyr�)r:r_�passives   r;r��InstanceState.get_historyWs(���|�|�C� �%�%�1�1�$�	�	�7�K�Kr>c�4�URUR$r7)rXr�r�s  r;�get_impl�InstanceState.get_implZs���|�|�C� �%�%�%r>c�l�XR;a[5URU'URU$r7)r��PendingCollectionr�s  r;�_get_pending_mutation�#InstanceState._get_pending_mutation]s2���-�-�-�+<�+>�D�#�#�C�(��&�&�s�+�+r>c�>^�TR5TRTRTRS.nUR	U4SjS55 TR231(aTR232R
5US'TRRTU5US'U$)N)r�rWrZr[c3�j># �UH(nUTR;dMUTRU4v� M* g7fr7)rU)�.0�kr:s  �r;�	<genexpr>�-InstanceState.__getstate__.<locals>.<genexpr>is:����233����D�M�M�!�
"�Q��
�
�a� �!��s�3�3)234r�rhrirur_r�rarWr[�inforbrX)	rYrWrZr[�updaterb�	serializerX�235_serialize)r:�236state_dicts` r;�__getstate__�InstanceState.__getstate__bs�������237��k�k�#�3�3�"&�"9�"9�	&238�239�	���240��241�	242� �>�>�&*�n�n�&>�&>�&@�J�{�#� $��� 7� 7��j� I�243�9���r>c�l�USnUb7[R"X R5UlURUlOSUlUSUlUR
S05UlUR
S05UlUR
S05Ul	UR
SS5Ul244UR
S	S5UlS245U;aURRUS2465 SU;aUSUlUSUlO SU;aUSUlO[!5UlUR"RS
Vs/sHnX1;dM247X1U4PM sn5 UR$(aUR$SUlSU;a[(R*"US5UlUS"XU5 gs snf)Nr�c��gr7r8r8r>r;r��,InstanceState.__setstate__.<locals>.<lambda>�s��tr>rWrZr�r�rhFrir�rur[)r_rarrbrX)rxryrzrYrwrW�getrZr�r�rhrir�r�rur[r{rUr_ror�deserializerb)r:r�instr�s    r;�__setstate__�InstanceState.__setstate__�s����*�%�����{�{�4���7�D�H��.�.�D�K�#�D�H�$�X�.�D�K�)�~�~�.?��D���",�.�.�1E�r�"J���!�~�~�i��4���"���z�5�9��
�!�~�~�i��7����Z���I�I���Z��/�0��*�$�'��4�D�N�&0�1E�&F�D�#�#�z�1�*4�5I�*J��'�*-�%��'��
�
���1�
�0�A��?�#��q�M�"�0�
�	248��8�8�"&�(�(�1�+�D���*�$�)�5�5�j��6M�N�D�N��9��d�*�5��
s�=	F1�249 250F1c�4�URUS5nURURnUb![U5(aUR	U5 UR251R
U5 UR(aURRUS5 gg)z@Remove the given attribute and any252callables associated with it.N)�poprXr�r�_invalidate_collectionr[�discardru)r:rKr_�old�manager_impls     r;�_reset�InstanceState._reset�sz���i�i��T�"���|�|�C�(�-�-���?�1�,�?�?��/�/��4����'�'��,��>�>��N�N���s�D�)�r>c�Z�SUR;a[UR5Ulgg�Nru)rUr�ru)r:�from_s  r;�_copy_callables�InstanceState._copy_callables�s#���%�.�.�(�!�%�/�/�2�D�N�)r>c�^^^�UTRn[U5(aUmSUUU4SjjnU$SUU4SjjnU$)Nc�>�SUR;a0UlURTS5nUbTRU5 TURT'gr)rUrur
r)rJrKrLr�253fixed_impl�fnr_s    ���r;�
_set_callable�GInstanceState._instance_level_callable_processor.<locals>._set_callable�sI����e�n�n�4�&(�E�O��i�i��T�*���?��5�5�c�:�')�����$r>c�R>�SUR;a0UlTURT'gr)rUru)rJrKrLrr_s   ��r;rr�s&����e�n�n�4�&(�E�O�')�����$r>rN)r�r)�clsrXrr_r�rrs  ``  @r;�"_instance_level_callable_processor�0InstanceState._instance_level_callable_processor�s�����s�|� � ���d�#�#��J�
*�(�
*�1>�
*�EM�
*��
*�
*�&��
*�(�
*�1>�
*�EM�
*��
*�
*��r>c�:�SUlUR(a2URU5 URR	5 SUlSUlSUR;a
URS	SUR;a
URS	URRURRVs/sHo3RPM sn5 UR(a9URRUR5HnURU	M URRRU5H%nURU5nSUR lM' UR$(a@UR$RUR$Vs0sHoDU;dM254XAU_M sn5 URR&RU5HnX	M URR(R+US5 gs snfs snf)NTFr�r�)rirhrrZ�clearrdrUr[r�rX�
_loader_implsr_ru�intersection�_collection_impl_keysr
�_sa_adapter�invalidatedrp�_all_key_setr��expire)r:rK�modified_setr�r��255collectionr_s       r;�_expire�InstanceState._expire�s�������=�=�� � ��&�� � �&�&�(�!�D�M�����4�=�=�0��
�
�2�3���
�
�%��
�
�i�(����&�&�"&�,�,�"<�"<�=�"<�$�X�X�"<�=�	256��>�>��,�,�9�9�$�.�.�I���N�N�1�%�J����3�3�@�@��G�A����1��J�15�J�"�"�.�H��"�"��#�#�*�*�&*�&=�&=�L�&=��e����!�H��&=�L�
��<�<�,�,�9�9�%�@�C��257�A�	
�����$�$�T�4�0��=
>��0Ms�9H�!	H�.	Hc���URRSS5nURnUGHnURURnUR258(aHU(aUR(dXe;aMMURRU5 U(aXe;aXV	URU[5n[U5(aU[LaURU5 URn	U	bXi;a
U[LaX�U'URRUS5 U(dM�URUS5 GM URRR!X5 g)Nr�)rUrrurXr��accepts_scalar_loader�	callable_r[�addr
rrrrprZr�r+)259r:rK�attribute_names�	no_loaderr�rur_r�rr�s260          r;�_expire_attributes� InstanceState._expire_attributess���-�-�#�#�$8�$�?���N�N�	�"�C��<�<��$�)�)�D��)�)��$�.�.�C�4D���'�'�+�+�C�0���!1�!���)�)�C��*�C�!�$�'�'�C�x�,?��+�+�C�0��)�)�C���3�:�#�X�2E��C��� � �$�$�S�$�/��w����C��&�'#�*	
�����$�$�T�;r>c�$^�U[-(d[$TRRTR5nURU4SjU55nTRRTX25 TRR5 [$)z�__call__ allows the InstanceState to act as a deferred261callable for loading expired attributes, which is also262serializable (picklable).263 264c3�|># �UH1nTRURR(aM-Uv� M3 g7fr7)rXr��load_on_unexpire�r��attrr:s  �r;r��.InstanceState._load_expired.<locals>.<genexpr>6s2����#265����<�<��%�*�*�;�;�
�D����,<�	<)266rrr[r&�267unmodified�268differencerX�expired_attribute_loaderr$r)r:rJr��toloads`   r;�
_load_expired�InstanceState._load_expired)sz������$�$��(�(�5�5�d�o�o�F���"�"�#269��#270�271��	
���-�-�d�F�D�	
���%�%�'��r>c�^�[UR5RUR5$)z8Return the set of keys which have no uncommitted changes)r{rXr@rZr9s r;r?�InstanceState.unmodifiedFs$���4�<�<� �+�+�D�,@�,@�A�Ar>c�|�[U5RUR5RUR5$)z*Return self.unmodified.intersection(keys).)r{r&rXr@rZ)r:�keyss  r;�unmodified_intersection�%InstanceState.unmodified_intersectionLs.��
��I�
�\�$�,�,�
'�
�Z��,�,�
-�	272r>c��[UR5RUR5RUR5$)z�Return the set of keys which do not have a loaded value.273 274This includes expired attributes and any other attribute that was never275populated or modified.276 277)r{rXr@rZr�r9s r;�unloaded�InstanceState.unloadedUs3��
�����
�Z��,�,�
-�
�Z��	�	�
"�	278r>z2.0zsThe :attr:`.InstanceState.unloaded_expirable` attribute is deprecated.  Please use :attr:`.InstanceState.unloaded`.c��UR$)z�Synonymous with :attr:`.InstanceState.unloaded`.279 280This attribute was added as an implementation-specific detail at some281point and should be considered to be private.282 283)rLr9s r;�unloaded_expirable� InstanceState.unloaded_expirablecs���}�}�r>c�b^�TRRU4SjTR55$)Nc3�|># �UH1nTRURR(dM-Uv� M3 g7fr7)rXr�r1r;s  �r;r��5InstanceState._unloaded_non_object.<locals>.<genexpr>ts2����*284�$���|�|�D�!�&�&�<�<�
�D�$�r>)rLr&rXr9s`r;�_unloaded_non_object�"InstanceState._unloaded_non_objectrs+����}�}�)�)�*285����*286�287�	288r>c���U(Ga#UR(dgU(a3URU;a#[R"SUR-5eURUR;dU(a�U(af[289(a[
U5(deU[LaURU;aXRnUS[[4;aURU5nX0RUR'URnUb"URU;a[XbR'UR(a
URbUR(GdSUl
UR5nU(a1[UR 5nUR R#U5 OSnUR%5n	UR(a>X�lU(d1[&URn290U291R(cU292R+5 U	cRU(aJ[.R0"SUR2UR<S[4R6"U5<S35eggg![,a Ncf=f)NzHCan't flag attribute '%s' modified; it's not present in the object stateTFz'Can't emit change event for attribute 'z' - parent object of type z has been garbage collected.)�send_modified_eventsr_�sa_exc�InvalidRequestErrorrZrrrr�copyrpr]rdrhrqrg�	_modifiedr3rYr2�_transaction�_autobegin_tr��orm_exc�ObjectDereferencedErrorrXr�state_class_str)r:rKr<�previousr-�is_userlandr�r��has_modifiedr	r�s           r;�_modified_event�InstanceState._modified_eventzs�����,�,���t�x�x�u�4��0�0�'�)-���2����x�x�t�3�3�3�{��$�}�1�$�7�7�7�7��9�,��8�8�u�,�',�X�X��H���h�	�'B�B�#'�9�9�X�#6��19�$�$�T�X�X�.��)�)�C���4�8�8�s�?� (��H�H�
�
�O�O�� 0� 0� 8����� �D�M� �/�/�1�M��#�M�$;�$;�<���'�'�+�+�D�1�$��293�8�8�:�D����#'� �294$�3�"+�D�O�O�"<��#�/�/�7�#�0�0�2��|���5�5��|�|�D�H�H�-�t�/C�/C�D�/I�K���!%�|�=BO��0$����s�I#�#295I0�/I0c�t�UHnURRUS5 M! SUlURR	[U5R
U55 UR(aH[UR5R
U5R
U5HnURU	M gg)aCommit attributes.296 297This is used by a partial-attribute load operation to mark committed298those attributes which were refreshed from the database.299 300Attributes marked as "expired" can potentially remain "expired" after301this step if a value was not populated in state.dict.302 303NF)rZr
rir[�difference_updater{r&ru)r:rKrHr_s    r;�_commit�InstanceState._commit�s����C�� � �$�$�S�$�/��������1�1���I�"�"�5�)�	304��>�>��D�N�N�#�0�0��6�C�C�E�J���N�N�3�'�K�r>c�,�URX4/U5 g)acommit all attributes unconditionally.305 306This is used after a flush() or a full load/refresh307to remove all pending state from the instance.308 309 - all attributes are marked as "committed"310 - the "strong dirty reference" is removed311 - the "modified" flag is set to False312 - any "expired" markers for scalar attributes loaded are removed.313 - lazy load callables for objects / collections *stay*314 315Attributes marked as "expired" can potentially remain316"expired" after this step if a value was not populated in state.dict.317 318N)�_commit_all_states)r:rKr�s   r;�_commit_all�InstanceState._commit_all�s��$	
���$����?r>c�>�UH�up4URnURR5 SU;aUS	URR	U5 U(a,UR319(aURRU5 S=UlUlSUl	M� g)z.Mass / highly inlined version of commit_all().r�FN)320rUrZr$r[rgrhr[rrird)r:�iter_r�rJrKrs      r;rk� InstanceState._commit_all_states�s���"�L�E����J��!�!�'�'�)�#�z�1��3�4��$�$�6�6�u�=������'�'�/�/��6�-2�2�E�N�U�]� $�E��"r>)rpr�rdrurWrZrir[rorbrXrhrYr�r])rYrrXr\)r?z'util.ReadOnlyProperties[AttributeState])r?rg)r_�strr?rP)r?�Optional[Session])r?zOptional[AsyncSession])r?zOptional[_O])r?zOptional[Tuple[Any, ...]])r?r^)r?z4Dict[int, Union[Literal[False], InstanceState[Any]]])r?zDict[str, PendingCollection])r?z%Dict[str, _AdaptedCollectionProtocol])r?z321Mapper[_O])F)r�zIterable[InstanceState[_O]]r�r.r�rgr?rPr7)r�rrr?rP�r?rP)ryrer?rP)r?r$)r�rr�rr?rP)r_rqr�r(r?r')r_rqr?r&)r_rqr?r�)r?rf)rrfr?rP)rKr$r_rqr?rP)r�InstanceState[Any]r?rP)rXr\rr%r_rr?z_InstallLoaderCallableProto[_O])rKr$r,zSet[InstanceState[Any]]r?rP)rKr$r4�
Iterable[str]r5rgr?rP)rJrOr�r(r?r)r?rt)rHrur?rt)FF)rKr$r<zOptional[AttributeImpl]rarr-rgrbrgr?rP)rKr$rHrur?rP)rKr$r�r@r?rP)roz2Iterable[Tuple[InstanceState[Any], _InstanceDict]]r�r@r?rP)SrArBrCrDrQ�	__slots__�__annotations__r]r_r`rar�rootrbrcrdrhrirjrkrlrmrorprrqr �322EMPTY_DICTrur|�memoized_propertyr��propertyr�r�r�r�r�r��non_memoized_property�preload_moduler�r�r�r0rnr�r�r�r�r�r�r��classmethodr�r�r�r�rzr�r�r�r�r�rr323rrr!r.r6rCr?rIrL�324deprecatedrOrTrdrhrlrkrEr8r>r;rSrScs���6�I��� $�J�
�$�*.�C�	'�.��E�=��*,�L�'�,�*�/�/�I�|�/�"&�L�-�&�$(�K�!�(�	��#�#��H�d��0��G�T����H�d���M�4��).� �$�.��K���!�N�F�!�37��0�7�&�&���	�!� ��J�I�	���O�O�	�(�325���
326��
327��7��7��3��3��I��I�:����(�M��M��;��;�328���	���1�2�329�3� �330� �����.����6��������&�	��	�331������332������333������334���#��#������335#�	#%�+�#%��#%��	#%�336337�#%��#%�J6�� �22�:����$338B�L�&�,�339�<'6�R340*�3���&��,;��BE��	(����801�"�01�2I�01�	
�01�l �	<��<�'�<��	<�341342�<�B�&��1<��	��:�B��B�343344��345��346��	�_�_�
�	C��347�����348��349�!�!�
F��F�&�F��	F�350�F��
F�351�F�P(�<LP�@�"�@�3H�@�	
�@�(�04�%�A�%�-�%�352�	%��%r>rSc��\rSrSr%SrSrS\S'S\S'SSjr\SS	j5r	\SS353j5r354\SSj5rSSjrS
r
g)r�iajProvide an inspection interface corresponding355to a particular attribute on a particular mapped object.356 357The :class:`.AttributeState` object is accessed358via the :attr:`.InstanceState.attrs` collection359of a particular :class:`.InstanceState`::360 361    from sqlalchemy import inspect362 363    insp = inspect(some_mapped_object)364    attr_state = insp.attrs.some_attribute365 366�rJr_rtrJrqr_c��XlX lgr7r�)r:rJr_s   r;r|�AttributeState.__init__ s���367��r>c�j�URRRUR[5$)z�The current value of this attribute as loaded from the database.368 369If the value has not been loaded, or is otherwise not present370in the object's dictionary, returns NO_VALUE.371 372)rJr�rr_rr9s r;�loaded_value�AttributeState.loaded_value$s#���z�z���"�"�4�8�8�X�6�6r>c���URRURRURR	5URR3735$)z�Return the value of this attribute.374 375This operation is equivalent to accessing the object's376attribute directly or via ``getattr()``, and will fire377off any pending loader callables if needed.378 379)rJrXr_�__get__rYrWr9s r;�value�AttributeState.value.sD���z�z�!�!�$�(�(�+�3�3��J�J�N�N��d�j�j�/�/�380�	381r>c�V�URRUR[5$)a�Return the current **pre-flush** change history for382this attribute, via the :class:`.History` interface.383 384This method will **not** emit loader callables if the value of the385attribute is unloaded.386 387.. note::388 389    The attribute history system tracks changes on a **per flush390    basis**. Each time the :class:`.Session` is flushed, the history391    of each attribute is reset to empty.   The :class:`.Session` by392    default autoflushes each time a :class:`_query.Query` is invoked.393    For394    options on how to control this, see :ref:`session_flushing`.395 396 397.. seealso::398 399    :meth:`.AttributeState.load_history` - retrieve history400    using loader callables if the value is not locally present.401 402    :func:`.attributes.get_history` - underlying function403 404)rJr�r_rr9s r;�history�AttributeState.history;s ��4�z�z�%�%�d�h�h�0E�F�Fr>c�d�URRUR[[-5$)a�Return the current **pre-flush** change history for405this attribute, via the :class:`.History` interface.406 407This method **will** emit loader callables if the value of the408attribute is unloaded.409 410.. note::411 412    The attribute history system tracks changes on a **per flush413    basis**. Each time the :class:`.Session` is flushed, the history414    of each attribute is reset to empty.   The :class:`.Session` by415    default autoflushes each time a :class:`_query.Query` is invoked.416    For417    options on how to control this, see :ref:`session_flushing`.418 419.. seealso::420 421    :attr:`.AttributeState.history`422 423    :func:`.attributes.get_history` - underlying function424 425)rJr�r_rrr9s r;�load_history�AttributeState.load_historyWs$��.�z�z�%�%�d�h�h��g�0E�F�Fr>)r_rJN)rJrtr_rq)r?r)r?r')rArBrCrDrQrvrwr|r{r�r�r�r�rEr8r>r;r�r�sb���!�I���	�H���7��7��426427��428429��G��G�6Gr>r�c�Z�\rSrSr%SrSrS\S'S\S'SSjrSS	jrSS430jr	SSjr431Srg
)r�iqaA writable placeholder for an unloaded collection.432 433Stores items appended to and removed from a collection that has not yet434been loaded. When the collection is loaded, the changes stored in435PendingCollection are applied to it to produce the final result.436 437)�
deleted_items�added_itemszutil.IdentitySetr�zutil.OrderedIdentitySetr�c�l�[R"5Ul[R"5Ulgr7)r �IdentitySetr��OrderedIdentitySetr�r9s r;r|�PendingCollection.__init__s$��!�-�-�/����2�2�4��r>c�N�URURUR5$r7)�_merger�r�)r:r�s  r;�merge_with_history�$PendingCollection.merge_with_history�s���~�~�d�.�.��0B�0B�C�Cr>c��XR;aURRU5 gURRU5 gr7)r��remover�r3�r:r�s  r;�append�PendingCollection.append�s6���&�&�&����%�%�e�,���� � ��'r>c��XR;aURRU5 gURRU5 gr7)r�r�r�r3r�s  r;r��PendingCollection.remove�s6���$�$�$����#�#�E�*����"�"�5�)r>)r�r�Nrs)r�r'r?r')r�rr?rP)rArBrCrDrQrvrwr|r�r�r�rEr8r>r;r�r�qs/���1�I�#�#�(�(�5�D�(�*r>r�)IrQ�438__future__r�typingrrrrrr	r439rrr
rx�rrr^r�_typingrrrrrrrrrrr�
path_registryrrXrr �util.typingr!r"r#r$r%�440attributesr&r'r(�collectionsr)r�r*�instrumentationr+r,r�r-r�r.�enginer/�ext.asyncio.sessionr0r�r1rwr2r4rG�_self_inspects�InspectionAttrInforSr�r�r8r>r;�<module>r�s���#��������� �������'���&���'�#���'����!�"��)�&�(�)�#�!�7�%�-�%�� ��F�2��8�8��I���O�5��5��(�2�,�����e%�J�1�1�7�2�;�e%��e%�PbG�bG�J*�*r>
codekingpro/portable-devtools · Team Ai