
    -he                         S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SS	KJ
r  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr   " S S\5      r " S S\5      r " S S\5      r " S S\5      rg)zDescriptor properties are more "auxiliary" properties
that exist as configurational elements, but don't participate
as actively in the load/persist ORM loop.

   )
attributes)util)MapperProperty)PropComparator)	_none_set   )event)exc)schema)sql
expression)	operatorsc                   *    \ rS rSrSrSrSrSrS rSr	g)DescriptorProperty   zK:class:`.MapperProperty` which proxies access to a
user-defined descriptor.NFc           	      t  ^ ^^ T m " U4S jS[         5      nT R                  cI  [        TR                  T R                  S 5      nTR                  T R                  U5      (       a  UT l        T R                  c!  U 4S jnU 4S jnU 4S jn[        XdUS9T l        [        R                  " T R                  5      " T R                  R                  T R                  T R                  UU 4S jT R                  T S9nU" T R                  5      Ul        TR                  R                  T R                  U5        g )	Nc                      > \ rS rSrSrSrSr\U 4S j5       rS r	\
"  Y S5      (       a  \R                  4U 4S jjrSrg	Srg	)
7DescriptorProperty.instrument_class.<locals>._ProxyImpl(   FTc                    > TR                   $ N)uses_objectsselfprops    tC:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\site-packages\sqlalchemy/orm/descriptor_props.pyr   DDescriptorProperty.instrument_class.<locals>._ProxyImpl.uses_objects-   s    (((    c                     Xl         g r   key)r   r"   s     r   __init__@DescriptorProperty.instrument_class.<locals>._ProxyImpl.__init__1   s    r   get_historyc                 (   > TR                  XU5      $ r   )r%   )r   statedict_passiver   s       r   r%   CDescriptorProperty.instrument_class.<locals>._ProxyImpl.get_history6   s      ++E'BBr   r!   N)__name__
__module____qualname____firstlineno__accepts_scalar_loaderload_on_unexpire
collectionpropertyr   r#   hasattrr   PASSIVE_OFFr%   __static_attributes__)r   s   r   
_ProxyImplr   (   sV    $)!#J) ) t]++ 1;0F0FC C ,r   r6   c                 4   > [        U TR                  U5        g r   )setattrname)objvaluer   s     r   fset1DescriptorProperty.instrument_class.<locals>.fsetB   s    TYY.r   c                 2   > [        U TR                  5        g r   )delattrr9   r:   r   s    r   fdel1DescriptorProperty.instrument_class.<locals>.fdelE   s    TYY'r   c                 0   > [        U TR                  5      $ r   )getattrr9   r@   s    r   fget1DescriptorProperty.instrument_class.<locals>.fgetH   s    sDII..r   )rE   r<   rA   c                  &   > TR                  T 5      $ r   )_comparator_factory)mapperr   s   r   <lambda>5DescriptorProperty.instrument_class.<locals>.<lambda>Q   s    D,,V4r   )docoriginal_property)object
descriptorrD   class_r"   _is_userland_descriptorr2   r   create_proxied_attributeparentrL   implclass_managerinstrument_attribute)	r   rI   r6   descr<   rA   rE   
proxy_attrr   s	   ``      @r   instrument_class#DescriptorProperty.instrument_class%   s    	C 	C& ??"6==$((D9D--dhh=="&??"/(/ 'D$GDO88IKKHHOO4"

 %TXX.
11$((JGr   rO   )
r+   r,   r-   r.   __doc__rL   r   _links_to_entityrY   r5    r   r   r   r      s      CL1Hr   r   c                   F  ^  \ rS rSrSrU 4S jrU 4S jrS r\" 5       r	S r
\R                  S 5       r\R                  S 5       r\S	 5       rS
 rS r\R                  S 5       r\R*                  4S jrS r " S S\R2                  5      r " S S\5      rS rSrU =r$ )CompositePropertyY   zDefines 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`

c                   > [         [        U ]  5         X l        Xl        UR                  SS5      U l        UR                  SS5      U l        UR                  SS5      U l        UR                  SU R                  R                  5      U l        SU;   a  UR                  S5      U l        [        R                  " U 5        U R!                  5         g)ap  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.

active_historyFdeferredgroupNcomparator_factoryinfo)superr`   r#   attrscomposite_classgetrc   rd   re   pop	__class__
Comparatorrf   rg   r   set_creation_order_create_descriptor)r   rP   ri   kwargsrm   s       r   r#   CompositeProperty.__init__f   s    V 	/1
%$jj)95A

