HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyc
�
���ec@s"dZddlmZddlmZddlmZddlmZddlmZddlm	Z	dd	lm
Zdd
lmZddlm
Z
ddlmZddl
mZdd
l
mZdefd��YZdefd��YZdefd��YZdefd��YZdS(s�Descriptor properties are more "auxiliary" properties
that exist as configurational elements, but don't participate
as actively in the load/persist ORM loop.

i(t
attributes(tutil(tMapperProperty(tPropComparator(t	_none_seti(tevent(texc(tschema(tsql(t
expression(t	operatorstDescriptorPropertycBs)eZdZdZeZeZd�ZRS(sO:class:`.MapperProperty` which proxies access to a
    user-defined descriptor.c	s>��dtf�fd��Y}�jdkrmt�j�jd�}�j�j|�rm|�_qmn�jdkr��fd�}�fd�}�fd�}td|d|d|��_ntj	�j��j
j�j�j��fd	�d
�jd��}|�j�|_�j
j�j|�dS(Nt
_ProxyImplcs_eZeZeZeZe�fd��Zd�Z	e
�d�r]ej�fd�Z
nRS(cs�jS(N(tuses_objects(tself(tprop(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR
-scSs
||_dS(N(tkey(RR((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__init__1stget_historycs�j|||�S(N(R(Rtstatetdict_tpassive(R(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR6s(t__name__t
__module__tFalsetaccepts_scalar_loadertTruetload_on_unexpiret
collectiontpropertyR
RthasattrRtPASSIVE_OFFR((R(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR(s	cst|�j|�dS(N(tsetattrtname(tobjtvalue(R(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytfsetBscst|�j�dS(N(tdelattrR!(R"(R(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytfdelEscst|�j�S(N(tgetattrR!(R"(R(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytfgetHsR(R$R&cs
�j��S(N(t_comparator_factory((tmapperR(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt<lambda>Qttdoctoriginal_property(tobjectt
descriptortNoneR'tclass_Rt_is_userland_descriptorRRtcreate_proxied_attributetparentR-timplt
class_managertinstrument_attribute(RR*RtdescR$R&R(t
proxy_attr((R*RRsP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytinstrument_class%s(!			N(	RRt__doc__R1R-RR
t_links_to_entityR;(((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRs
tCompositePropertycBs�eZdZd�Zd�Zd�Ze�Zd�Ze	j
d��Ze	j
d��Ze
d��Zd�Zd	�Ze	j
d
��Zejd�Zd�Zd
ejfd��YZdefd��YZd�ZRS(s�Defines a "composite" mapped attribute, representing a collection
    of columns as one attribute.

    :class:`.CompositeProperty` is constructed using the :func:`.composite`
    function.

    .. seealso::

        :ref:`mapper_composite`

    cOs�tt|�j�||_||_|jdt�|_|jdt�|_|jdd�|_
|jd|jj
�|_d|kr�|jd�|_ntj|�|j�dS(s`Return a composite column-based property for use with a Mapper.

        See the mapping documentation section :ref:`mapper_composite` for a
        full usage example.

        The :class:`.MapperProperty` returned by :func:`.composite`
        is the :class:`.CompositeProperty`.

        :param class\_:
          The "composite type" class, or any classmethod or callable which
          will produce a new instance of the composite object given the
          column values in order.

        :param \*cols:
          List of Column objects to be mapped.

        :param active_history=False:
          When ``True``, indicates that the "previous" value for a
          scalar attribute should be loaded when replaced, if not
          already loaded.  See the same flag on :func:`.column_property`.

        :param group:
          A group name for this property when marked as deferred.

        :param deferred:
          When True, the column property is "deferred", meaning that it does
          not load immediately, and is instead loaded when the attribute is
          first accessed on an instance.  See also
          :func:`~sqlalchemy.orm.deferred`.

        :param comparator_factory:  a class which extends
          :class:`.CompositeProperty.Comparator` which provides custom SQL
          clause generation for comparison operations.

        :param doc:
          optional string that will be applied as the doc on the
          class-bound descriptor.

        :param info: Optional data dictionary which will be populated into the
            :attr:`.MapperProperty.info` attribute of this object.

        tactive_historytdeferredtgrouptcomparator_factorytinfoN(tsuperR>Rtattrstcomposite_classtgetRR?R@R1RAtpopt	__class__t
ComparatorRBRCRtset_creation_ordert_create_descriptor(RR2REtkwargs((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRfs+		
cCs$tt|�j|�|j�dS(N(RDR>R;t_setup_event_handlers(RR*((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR;�scCs|j�dS(sInitialization which occurs after the :class:`.CompositeProperty`
        has been associated with its parent mapper.

        N(t_setup_arguments_on_columns(R((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytdo_init�scsF�fd�}�fd�}�fd�}t|||��_dS(stCreate the Python descriptor that will serve as
        the access point on instances of the mapped class.

        cs�tj|�}tj|�}�j|kr�g�jD]}t||�^q7}�j|kr�|jdk	s�tj|�r��j	|�|�j<|j
jj|�j
�jg�q�n|j�jd�S(N(Rt
instance_dicttinstance_stateRt_attribute_keysR'R1Rt
issupersetRFtmanagertdispatchtrefresht_COMPOSITE_FGETRG(tinstanceRRRtvalues(R(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR(�s%cs�tj|�}tj|�}|j�j}|j�jtj�}x,|jjD]}|||||j	�}qSW||�j<|dkr�x]�jD]}t||d�q�Wn9x6t
�j|j��D]\}}t|||�q�WdS(N(RRQRRRURRGtNO_VALUERVtsetR6R1RSR tzipt__composite_values__(RYR#RRtattrtprevioustfnR(R(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR$�s
cs�tj|�}tj|�}|j�jtj�}|j�j}|jj|||j	�x!�j
D]}t||d�qiWdS(N(
RRRRQRHRR[RURVtremoveR6RSR R1(RYRRR`R_R(R(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR&�sN(RR0(RR(R$R&((RsP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRL�s	cCs,g|jD]}t|jj|j�^q
S(N(tpropsR'R5R2R(RR((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt_comparable_elements�scCs�g}x�|jD]�}t|t�r@|jj|dt�}nYt|tj�re|jj|}n4t|t	j
�r�|j}ntj
d|f��|j|�qW|S(Nt_configure_mapperss[Composite expects Column objects or mapped attributes/attribute names as arguments, got: %r(REt
isinstancetstrR5tget_propertyRRtColumnt_columntopropertyRtInstrumentedAttributeRtsa_exct
ArgumentErrortappend(RRcR_R((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRc�s
cCs,g|jD]}t|tj�r
|^q
S(N(RERfRRi(Rta((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytcolumnsscCscx\|jD]Q}|j|_|jrO|j|_dtfdtff|_n|j|_q
WdS(swPropagate configuration arguments made on this composite
        to the target columns, for those that apply.

        R@t
instrumentN(RcR?R@Rtstrategy_keyRA(RR((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyROs	cs��fd�}��fd�}�fd���fd�}�fd�}tj�jd|dt�tj�jd|dt�tj�jd	|dtd
t�tj�jd|dtd
t�tj�jd|dtd
t�d
S(s>Establish events that populate/expire the composite attribute.cs�||ddt�dS(Nt
is_refresh(R1R(Rtcontext(t_load_refresh_handler(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytload_handlerscsE|s(�jhj�j�j|�rA�|||dt�ndS(NRs(RtunionRStintersectionR(RRttto_load(RuR(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytrefresh_handlers	cs�|j}|s|�jkr2�j|kr2dSx!�jD]}||kr<dSq<W�jg�jD]}|j|^qf�|�j<dS(N(tdictRXRRSRF(RRtRyRsRtkR(R(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRu s	csA|dks$t�j�j|�r=|jj�jd�ndS(N(R1R\RSRxR{RHR(Rtkeys(R(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytexpire_handler<s$cs|jj�jd�dS(s�After an insert or update, some columns may be expired due
            to server side defaults, or re-populated due to client side
            defaults.  Pop out the composite value here so that it
            recreates.

            N(R{RHRR1(R*t
connectionR(R(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytinsert_update_handler@stafter_inserttrawtafter_updatetloadt	propagateRWtexpireN(RtlistenR5R(RRvRzR~R�((RuRsP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRNs
cCsg|jD]}|j^q
S(N(RcR(RR((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRS\scCsg}g}t}x�|jD]�}|j}|j|jj||�}	|	j�r\t}n|	j�}
|
r~|j	|
�n
|j
d�|	jr�|j	|	j�q|j
d�qW|r�t
j|j|�gd|j|�g�St
jd|j|�gd�SdS(s>Provided for userland code that uses attributes.get_history().N((((RRcRRUR6Rthas_changesRtnon_deletedtextendRnR1tdeletedRtHistoryRF(RRRRtaddedR�thas_historyRRthistR�((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR`s*		
	cCs|j||�S(N(RB(RR*((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR)�stCompositeBundlecBseZd�Zd�ZRS(cCs,||_ttj|�j|j|�dS(N(RRDR>R�RR(Rt	property_texpr((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR�s	cs��fd�}|S(Ncs)�jjg�D]}||�^q�S(N(RRF(trowtproc(tprocsR(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR��s	((RtqueryR�tlabelsR�((R�RsP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytcreate_row_processor�s(RRRR�(((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR��s	RJcBsneZdZdZejd��Zd�Zejd��Z	d�Z
ejd��Zd�Zd�Z
RS(	s�Produce boolean, comparison, and other operators for
        :class:`.CompositeProperty` attributes.

        See the example in :ref:`composite_operations` for an overview
        of usage , as well as the documentation for :class:`.PropComparator`.

        .. seealso::

            :class:`.PropComparator`

            :class:`.ColumnOperators`

            :ref:`types_operators`

            :attr:`.TypeEngine.comparator_factory`

        cCstjdt|j�S(NRA(R	t
ClauseListRRd(R((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytclauses�s	cCs|jS(N(R	(R((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__clause_element__�scCsF|jji|jd6|jd6|jjd6�}tj|j|�S(Ntparententitytparentmappert	proxy_key(R�t	_annotatet
_parententityRRR>R�(RR�((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR	�s	

cCs�t|tjj�r!|j}n|dkrOg|jjD]}d^q:}n@t||jj�rs|j	�}nt
jd|j|f��t|j
|�S(Ns)Can't UPDATE composite attribute %s to %r(RfRtelementst
BindParameterR#R1RRSRFR^RlRmR]Rd(RR#RRZ((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt_bulk_update_tuples�s"cCsF|jr8g|jjD]}t|jj|j�^qS|jjSdS(N(t_adapt_to_entityRRdR'tentityR(RR((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRd�s	,cCs�|dkr(dgt|jj�}n|j�}gt|jj|�D]\}}||k^qJ}|jr�g|D]}|j|�^qx}ntj	|�S(N(
R1tlenRRdR^R]R�tadapterRtand_(RtotherRZRotbtcomparisonstx((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__eq__�s4	%cCstj|j|��S(N(Rtnot_R�(RR�((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__ne__�sN(RRR<R1t__hash__Rtmemoized_propertyR�R�R	R�RdR�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRJ�s		
	cCst|jjj�d|jS(Nt.(RgR5R2RR(R((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__str__�s(RRR<RR;RPR/RXRLRR�RdRcRRpRORNRSRRRR)torm_utiltBundleR�RRJR�(((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR>Ys"	;				=		J 	RtConcreteInheritedPropertycBs eZdZd�Zd�ZRS(s4A 'do nothing' :class:`.MapperProperty` that disables
    an attribute on a concrete subclass that is only present
    on the inherited mapper, not the concrete classes' mapper.

    Cases where this occurs include:

    * When the superclass mapper is mapped against a
      "polymorphic union", which includes all attributes from
      all subclasses.
    * When a relationship() is configured on an inherited mapper,
      but not on the subclass mapper.  Concrete mappers require
      that relationship() is configured explicitly on each
      subclass.

    cCsPd}xC|jj�D]2}|j|j}t|t�s|j}PqqW|S(N(R1R5titerate_to_roott_propsRRfR�RB(RR*tcomparator_callabletmtp((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR)�s	csQtt��j��fd��dtf��fd��Y}|��_dS(Ncs&td�j�j�jf��dS(NsgConcrete %s does not implement attribute %r at the instance level.  Add this property explicitly to %s.(tAttributeErrorR5R((R(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytwarnstNoninheritedConcretePropcs8eZ�fd�Z�fd�Z��fd�ZRS(cs��dS(N((tsR"R#(R�(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__set__scs��dS(N((R�R"(R�(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt
__delete__scs|dkr�jS��dS(N(R1R0(R�R"towner(RR�(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__get__s(RRR�R�R�((RR�(sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR�s(RDR�RR/R0(RR�((RR�sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRs(RRR<R)R(((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR��s	
tSynonymPropertycBskeZdddddd�Zed��Zejd��Zd�Z	d�Z
ejd�d��ZRS(cCsxtt|�j�||_||_||_||_|pO|rL|jpOd|_	|rg||_
ntj|�dS(s�Denote an attribute name as a synonym to a mapped property,
        in that the attribute will mirror the value and expression behavior
        of another attribute.

        e.g.::

            class MyClass(Base):
                __tablename__ = 'my_table'

                id = Column(Integer, primary_key=True)
                job_status = Column(String(50))

                status = synonym("job_status")


        :param name: the name of the existing mapped property.  This
          can refer to the string name ORM-mapped attribute
          configured on the class, including column-bound attributes
          and relationships.

        :param descriptor: a Python :term:`descriptor` that will be used
          as a getter (and potentially a setter) when this attribute is
          accessed at the instance level.

        :param map_column: **For classical mappings and mappings against
          an existing Table object only**.  if ``True``, the :func:`.synonym`
          construct will locate the :class:`_schema.Column`
          object upon the mapped
          table that would normally be associated with the attribute name of
          this synonym, and produce a new :class:`.ColumnProperty` that instead
          maps this :class:`_schema.Column`
          to the alternate name given as the "name"
          argument of the synonym; in this way, the usual step of redefining
          the mapping of the :class:`_schema.Column`
          to be under a different name is
          unnecessary. This is usually intended to be used when a
          :class:`_schema.Column`
          is to be replaced with an attribute that also uses a
          descriptor, that is, in conjunction with the
          :paramref:`.synonym.descriptor` parameter::

            my_table = Table(
                "my_table", metadata,
                Column('id', Integer, primary_key=True),
                Column('job_status', String(50))
            )

            class MyClass(object):
                @property
                def _job_status_descriptor(self):
                    return "Status: %s" % self._job_status


            mapper(
                MyClass, my_table, properties={
                    "job_status": synonym(
                        "_job_status", map_column=True,
                        descriptor=MyClass._job_status_descriptor)
                }
            )

          Above, the attribute named ``_job_status`` is automatically
          mapped to the ``job_status`` column::

            >>> j1 = MyClass()
            >>> j1._job_status = "employed"
            >>> j1.job_status
            Status: employed

          When using Declarative, in order to provide a descriptor in
          conjunction with a synonym, use the
          :func:`sqlalchemy.ext.declarative.synonym_for` helper.  However,
          note that the :ref:`hybrid properties <mapper_hybrids>` feature
          should usually be preferred, particularly when redefining attribute
          behavior.

        :param info: Optional data dictionary which will be populated into the
            :attr:`.InspectionAttr.info` attribute of this object.

            .. versionadded:: 1.0.0

        :param comparator_factory: A subclass of :class:`.PropComparator`
          that will provide custom comparison behavior at the SQL expression
          level.

          .. note::

            For the use case of providing an attribute which redefines both
            Python-level and SQL-expression level behavior of an attribute,
            please refer to the Hybrid attribute introduced at
            :ref:`mapper_hybrids` for a more effective technique.

        .. seealso::

            :ref:`synonyms` - Overview of synonyms

            :func:`.synonym_for` - a helper oriented towards Declarative

            :ref:`mapper_hybrids` - The Hybrid Attribute extension provides an
            updated approach to augmenting attribute behavior more flexibly
            than can be achieved with synonyms.

        N(
RDR�RR!t
map_columnR0RBR<R1R-RCRRK(RR!R�R0RBR-RC((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRsp				cCst|jj|j�jjS(N(R'R5R2R!R6R
(R((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR
�scCs�t|jj|j�}t|d�s;t|jt�r�t|tj	�rT|j
St|tj�rj|St
jd|jjj|j|f��n|jS(NRsGsynonym() attribute "%s.%s" only supports ORM mapped attributes, got %r(R'R5R2R!RRfRRRtQueryableAttributet
comparatorR
tColumnOperatorsRltInvalidRequestErrorR(RR_((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt_proxied_object�s"cCsT|j}t|t�rL|jr6|j||�}n|j||�}|S|SdS(N(R�RfRRB(RR*Rtcomp((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR)�s		cOs+t|jj|j�}|jj||�S(N(R'R5R2R!R6R(RtargtkwR_((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR�sssqlalchemy.orm.propertiescCstjj}|jr|j|jjkrUtjd|j	|jj
|jf��np|jj|j|jkr�|j|jj|jj|j	kr�tjd|j|j	|j	|jf��n|j|jj|j�}|j
|j	|d|dt�|j|_n||_dS(Ns>Can't compile synonym '%s': no column on table '%s' named '%s'spCan't call map_column=True for synonym %r=%r, a ColumnProperty already exists keyed to the name %r for column %rtinitt	setparent(Rt	preloadedtorm_propertiesR�Rtpersist_selectabletcRlRmR!tdescriptionRjtColumnPropertyt_configure_propertyRt_mapped_by_synonymR5(RR5R�t
propertiesR�((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt
set_parent�s*		%N(
RRR1RRR
RR�R�R)Rtpreload_moduleR�(((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR�su		N(R<R,RRR�t
interfacesRRRRRRlRRR	R
RR>R�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt<module>s"=��5