%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyc

�
��4]c@s�dZddlmZddlmZddlmZddlmZddlmZddlm	Z	dd	lm
Z
dd
lmZddlm
Z
ddlmZdd
lmZddlmZdefd��YZejjdde�defd��Y�Zejjdde�defd��Y�Zejjdde�defd��Y�Zejjdde�ejdd�defd��Y��ZdS(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(t
properties(tquery(tMapperProperty(tPropComparator(t	_none_seti(tevent(texc(tschema(tsql(tutil(t
expressiontDescriptorPropertycBseZdZdZd�ZRS(sS:class:`.MapperProperty` which proxies access to a
        user-defined descriptor.c	s;��dtf��fd��Y}�jdkrjt�j�jd�}�j|�rj|�_qjn�jdkr��fd�}�fd�}�fd�}td|d|d|��_ntj	�j��j
j�j�j��fd	�d
�jd��}|�j�|_�j
j�j|�dS(Nt
_ProxyImplcsbeZeZeZeZe��fd��Zd�Z	e
�d�r`ej�fd�Z
nRS(cst�j�j�jjS(N(tgetattrtclass_tnametimpltuses_objects(tself(tmappertprop(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR*scSs
||_dS(N(tkey(RR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__init__.stget_historycs�j|||�S(N(R(Rtstatetdict_tpassive(R(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR3s(t__name__t
__module__tFalsetaccepts_scalar_loadertTruetexpire_missingt
collectiontpropertyRRthasattrRtPASSIVE_OFFR((RR(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR
%s	cst|�j|�dS(N(tsetattrR(tobjtvalue(R(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytfset?scst|�j�dS(N(tdelattrR(R'(R(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytfdelBscst|�j�S(N(RR(R'(R(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytfgetEsR,R)R+cs
�j��S(N(t_comparator_factory((RR(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt<lambda>Nttdoctoriginal_property(tobjectt
descriptortNoneRRRt_is_userland_descriptorR#Rtcreate_proxied_attributetparentR0Rt
class_managertinstrument_attribute(RRR
tdescR)R+R,t
proxy_attr((RRRsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytinstrument_class"s(!			N(RRt__doc__R4R0R<(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRsssqlalchemy.orm.propertiest
add_to_alltCompositePropertycBs�eZdZejdd�d��Zd�Zd�Zd�Zej	d��Z
ej	d	��Zed
��Z
d�Zd�Zej	d
��Zejd�Zd�Zdejfd��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`

    t	extensions0.7s�:class:`.AttributeExtension` is deprecated in favor of the :class:`.AttributeEvents` listener interface.  The :paramref:`.composite.extension` parameter will be removed in a future release.cOs�tt|�j�||_||_|jdt�|_|jdt�|_|jdd�|_
|jd|jj
�|_d|kr�|jd�|_ntj|�|j�dS(sQReturn 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.

        :param extension:
          an :class:`.AttributeExtension` instance,
          or list of extensions, which will be prepended to the list of
          attribute listeners for the resulting descriptor placed on the
          class.

        tactive_historytdeferredtgrouptcomparator_factorytinfoN(tsuperR?Rtattrstcomposite_classtgetRRARBR4RCtpopt	__class__t
ComparatorRDRER
tset_creation_ordert_create_descriptor(RRRGtkwargs((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRds:		
cCs$tt|�j|�|j�dS(N(RFR?R<t_setup_event_handlers(RR((sR/opt/alt/python27/lib64/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((sR/opt/alt/python27/lib64/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|d�jg�q�n|j
�jd�S(N(Rt
instance_dicttinstance_stateRt_attribute_keysRR4Rt
issupersetRHtmanagertdispatchtrefreshRI(tinstanceRRRtvalues(R(sR/opt/alt/python27/lib64/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(RRSRTRWRRItNO_VALUERXtsetRR4RUR&tzipt__composite_values__(RZR(RRtattrtprevioustfnR(R(sR/opt/alt/python27/lib64/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(
RRTRSRJRR\RWRXtremoveRRUR&R4(RZRRRaR`R(R(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR+�sN(R#R3(RR,R)R+((RsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRN�s	cCs,g|jD]}t|jj|j�^q
S(N(tpropsRR7RR(RR((sR/opt/alt/python27/lib64/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(RGt
isinstancetstrR7tget_propertyRRtColumnt_columntopropertyRtInstrumentedAttributeR#tsa_exct
ArgumentErrortappend(RRdR`R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRd�s
cCs,g|jD]}t|tj�r
|^q
S(N(RGRgRRj(Rta((sR/opt/alt/python27/lib64/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.

        RBt
instrumentN(RdRARBR tstrategy_keyRC(RR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRQs	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�||dt�dS(Nt
is_refresh(R(Rtargs(t_load_refresh_handler(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytload_handlerscs�||dt�dS(NRt(R (RRu(Rv(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytrefresh_handler!scs~|j}|r#�j|kr#dSx!�jD]}||kr-dSq-W�jg�jD]}|j|^qW�|�j<dS(N(tdictRRURH(RRuRtRtkR(R(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRv$s	csA|dks$t�j�j|�r=|jj�jd�ndS(N(R4R]RUtintersectionRyRJR(Rtkeys(R(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytexpire_handler5s$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(RyRJRR4(Rt
connectionR(R(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytinsert_update_handler9stafter_inserttrawtafter_updatetloadt	propagateRYtexpireN(RtlistenR7R (RRwRxR}R((RvRsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRPs
cCsg|jD]}|j^q
S(N(RdR(RR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRUUscCs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((((RRdRRWRRthas_changesR tnon_deletedtextendRoR4tdeletedRtHistoryRH(RRRRtaddedR�thas_historyRRthistR�((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRYs*		
	cCs|j||�S(N(RD(RR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR-ystCompositeBundlecBseZd�Zd�ZRS(cCs,||_ttj|�j|j|�dS(N(R#RFR?R�RR(Rt	property_texpr((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR}s	cs��fd�}|S(Ncs)�jjg�D]}||�^q�S(N(R#RH(trowtproc(tprocsR(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR��s	((RRR�tlabelsR�((R�RsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytcreate_row_processor�s(RRRR�(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR�|s	RLcBsbeZdZdZed��Zd�Zd�Zd�Z	e
jd��Zd�Z
d�ZRS(	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`

        cCs
|j�S(N(t__clause_element__(R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytclauses�scCstjdt|j�S(NRC(Rt
ClauseListRRe(R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR��s	cCstj|j|j��S(N(R?R�RR�(R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt_query_clause_element�scCs~|dkr.g|jjD]}d^q}n@t||jj�rR|j�}ntjd|j|f��t|j	|�S(Ns)Can't UPDATE composite attribute %s to %r(
R4RRURgRHR_RmRnR^Re(RR(RR[((sR/opt/alt/python27/lib64/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_entityRReRtentityR(RR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRe�s	,cCs�|dkr(dgt|jj�}n|j�}gt|jj|�D]\}}||k^qJ}|jr�g|D]}|j|�^qx}ntj	|�S(N(
R4tlenRReR_R^R�tadapterR	tand_(RtotherR[Rptbtcomparisonstx((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__eq__�s4	%cCstj|j|��S(N(R	tnot_R�(RR�((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__ne__�sN(RRR=R4t__hash__R#R�R�R�R�R
tmemoized_propertyReR�R�(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRL�s			

	cCst|jjj�d|jS(Nt.(RhR7RRR(R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__str__�s(s0.7s�:class:`.AttributeExtension` is deprecated in favor of the :class:`.AttributeEvents` listener interface.  The :paramref:`.composite.extension` parameter will be removed in a future release.(RRR=R
tdeprecated_paramsRR<RRRNR�ReRdR#RqRQRPRURR%RR-RtBundleR�RRLR�(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR?Vs$	G			;		: 	ItConcreteInheritedPropertycBs 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(R4R7titerate_to_roott_propsRRgR�RD(RRtcomparator_callabletmtp((sR/opt/alt/python27/lib64/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.(tAttributeErrorR7R((R(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pytwarn�stNoninheritedConcretePropcs8eZ�fd�Z�fd�Z��fd�ZRS(cs��dS(N((tsR'R((R�(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__set__scs��dS(N((R�R'(R�(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt
__delete__scs|dkr�jS��dS(N(R4R3(R�R'towner(RR�(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt__get__s(RRR�R�R�((RR�(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR��s(RFR�RR2R3(RR�((RR�sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR�s(RRR=R-R(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR��s	
tSynonymPropertycBsMeZdddddd�Zejd��Zd�Zd�Zd�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:`.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:`.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:`.Column` to be under a different name is
          unnecessary. This is usually intended to be used when a
          :class:`.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(
RFR�RRt
map_columnR3RDR=R4R0RER
RM(RRR�R3RDR0RE((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyRsl				cCsmt|jj|j�}t|d�s;t|jt�rftj	d|jjj
|j|f��n|jS(NR#sGsynonym() attribute "%s.%s" only supports ORM mapped attributes, got %r(RR7RRR$RgR#RRmtInvalidRequestErrorR(RR`((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt_proxied_property�s"cCs=|j}|jr'|j||�}n|j||�}|S(N(R�RD(RRRtcomp((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR-�s
		cOs+t|jj|j�}|jj||�S(N(RR7RRRR(RtargtkwR`((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR�scCs|jr|j|jjkrItjd|j|jj|jf��np|jj|j|jkr�|j|jj|jj|jkr�tjd|j|j|j|jf��nt	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(R�Rtpersist_selectabletcRmRnRtdescriptionRkRtColumnPropertyt_configure_propertyR t_mapped_by_synonymR7(RR7R�R�((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt
set_parent�s(		%N(
RRR4RR
R�R�R-RR�(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR�st
			s0.7s�:func:`.comparable_property` is deprecated and will be removed in a future release.  Please refer to the :mod:`~sqlalchemy.ext.hybrid` extension.tComparablePropertycBs)eZdZdddd�Zd�ZRS(s;Instruments a Python property for use in query expressions.cCsftt|�j�||_||_|p=|r:|jp=d|_|rU||_nt	j
|�dS(s�	Provides a method of applying a :class:`.PropComparator`
        to any Python descriptor attribute.


        Allows any Python descriptor to behave like a SQL-enabled
        attribute when used at the class level in queries, allowing
        redefinition of expression operator behavior.

        In the example below we redefine :meth:`.PropComparator.operate`
        to wrap both sides of an expression in ``func.lower()`` to produce
        case-insensitive comparison::

            from sqlalchemy.orm import comparable_property
            from sqlalchemy.orm.interfaces import PropComparator
            from sqlalchemy.sql import func
            from sqlalchemy import Integer, String, Column
            from sqlalchemy.ext.declarative import declarative_base

            class CaseInsensitiveComparator(PropComparator):
                def __clause_element__(self):
                    return self.prop

                def operate(self, op, other):
                    return op(
                        func.lower(self.__clause_element__()),
                        func.lower(other)
                    )

            Base = declarative_base()

            class SearchWord(Base):
                __tablename__ = 'search_word'
                id = Column(Integer, primary_key=True)
                word = Column(String)
                word_insensitive = comparable_property(lambda prop, mapper:
                                CaseInsensitiveComparator(
                                    mapper.c.word, mapper)
                            )


        A mapping like the above allows the ``word_insensitive`` attribute
        to render an expression like::

            >>> print SearchWord.word_insensitive == "Trucks"
            lower(search_word.word) = lower(:lower_1)

        :param comparator_factory:
          A PropComparator subclass or factory that defines operator behavior
          for this property.

        :param descriptor:
          Optional when used in a ``properties={}`` declaration.  The Python
          descriptor or property to layer comparison behavior on top of.

          The like-named descriptor will be automatically retrieved from the
          mapped class if left blank in a ``properties`` declaration.

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

            .. versionadded:: 1.0.0

        N(RFR�RR3RDR=R4R0RER
RM(RRDR3R0RE((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR�sB		cCs|j||�S(N(RD(RR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR-sN(RRR=R4RR-(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyR��sIN(R=R/RRRt
interfacesRRR
RRRRmRR	RRtlanghelperstdependency_forR R?R�R�tdeprecated_clsR�(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/descriptor_props.pyt<module>s2:��5�	

Zerion Mini Shell 1.0