https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib64/python2.7/site-packages/sqlalchemy/orm/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyc
�
���\c@sdZddlmZddlmZddlmZddlmZddlmZddlmZej�Z	d	e
fd
��YZdefd��YZ
d
efd��YZe�ZejZZejZZejZZd�Zd�Zd�Zd�ZdS(s�Defines SQLAlchemy's system of class instrumentation.

This module is usually not directly visible to user applications, but
defines a large part of the ORM's interactivity.

instrumentation.py deals with registration of end-user classes
for state tracking.   It interacts closely with state.py
and attributes.py which establish per-instance and per-class-attribute
instrumentation, respectively.

The class instrumentation system can be customized on a per-class
or global basis using the :mod:`sqlalchemy.ext.instrumentation`
module, which provides the means to build and specify
alternate instrumentation forms.

.. versionchanged: 0.8
   The instrumentation extension system was moved out of the
   ORM and into the external :mod:`sqlalchemy.ext.instrumentation`
   package.  When that package is imported, it installs
   itself within sqlalchemy.orm so that its more comprehensive
   resolution mechanics take effect.

i(tbase(tcollections(texc(t
interfaces(tstatei(tutiltClassManagercBs6eZdZejZejZee	j
e��Zd,Z
ejZd,Zd�Zd�Zd�Zed��Zed��Zed��Zed��Ze	jd��Zd,d	�Zd,d
�Zd�Zd�Zd
�Z d�Z!e	jd��Z"d�Z#d�Z$e	j%d��Z&e	j%d��Z'e	j%d��Z(e)d�Z*d�Z+d�Z,e)d�Z-d�Z.d�Z/d�Z0d�Z1d�Z2d�Z3d�Z4e)d �Z5d!�Z6ed"��Z7d,d#�Z8d,d$�Z9d%�Z:d&�Z;d'�Z<d(�Z=e)d)�Z>d*�Z?e?Z@d+�ZARS(-s,tracks state information at the class level.cCs7||_i|_d|_i|_i|_gg|jjD]!}t|t�r=t	|�^q=D]}|dk	rb|^qb|_
x|j
D]}|j|�q�W|jj
j||�x?|jD]4}t	|�}|dk	r�|jj|j�q�q�W|j�|j�d|jkr3tjd|�ndS(Nt__del__s�__del__() method on class %s will cause unreachable cycles and memory leaks, as SQLAlchemy instrumentation often creates reference cycles.  Please remove this method.(tclass_tinfotNonetnew_inittlocal_attrst	originalst	__bases__t
isinstancettypetmanager_of_classt_basestupdatetdispatcht_eventst_new_classmanager_instancet__mro__t_updatetmanaget_instrument_initt__dict__Rtwarn(tselfRRtmgrtbase_tbasecls((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt__init__:s.					%

cCs
t|�S(N(tid(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt__hash__`scCs
||kS(N((Rtother((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt__eq__cscCs
d|jkS(Ntmapper(R(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt	is_mappedfscCs
t|�S(N(t	frozenset(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt_all_key_setjscCs2tg|j�D]}|jjr|j^q�S(N(R(tvaluestimplt
collectiontkey(Rtattr((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt_collection_impl_keysnscCs2tg|j�D]}|jjr|j^q�S(N(R(R*R+taccepts_scalar_loader(RR.((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt_scalar_loader_implstscCstj|j��dS(N(RtUnmappedClassErrorR(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyR&~sccs�|dkrt�}nxq|jjD]c}xZt|j�j|�D]@}|j|�|j|}t|tj	�rD||fVqDqDWq%WdS(sreturn an iterator of all classbound attributes that are
        implement :class:`.InspectionAttr`.

        This includes :class:`.QueryableAttribute` as well as extension
        types such as :class:`.hybrid_property` and
        :class:`.AssociationProxy`.

        N(
R
tsetRRRt
differencetaddRRtInspectionAttr(RtexcludetsuperclsR-tval((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt_all_sqla_attributes�s	

cCs9x2|jjD] }||jkr
|j|Sq
W|SdS(s5return an attribute on the class without tripping it.N(RRR(RR-tdefaultR8((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt_get_class_attr_mro�scCs||ko||jdk	S(s\Return True if the given attribute is fully initialized.

        i.e. has an impl.
        N(R+R
(RR-((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt_attr_has_impl�scCs.t|�}|dkr*tj|�}n|S(s�Create a new ClassManager for a subclass of this ClassManager's
        class.

        This is called automatically when attributes are instrumented so that
        the attributes can be propagated to subclasses against their own
        class-local manager, without the need for mappers etc. to have already
        pre-configured managers for the full class hierarchy.   Mappers
        can post-configure the auto-generated ClassManager when needed.

        N(RR
t_instrumentation_factorytcreate_manager_for_cls(Rtclstmanager((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt_subclass_manager�scCs;|jj|_t|j|�|_|jd|j�dS(NR!(RR!t
original_initt_generate_initRtinstall_member(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyR�scCs&|jr"|jd�d|_ndS(NR!(Rtuninstall_memberR
(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt_uninstrument_init�s	
cCs|jj||j�tjS(N(Rt
first_initRRt
InstanceState(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt_state_constructor�scCst|j|j|�dS(s0Mark this instance as the manager for its class.N(tsetattrRtMANAGER_ATTR(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyR�scCst|j|j�dS(s)Dissasociate this manager from its class.N(tdelattrRRL(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytdispose�scCstS(N(t_default_manager_getter(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytmanager_getter�scCstS(s�Return a (instance) -> InstanceState callable.

        "state getter" callables should raise either KeyError or
        AttributeError if no InstanceState could be found for the
        instance.
        (t_default_state_getter(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytstate_getter�s	cCstS(N(t_default_dict_getter(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytdict_getter�scCs�|r||jkr9dSn||j|<|j||�tj|�|||<x9|jj�D](}|j|�}|j||t�q`WdS(N(	Rtinstall_descriptort_memoized_key_collectiontexpire_instanceRt__subclasses__RBtinstrument_attributetTrue(RR-tinstt
propagatedR@RA((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyRY�s


ccsrxk|jj�D]Z}t|�}|dk	r||k	r|V|rjx|jt�D]}|VqUWqjqqWdS(N(RRXRR
tsubclass_managersRZ(Rt	recursiveR@Rtm((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyR]�scCs!tjj|j|||�dS(N(R>Rtattribute_instrumentR(RR-((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytpost_configure_attribute�s	cCs�||krdS|r,||jkrCdSn|j|=|j|�tj|�||=x<|jj�D]+}t|�}|rg|j|t�qgqgWdS(N(	Rtuninstall_descriptorRVRWRRXRtuninstrument_attributeRZ(RR-R\R@RA((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyRcs


cCsa|j�d|_|_|jj�x3t|�D]%}||jkr4|j|�q4q4WdS(s<remove all instrumentation established by this ClassManager.N(	RGR
R&RR	tcleartlistRRc(RR-((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt
unregisters

cCsB||j|jfkr+td|��nt|j||�dS(NsW%r: requested attribute name conflicts with instrumentation attribute of the same name.(t
STATE_ATTRRLtKeyErrorRKR(RR-R[((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyRUs

cCst|j|�dS(N(RMR(RR-((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyRb'scCsd||j|jfkr+td|��n|jj|t|j|d��t|j||�dS(NsW%r: requested attribute name conflicts with instrumentation attribute of the same name.(	RgRLRhR
t
setdefaulttgetattrRR
RK(RR-timplementation((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyRE*s
"cCs;|jj|d�}|dk	r7t|j||�ndS(N(R
tpopR
RKR(RR-toriginal((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyRF3scCs
tj|�S(N(Rtprepare_instrumentation(RR-tcollection_class((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytinstrument_collection_class8scCs1|�}tj|j|�||�}||fS(N(RtCollectionAdaptertget_impl(RR-Rtfactoryt	user_datatadapter((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytinitialize_collection;s	cCs!|r||kS||jkSdS(N(R(RR-tsearch((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytis_instrumentedBs
cCs||jS(N(R+(RR-((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyRrHscCst|j��S(N(titerR*(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt
attributesKscCsJ|jj|j�}|dkr6|j||�}n|j||�|S(N(Rt__new__R
RJt
_state_setter(RRtinstance((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytnew_instanceQs
cCs5|dkr!|j||�}n|j||�dS(N(R
RJR|(RR}R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytsetup_instanceXscCst||j�dS(N(RMRg(RR}((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytteardown_instance]scCs
t||�S(N(t_SerializeManager(RRt
state_dict((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt
_serialize`scCstt||j�rtS|j|jk	rJ|jrJ|j|j�j|�S|j||�}|j	||�|SdS(s�Install a default InstanceState if none is present.

        A private convenience method used by the __init__ decorator.

        N(
thasattrRgtFalseRt	__class__R'RBt_new_state_if_noneRJR|(RR}R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyR�cscCst||j�S(N(R�Rg(RR}((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt	has_stateyscCs|j|�j|d|�S(tTODOt
optimistic(Rrt	hasparent(RRR-R�((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt
has_parent|scCstS(s=All ClassManagers are non-zero regardless of attribute state.(RZ(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt__bool__�scCs d|jj|jt|�fS(Ns<%s of %r at %x>(R�t__name__RR"(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt__repr__�s	N(BR�t
__module__t__doc__RtDEFAULT_MANAGER_ATTRRLtDEFAULT_STATE_ATTRRgtstaticmethodRt
attrsetterR|R
tdeferred_scalar_loadertobjectR!RCRsR#R%tpropertyR'RVR)R/R1tmemoized_propertyR&R:R<R=RBRRGRJRRNthybridmethodRPRRRTR�RYR]RaRcRfRURbRERFRpRvRxRrRzR~RR�R�R�R�R�R�t__nonzero__R�(((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyR,sf				&		
				
																				R�cBs eZdZd�Zd�ZRS(s�Provide serialization of a :class:`.ClassManager`.

    The :class:`.InstanceState` uses ``__init__()`` on serialize
    and ``__call__()`` on deserialize.

    cCs,|j|_|j}|jj||�dS(N(RRARtpickle(RRtdRA((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyR!�s	cCs�t|j�|_}|dkr>tj|d|j��n&|jrd|jjrd|jj	�n|dk	r�|j
||�n|jj||�dS(NsxCannot deserialize object of type %r - no mapper() has been configured for this class within the current Python process!(
RRRAR
RtUnmappedInstanceErrorR'R&t
configuredt_configure_allRRtunpickle(RRR[R�RA((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt__call__�s(R�R�R�R!R�(((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyR��s	tInstrumentationFactorycBs2eZdZd�Zd�Zd�Zd�ZRS(s'Factory for new ClassManager instances.cCs�|dk	st�t|�dks*t�|j|�\}}|dkr`t}||�}n|j||�||_|jj|�|S(N(	R
tAssertionErrorRt_locate_extended_factoryRt_check_conflictsRsRtclass_instrument(RRRARs((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyR?�s	cCsdS(s2Overridden by a subclass to do an extended lookup.N(NN(R
(RR((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyR��scCsdS(s;Overridden by a subclass to test for conflicting factories.N((RRRs((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyR��scCsYt|�}|j�|j�|jj|�tj|jkrUt|tj�ndS(N(	RRfRNRtclass_uninstrumentRRLRRM(RRRA((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyRf�s

(R�R�R�R?R�R�Rf(((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyR��s
			cCs.t|�}|dkr*tj|�}n|S(s_Register class instrumentation.

    Returns the existing or newly created class manager.

    N(RR
R>R?(RRA((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytregister_class�scCstj|�dS(s!Unregister class instrumentation.N(R>Rf(R((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pytunregister_class�scCst|j�j|dt�S(s�Return True if the given attribute on the given instance is
    instrumented by the attributes package.

    This function may be used regardless of instrumentation
    applied directly to the class, i.e. no descriptors are required.

    Rw(RR�RxRZ(R}R-((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyRx�scBs�|j}|st�d}ej|de�}||}ejrje|d|�}e|dd�}n$e|dd�}e|dd�}e�j	�}	||	fdU|	d}
|j
|
_
||
_|r�||
_nejr�|r�||
_
n|
S(	s>Build an __init__ decorator that triggers ClassManager events.s�def __init__(%(apply_pos)s):
    new_state = class_manager._new_state_if_none(%(self_arg)s)
    if new_state:
        return new_state._initialize_instance(%(apply_kw)s)
    else:
        return original__init__(%(apply_kw)s)
tgroupedtim_funct
func_defaultst__defaults__t__kwdefaults__NR!(R!R�Rtformat_argspec_initR�tpy2kRjR
tlocalstcopyR�t_sa_original_initR�R�(Rt
class_managertoriginal__init__t	func_bodyt	func_varst	func_texttfuncR�tfunc_kw_defaultstenvR!((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyRDs(	
	
	N(R�tRRRRRRt!group_expirable_memoized_propertyRVtdictRR�R�R�R>tinstance_stateRQt
instance_dictRSRROR�R�RxRD(((sD/usr/lib64/python2.7/site-packages/sqlalchemy/orm/instrumentation.pyt<module>s&�c")	


	
		

https://t.me/AnonymousX5 - 2025