
    ,h                       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  \(       a  S	SKJr  S	SKJr  S	SKJr  \	" S\S9r\\4r  " S S\R4                  5      r\r " S S\R4                  5      r " S S\R<                  5      r " S S\R@                  5      r! " S S\R4                  5      r" " S S \R4                  5      r# " S! S"\!5      r$ " S# S$\!5      r% " S% S&\R@                  5      r& " S' S(\R@                  5      r' " S) S*\R@                  5      r(S/S+ jr)\
RT                  " S,5      S0S- j5       r+g.)1zSQLAlchemy ORM exceptions.    )annotations)Any)Optional)Tuple)Type)TYPE_CHECKING)TypeVar   )_mapper_property_as_plain_name   )exc)util)MultipleResultsFound)NoResultFound)LoaderStrategy)MapperProperty)InstanceState_T)boundc                      \ rS rSrSrSrg)StaleDataError$   a!  An operation encountered database state that is unaccounted for.

Conditions which cause this to happen include:

* A flush may have attempted to update or delete rows
  and an unexpected number of rows were matched during
  the UPDATE or DELETE statement.   Note that when
  version_id_col is used, rows in UPDATE or DELETE statements
  are also matched against the current known version
  identifier.

* A mapped object with version_id_col was refreshed,
  and the version number coming back from the database does
  not match that of the object itself.

* A object is detached from its parent object, however
  the object was previously attached to a different parent
  identity which was garbage collected, and a decision
  cannot be made if the new parent was really the most
  recent "parent".

 N__name__
__module____qualname____firstlineno____doc____static_attributes__r       J/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/orm/exc.pyr   r   $   s    r!   r   c                      \ rS rSrSrSrg)
FlushError@   z0A invalid condition was detected during flush().r   Nr   r   r!   r"   r$   r$   @   s    :r!   r$   c                      \ rS rSrSrSrg)MappedAnnotationErrorD   zRaised when ORM annotated declarative cannot interpret the
expression present inside of the :class:`.Mapped` construct.

.. versionadded:: 2.0.40

r   Nr   r   r!   r"   r'   r'   D   s    r!   r'   c                      \ rS rSrSrSrg)UnmappedErrorM   z?Base for exceptions that involve expected mappings not present.r   Nr   r   r!   r"   r*   r*   M   s    Ir!   r*   c                      \ rS rSrSrSrg)ObjectDereferencedErrorQ   zHAn operation cannot complete due to an object being garbage
collected.