:u5ZZ.
"(** $..";";#
 V

6*DI%!r   c                 L   > [         [        U ]  U5        U R                  5         g r   )rh   r`   rY   _setup_event_handlers)r   rI   rm   s     r   rY   "CompositeProperty.instrument_class   s    7?""$r   c                 $    U R                  5         g)zoInitialization which occurs after the :class:`.CompositeProperty`
has been associated with its parent mapper.

N)_setup_arguments_on_columnsr   s    r   do_initCompositeProperty.do_init   s    
 	((*r   c                 L   ^  U 4S jnU 4S jnU 4S jn[        XU5      T l        g)zdCreate the Python descriptor that will serve as
the access point on instances of the mapped class.

c                 (  > [         R                  " U 5      n[         R                  " U 5      nTR                  U;  a  TR                   Vs/ s H  n[        X5      PM     nnTR                  U;  a  UR                  c  [        R                  " U5      (       dX  TR                  " U6 UTR                  '   UR                  R                  R                  UTR                  TR                  /5        UR                  TR                  S 5      $ s  snf r   )r   instance_dictinstance_stater"   _attribute_keysrD   r   
issupersetrj   managerdispatchrefresh_COMPOSITE_FGETrk   )instancer(   r'   r"   valuesr   s        r   rE   2CompositeProperty._create_descriptor.<locals>.fget   s    ,,X6E--h7Exxu$
 7;6J6J6JsGH*6J   885(II)1E1Ef1M1M&*&:&:F&CE$((OMM**22t33dhhZ 99TXXt,,#s   Dc                   > [         R                  " U 5      n[         R                  " U 5      nUR                  TR                     nUR                  TR                  [         R                  5      nUR                  R                   H  nU" X1XTR                  5      nM     XTR                  '   Uc   TR                   H  n[        XS 5        M     g [        TR                  UR                  5       5       H  u  pq[        XU5        M     g r   )r   r}   r~   r   r"   rk   NO_VALUEr   setrT   r   r8   zip__composite_values__)	r   r;   r(   r'   attrpreviousfnr"   r   s	           r   r<   2CompositeProperty._create_descriptor.<locals>.fset   s    ,,X6E--h7E==*Dyy:+>+>?Hmm''599= (#$((O}//CH40 0 #&((%*D*D*F#JC H51#r   c                 n  > [         R                  " U 5      n[         R                  " U 5      nUR                  TR                  [         R
                  5      nUR                  TR                     nUR                  R                  XUR                  5        TR                   H  n[        XS 5        M     g r   )r   r~   r}   rl   r"   r   r   r   removerT   r   r8   )r   r'   r(   r   r   r"   r   s         r   rA   2CompositeProperty._create_descriptor.<locals>.fdel   s    --h7E,,X6Eyy:+>+>?H==*DMM  $))<++t, ,r   N)r2   rO   )r   rE   r<   rA   s   `   r   rp   $CompositeProperty._create_descriptor   s"    	-6	2"	- #4t4r   c                     U R                    Vs/ s H-  n[        U R                  R                  UR                  5      PM/     sn$ s  snf r   )propsrD   rS   rP   r"   r   s     r   _comparable_elements&CompositeProperty._comparable_elements   s3    BF**M*$**DHH5*MMMs   4Ac                    / nU R                    H  n[        U[        5      (       a  U R                  R	                  USS9nO[        U[
        R                  5      (       a  U R                  R                  U   nOF[        U[        R                  5      (       a  UR                  nO[        R                  " SU< 35      eUR                  U5        M     U$ )NF)_configure_mapperszYComposite expects Column objects or mapped attributes/attribute names as arguments, got: )ri   
isinstancestrrS   get_propertyr   Column_columntopropertyr   InstrumentedAttributer2   sa_excArgumentErrorappend)r   r   r   r   s       r   r   CompositeProperty.props   s    JJD$$${{///OD&--00{{44T:D*"B"BCC}}**  
 LL  r   c                     U R                    Vs/ s H&  n[        U[        R                  5      (       d  M$  UPM(     sn$ s  snf r   )ri   r   r   r   )r   as     r   columnsCompositeProperty.columns  s+    ::F:aAv}})E:FFFs   #??c                     U R                    HN  nU R                  Ul        U R                  (       a  U R                  Ul        SUl        U R                  Ul        MP     g)zgPropagate configuration arguments made on this composite
to the target columns, for those that apply.

))rd   T)
instrumentTN)r   rc   rd   strategy_keyre   r   s     r   rw   -CompositeProperty._setup_arguments_on_columns  sE    
 JJD"&"5"5D}} $$N!DJ r   c                   ^ ^ U4S jnUU 4S jnU 4S jmU 4S jnU 4S jn[         R                  " T R                  SUSS9  [         R                  " T R                  S	USS9  [         R                  " T R                  S
USSS9  [         R                  " T R                  SUSSS9  [         R                  " T R                  SUSSS9  g)z>Establish events that populate/expire the composite attribute.c                    > T" XS SS9  g )NF
is_refreshr^   )r'   context_load_refresh_handlers     r   load_handler=CompositeProperty._setup_event_handlers.<locals>.load_handler  s    !%$5Ir   c                    > U(       a:  TR                   1R                  TR                  5      R                  U5      (       a	  T" XUSS9  g g )NTr   )r"   unionr   intersection)r'   r   to_loadr   r   s      r   refresh_handler@CompositeProperty._setup_event_handlers.<locals>.refresh_handler  sD     
  !5!56l7#$ &eg$O$r   c                 0  > U R                   nU(       a  UTR                  L a  TR                  U;   a  g TR                   H
  nXT;  d  M
    g    TR                  " TR                   Vs/ s H  o`R                   U   PM     sn6 UTR                  '   g s  snf r   )dictr   r"   r   rj   )r'   r   r   r   r(   kr"   r   s          r   r   FCompositeProperty._setup_event_handlers.<locals>._load_refresh_handler   s    JJE 'T-A-A"A((e#
 ))> * #22-1-A-AB-Ac**S/-ABE$((OBs   )Bc                    > Ub)  [        TR                  5      R                  U5      (       a'  U R                  R	                  TR
                  S 5        g g r   )r   r   r   r   rl   r"   )r'   keysr   s     r   expire_handler?CompositeProperty._setup_event_handlers.<locals>.expire_handler<  s?    |s4#7#78EEdKK