r   Nr   r   r!   r"   r-   r-   Q   s    r!   r-   c                      \ rS rSrSrSrSrg)DetachedInstanceErrorX   zOAn attempt to access unloaded attributes on a
mapped instance that is detached.bhk3r   N)r   r   r   r   r   coder    r   r!   r"   r0   r0   X   s    ) Dr!   r0   c                  Z    \ rS rSrSr\R                  " S5      SS	S jj5       rS
S jrSr	g)UnmappedInstanceError_   z;An mapping operation was requested for an unknown instance.sqlalchemy.orm.baseNc                   [         R                  R                  nU(       d:   UR                  [	        U5      5        [        [	        U5      5      nSU< SU< S3n[        R                  X5        g ! [         aA    S[        [	        U5      5       S3n[        U[        5      (       a  US[        U5      -  -  n N`f = f)NzClass z| is mapped, but this instance lacks instrumentation.  This occurs when the instance is created before sqlalchemy.orm.mapper(z) was called.Class '' is not mappedz;; was a class (%s) supplied where an instance was required?)
r   	preloadedorm_baseclass_mappertype_safe_cls_nameUnmappedClassError
isinstancer*   __init__)selfobjmsgbasenames        r"   rB   UnmappedInstanceError.__init__b   s    ~~&&!!$s),%d3i0
 &*41  	t) & tCy 9:/Jc4(($&4S&9:Cs   9A2 2AB=<B=c                <    U R                   S U R                  S   44$ Nr   	__class__argsrC   s    r"   
__reduce__ UnmappedInstanceError.__reduce__y       ~~diil333r!   r   N)rD   objectrE   Optional[str]returnr   
r   r   r   r   r   r   preload_modulerB   rO   r    r   r!   r"   r5   r5   _   s(    E	./* 0*,4r!   r5   c                  0    \ rS rSrSrSSS jjrS	S jrSrg)
r@   }   z8An mapping operation was requested for an unknown class.Nc                R    U(       d  [        U5      n[        R                  X5        g rR   )_default_unmappedr*   rB   )rC   clsrE   s      r"   rB   UnmappedClassError.__init__   s    #C(Ct)r!   c                <    U R                   S U R                  S   44$ rJ   rK   rN   s    r"   rO   UnmappedClassError.__reduce__   rQ   r!   r   rR   )r]   zType[_T]rE   rT   rU   )r   r   r   r   r   rB   rO   r    r   r!   r"   r@   r@   }   s    B*
4r!   r@   c                  Z    \ rS rSrSr\R                  " S5      SS	S jj5       rS
S jrSr	g)ObjectDeletedError   a  A refresh operation failed to retrieve the database
row corresponding to an object's known primary key identity.

A refresh operation proceeds when an expired attribute is
accessed on an object, or when :meth:`_query.Query.get` is
used to retrieve an object which is, upon retrieval, detected
as expired.   A SELECT is emitted for the target row
based on primary key; if no row is returned, this
exception is raised.

The true meaning of this exception is simply that
no row exists for the primary key identifier associated
with a persistent object.   The row may have been
deleted, or in some cases the primary key updated
to a new value, outside of the ORM's management of the target
object.

r7   Nc                    [         R                  R                  nU(       d  SUR                  U5      -  n[        R
                  R                  X5        g )NzDInstance '%s' has been deleted, or its row is otherwise not present.)r   r;   r<   	state_strsa_excInvalidRequestErrorrB   )rC   staterE   rF   s       r"   rB   ObjectDeletedError.__init__   sF    ~~&&026..2GH 
 	""++D6r!   c                <    U R                   S U R                  S   44$ rJ   rK   rN   s    r"   rO   ObjectDeletedError.__reduce__   rQ   r!   r   rR   )rh   zInstanceState[Any]rE   rT   rU   rW   r   r!   r"   rb   rb      s,    & 
./	7 0	74r!   rb   c                      \ rS rSrSrSrg)UnmappedColumnError   z5Mapping operation was requested on an unknown column.r   Nr   r   r!   r"   rm   rm      s    ?r!   rm   c                  6    \ rS rSrSr          SS jrSrg)LoaderStrategyException   z2A loader strategy for an attribute does not exist.c                   Uc)  [         R                  R                  U SU< SU< 35        g Uc   e[         R                  R                  U S[        R                  " U5      < SU< S[        U5      < S[        U5      < S3	5        g )NzCan't find strategy z for zCan't apply "z" strategy to property "z", which is a "z7"; this loader strategy is intended to be used with a "z".)rf   rg   rB   r   clsname_as_plain_namer   )rC   applied_to_property_typerequesting_property
applies_toactual_strategy_typestrategy_keys         r"   rB    LoaderStrategyException.__init__   s{      '&&//!46 )))&&//
 ../CD'23KL2:>r!   r   N)
rt   	Type[Any]ru   zMapperProperty[Any]rv   z#Optional[Type[MapperProperty[Any]]]rw   zOptional[Type[LoaderStrategy]]rx   zTuple[Any, ...])r   r   r   r   r   rB   r    r   r!   r"   rp   rp      s:    <"+ 1 8	
 = &r!   rp   c                     SR                  U R                  U R                  45      nU$ ! [         a    [	        U SS 5      nUc  [        U 5      n U$ f = f)N.r   )joinr   r   AttributeErrorgetattrrepr)r]   cls_names     r"   r?   r?      s]    !88S^^S\\:;
 O	  !3
D1CyHO	!s   '+ %AAr7   c                    [         R                  R                  n UR                  U 5      R                  n[        U 5      nU(       d  SU S3$ g ! [
        [        4[        -    a    0 n N4f = f)Nr9   r:   )	r   r;   r<   manager_of_classmappersr@   	TypeErrorNO_STATEr?   )r]   rF   r   rG   s       r"   r\   r\      sw    >>""D'',44 #Do.. 	 	  	s   A A,+A,N)r]   rz   rV   str)r]   rz   rV   rT   ),r   
__future__r   typingr   r   r   r   r   r	   r   r    r   rf   r   r   
interfacesr   r   rh   r   r   r~   KeyErrorr   SQLAlchemyErrorr   ConcurrentModificationErrorr$   ArgumentErrorr'   rg   r*   r-   r0   r5   r@   rb   rm   rp   r?   rX   r\   r   r!   r"   <module>r      s@   ! "        0   & **$TH% LV++ 2 - ;'' ;F00 JF.. Jf44 F22 4M 4<	4 	4!433 !4H@&44 @f88 B *+ ,r!   