txx.  Lr   c                 R   > UR                   R                  TR                  S5        g)zAfter 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   rl   r"   )rI   
connectionr'   r   s      r   insert_update_handlerFCompositeProperty._setup_event_handlers.<locals>.insert_update_handler@  s     JJNN488T*r   after_insertT)rawafter_updateload)r   	propagater   expireN)r	   listenrS   )r   r   r   r   r   r   s   `    @r   rt   'CompositeProperty._setup_event_handlers  s    	J	P	8	/	+ 	KK)>D	
 	KK)>D	
 	KK44	
 	KKO	
 	KK>tt	
r   c                 X    U R                    Vs/ s H  oR                  PM     sn$ s  snf r   )r   r"   r   s     r   r   !CompositeProperty._attribute_keys\  s     %)ZZ0ZTZ000s   'c                 ~   / n/ nSnU R                    H  nUR                  nUR                  U   R                  R	                  X5      n	U	R                  5       (       a  SnU	R                  5       n
U
(       a  UR                  U
5        OUR                  S5        U	R                  (       a  UR                  U	R                  5        M  UR                  S5        M     U(       a4  [        R                  " U R                  " U6 /SU R                  " U6 /5      $ [        R                  " SU R                  " U6 /S5      $ )z>Provided for userland code that uses attributes.get_history().FTNr^   )r   r"   r   rT   r%   has_changesnon_deletedextendr   deletedr   Historyrj   )r   r'   r(   r)   addedr   has_historyr   r"   histr   s              r   r%   CompositeProperty.get_history`  s    JJD((C==%**66uDD!!"**,K[)T"||t||,t$   %%%%u-.%%w/0  %%b4+?+?+G*H"MMr   c                 $    U R                  X5      $ r   )rf   )r   rI   s     r   rH   %CompositeProperty._comparator_factory  s    &&t44r   c                   .   ^  \ rS rSrU 4S jrS rSrU =r$ )!CompositeProperty.CompositeBundlei  c                 d   > Xl         [        [        R                  U ]  " UR
                  /UQ76   g r   )r2   rh   r`   CompositeBundler#   r"   )r   	property_exprrm   s      r   r#   *CompositeProperty.CompositeBundle.__init__  s-    %M#33TC $r   c                    ^ ^ UU 4S jnU$ )Nc                 l   > TR                   R                  " T Vs/ s H
  o" U 5      PM     sn6 $ s  snf r   )r2   rj   )rowprocprocsr   s     r   r   DCompositeProperty.CompositeBundle.create_row_processor.<locals>.proc  s3    }}44,12EDd3iE2 2s   1r^   )r   queryr   labelsr   s   ` `  r   create_row_processor6CompositeProperty.CompositeBundle.create_row_processor  s    
 Kr   )r2   )r+   r,   r-   r.   r#   r   r5   __classcell__rm   s   @r   r   r     s    		 	r   r   c                       \ rS rSrSrSr\R                  S 5       rS r	\R                  S 5       r
S r\R                  S 5       rS	 rS
 rSrg)CompositeProperty.Comparatori  aw  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`

Nc                 B    [         R                  " U R                  SS06$ )Nre   F)r   
ClauseListr   rx   s    r   clauses$CompositeProperty.Comparator.clauses  s&    (("77 r   c                     U R                   $ r   r   rx   s    r   __clause_element__/CompositeProperty.Comparator.__clause_element__  s    ??"r   c                     U R                   R                  U R                  U R                  U R                  R                  S.5      n[
        R                  U R                  U5      $ )N)parententityparentmapper	proxy_key)r   	_annotate_parententityr   r"   r`   r   )r   r   s     r   r   'CompositeProperty.Comparator.expression  sQ    ll,,$($6$6$($6$6!%G %44TYYHHr   c                    [        U[        R                  R                  5      (       a  UR                  nUc'  U R
                  R                   Vs/ s H  nS PM     nnO][        XR
                  R                  5      (       a  UR                  5       nO([        R                  " SU R
                  < SU< 35      e[        U R                  U5      $ s  snf )Nz!Can't UPDATE composite attribute z to )r   r   elementsBindParameterr;   r   r   rj   r   r   r   r   r   )r   r;   r"   r   s       r   _bulk_update_tuples0CompositeProperty.Comparator._bulk_update_tuples  s    %!;!;<<}*.))*C*CD*C3$*CDE99#<#<==335**yy%) 
 t00&99 Es   Cc                     U R                   (       aO  U R                  R                   Vs/ s H-  n[        U R                   R                  UR
                  5      PM/     sn$ U R                  R                  $ s  snf r   )_adapt_to_entityr   r   rD   entityr"   r   s     r   r   1CompositeProperty.Comparator._comparable_elements  se    $$ !%		 > > > D1188$((C > 
 yy555s   4A7c                 z   Uc$  S /[        U R                  R                  5      -  nOUR                  5       n[	        U R                  R                  U5       VVs/ s H	  u  p4X4:H  PM     nnnU R
                  (       a   U Vs/ s H  o`R                  U5      PM     nn[        R                  " U6 $ s  snnf s  snf r   )	lenr   r   r   r   r  adapterr   and_)r   otherr   r   bcomparisonsxs          r   __eq__#CompositeProperty.Comparator.__eq__  s    }#dii&D&D"EE335#&tyy'E'Ev#N#N41#N   $$8CD1||AD88[)) Es   B2B8c                 L    [         R                  " U R                  U5      5      $ r   )r   not_r  )r   r  s     r   __ne__#CompositeProperty.Comparator.__ne__  s    88DKK.//r   r^   )r+   r,   r-   r.   r\   __hash__r   memoized_propertyr   r   r   r  r   r  r  r5   r^   r   r   rn   r     sp    	$ 				 
 	
	# 
			I 
 	I	:  
			6 
 	6
	*	0r   rn   c                 t    [        U R                  R                  R                  5      S-   U R                  -   $ )N.)r   rS   rP   r+   r"   rx   s    r   __str__CompositeProperty.__str__  s+    4;;%%../#5@@r   )rc   ri   rf   rj   rd   rO   re   rg   ) r+   r,   r-   r.   r\   r#   rY   ry   rN   r   rp   r   r  r   r   r2   r   rw   rt   r   r   r4   r%   rH   orm_utilBundler   r   rn   r  r5   r   r   s   @r   r`   r`   Y   s    
9"v%+ hO;5z 
N N 
 $ G G
$F
T 
1 1 1;0F0F N@5(// P0^ P0dA Ar   r`   c                   2   ^  \ rS rSrSrS rU 4S jrSrU =r$ )ConcreteInheritedPropertyi  a  A '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.

c                     S nU R                   R                  5        H@  nUR                  U R                     n[	        U[
        5      (       a  M3  UR                  n  U$    U$ r   )rS   iterate_to_root_propsr"   r   r   rf   )r   rI   comparator_callablemps        r   rH   -ConcreteInheritedProperty._comparator_factory  s\    ",,.A"Aa!:;;&'&:&:#"" /
 #"r   c                 x   >^ ^ [         [        T ]  5         U 4S jm " U U4S jS[        5      nU" 5       T l        g )Nc            	      p   > [        ST R                  < ST R                  < ST R                  < S35      e)Nz	Concrete z does not implement attribute z9 at the instance level.  Add this property explicitly to r  )AttributeErrorrS   r"   rx   s   r   warn0ConcreteInheritedProperty.__init__.<locals>.warn  s*      ;;$++7 r   c                   <   > \ rS rSrU4S jrU4S jrU U4S jrSrg)DConcreteInheritedProperty.__init__.<locals>.NoninheritedConcretePropi  c                    > T" 5         g r   r^   )sr:   r;   r+  s      r   __set__LConcreteInheritedProperty.__init__.<locals>.NoninheritedConcreteProp.__set__      r   c                    > T" 5         g r   r^   )r0  r:   r+  s     r   
__delete__OConcreteInheritedProperty.__init__.<locals>.NoninheritedConcreteProp.__delete__  r3  r   c                 2   > Uc  TR                   $ T" 5         g r   r[   )r0  r:   ownerr   r+  s      r   __get__LConcreteInheritedProperty.__init__.<locals>.NoninheritedConcreteProp.__get__  s    ;??*r   r^   N)r+   r,   r-   r.   r1  r5  r9  r5   )r   r+  s   r   NoninheritedConcretePropr.    s     r   r;  )rh   r   r#   rN   rO   )r   r;  r+  rm   s   ` @r   r#   "ConcreteInheritedProperty.__init__  s3    '79	
	 
	v 
	 34r   r[   )	r+   r,   r-   r.   r\   rH   r#   r5   r   r   s   @r   r   r     s     #5 5r   r   c                      ^  \ rS rSr     S
U 4S jjr\S 5       r\R                  S 5       r	S r
S r\R                  " S5      S 5       rS	rU =r$ )SynonymPropertyi  c                    > [         [        U ]  5         Xl        X l        X0l        X@l        U=(       d    U=(       a    UR                  =(       d    SU l        U(       a  X`l	        [        R                  " U 5        g)aY  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)rh   r>  r#   r9   
map_columnrO   rf   r\   rL   rg   r   ro   )r   r9   r@  rO   rf   rL   rg   rm   s          r   r#   SynonymProperty.__init__  sZ    ` 	ot-/	$$"4E:<**<*<EI%r   c                 ~    [        U R                  R                  U R                  5      R                  R
                  $ r   )rD   rS   rP   r9   rT   r   rx   s    r   r   SynonymProperty.uses_objects  s)    t{{))4995::GGGr   c                    [        U R                  R                  U R                  5      n[	        US5      (       a  [        UR                  [        5      (       d  [        U[        R                  5      (       a  UR                  $ [        U[        R                  5      (       a  U$ [        R                  " SU R                  R                  R                  < SU R                  < SU< 35      eUR                  $ )Nr2   zsynonym() attribute "r  z+" only supports ORM mapped attributes, got )rD   rS   rP   r9   r3   r   r2   r   r   QueryableAttribute
comparatorr   ColumnOperatorsr   InvalidRequestErrorr+   )r   r   s     r   _proxied_objectSynonymProperty._proxied_object  s    t{{))4995tZ((
MM>1
 1

 $
 = =>>&D)";";<<,, ;;%%..		4A 
 }}r   c                     U R                   n[        U[        5      (       a7  U R                  (       a  U R                  X!5      nU$ UR                  X!5      nU$ U$ r   )rI  r   r   rf   )r   rI   r   comps       r   rH   #SynonymProperty._comparator_factory  sV    ##dN++&&..t< K ..t<KKr   c                     [        U R                  R                  U R                  5      nUR                  R
                  " U0 UD6$ r   )rD   rS   rP   r9   rT   r%   )r   argkwr   s       r   r%   SynonymProperty.get_history  s6    t{{))4995yy$$c0R00r   zsqlalchemy.orm.propertiesc           
         [         R                  R                  nU R                  (       Ga  U R                  UR
                  R                  ;  aK  [        R                  " SU R                  < SUR
                  R                  < SU R                  < S35      eUR
                  R                  U R                     UR                  ;   a  UR                  UR
                  R                  U R                        R                  U R                  :X  aN  [        R                  " SU R                  < SU R                  < SU R                  < SU R                  < 35      eUR                  UR
                  R                  U R                     5      nUR                  U R                  XBS	S
9  U R                  Ul        Xl        g )NzCan't compile synonym 'z': no column on table 'z	' named ''z'Can't call map_column=True for synonym =z4, a ColumnProperty already exists keyed to the name z for column T)init	setparent)r   	preloadedorm_propertiesr@  r"   persist_selectablecr   r   r9   descriptionr   ColumnProperty_configure_property_mapped_by_synonymrS   )r   rS   rU  
propertiesr&  s        r   
set_parentSynonymProperty.set_parent  sT   ^^22
???xxv88:::** 		11==  ))++DHH5++,,,--//9#99
 ** xxDIItxxA  ))))++DHH5A &&tyy!$&O#'88A r   )rf   rO   rL   rg   r@  r9   rS   )NNNNN)r+   r,   r-   r.   r#   r2   r   r   r  rI  rH   r%   preload_moduler`  r5   r   r   s   @r   r>  r>    su     z&x H H 
 &
1 
45# 6#r   r>  N)r\    r   r   r  
interfacesr   r   r   r	   r
   r   r   r   r   r   r   r`   r   r>  r^   r   r   <module>re     sn      & &        :H :HzLA* LA^25 2 25jL( Lr   