§
    eŠtjÔ  ã                  ó´  — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 d	d
l
mZ ddlmZ ddlm
Z
 ddlmZ ddlmZ erd	dlmZ d	dlmZ d	dlmZ  e	de¬¦  «        ZeefZ	  G d„ dej        ¦  «        ZeZ G d„ dej        ¦  «        Z G d„ dej        ¦  «        Z G d„ dej         ¦  «        Z! G d„ dej        ¦  «        Z" G d„ d ej        ¦  «        Z# G d!„ d"e!¦  «        Z$ G d#„ d$e!¦  «        Z% G d%„ d&ej         ¦  «        Z& G d'„ d(ej         ¦  «        Z' G d)„ d*ej         ¦  «        Z(d4d/„Z) e
j*        d0¦  «        d5d2„¦   «         Z+d3S )6z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                  ó   — e Zd ZdZdS )ÚStaleDataErroraa  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__Ú__doc__© ó    úP/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sqlalchemy/orm/exc.pyr   r   $   s   € € € € € ðð ð ð r   r   c                  ó   — e Zd ZdZdS )Ú
FlushErrorz0A invalid condition was detected during flush().Nr   r   r   r   r!   r!   @   s   € € € € € Ø:Ð:Ð:Ð:r   r!   c                  ó   — e Zd ZdZdS )ÚMappedAnnotationErrorzŸRaised when ORM annotated declarative cannot interpret the
    expression present inside of the :class:`.Mapped` construct.

    .. versionadded:: 2.0.40

    Nr   r   r   r   r#   r#   D   s   € € € € € ðð ð ð r   r#   c                  ó   — e Zd ZdZdS )ÚUnmappedErrorz?Base for exceptions that involve expected mappings not present.Nr   r   r   r   r%   r%   M   s   € € € € € ØIÐIÐIÐIr   r%   c                  ó   — e Zd ZdZdS )ÚObjectDereferencedErrorzPAn operation cannot complete due to an object being garbage
    collected.

    Nr   r   r   r   r'   r'   Q   s   € € € € € ðð ð ð r   r'   c                  ó   — e Zd ZdZdZdS )ÚDetachedInstanceErrorzSAn attempt to access unloaded attributes on a
    mapped instance that is detached.Úbhk3N)r   r   r   r   Úcoder   r   r   r)   r)   X   s   € € € € € ð)ð )ð €D€D€Dr   r)   c                  óP   — e Zd ZdZ ej        d¦  «        ddd„¦   «         Zdd„ZdS )ÚUnmappedInstanceErrorz;An mapping operation was requested for an unknown instance.úsqlalchemy.orm.baseNÚobjÚobjectÚmsgúOptional[str]c                ó¨  — t           j        j        }|s£	 |                     t	          |¦  «        ¦  «         t          t	          |¦  «        ¦  «        }d|›d|›d�}nZ# t          $ rM dt          t	          |¦  «        ¦  «        › d�}t          |t          ¦  «        r|dt          |¦  «        z  z  }Y nw xY wt           	                    | |¦  «         d S )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__)Úselfr/   r1   ÚbaseÚnames        r   r=   zUnmappedInstanceError.__init__b   sï   € åŒ~Ô&ˆàð 	ðØ×!Ò!¥$ s¡)¤)Ñ,Ô,Ð,Ý%¥d¨3¡i¤iÑ0Ô0��ð
 &* T T¨4¨4¨4ð1ð �øõ &ð ð ð ØJ¥­t°C©y¬yÑ 9Ô 9ÐJÐJÐJ�Ý˜c¥4Ñ(Ô(ð Øð$Ý&4°SÑ&9Ô&9ñ:ñ�Cøøðøøøõ 	×Ò˜t SÑ)Ô)Ð)Ð)Ð)s   •AA ÁAB4Â3B4Úreturnr   c                ó.   — | j         d | j        d         ffS ©Nr   ©Ú	__class__Úargs©r>   s    r   Ú
__reduce__z UnmappedInstanceError.__reduce__y   ó   € ØŒ~  d¤i°¤lÐ3Ð3Ð3r   ©N)r/   r0   r1   r2   ©rA   r   ©r   r   r   r   r   Úpreload_moduler=   rH   r   r   r   r-   r-   _   s`   € € € € € ØEÐEà€TÔÐ.Ñ/Ô/ð*ð *ð *ð *ñ 0Ô/ð*ð,4ð 4ð 4ð 4ð 4ð 4r   r-   c                  ó$   — e Zd ZdZddd„Zdd
„ZdS )r;   z8An mapping operation was requested for an unknown class.NÚclsúType[_T]r1   r2   c                ó^   — |st          |¦  «        }t                               | |¦  «         d S rJ   )Ú_default_unmappedr%   r=   )r>   rO   r1   s      r   r=   zUnmappedClassError.__init__€   s3   € Øð 	)Ý# CÑ(Ô(ˆCÝ×Ò˜t SÑ)Ô)Ð)Ð)Ð)r   rA   r   c                ó.   — | j         d | j        d         ffS rC   rD   rG   s    r   rH   zUnmappedClassError.__reduce__…   rI   r   rJ   )rO   rP   r1   r2   rK   )r   r   r   r   r=   rH   r   r   r   r;   r;   }   sG   € € € € € ØBÐBð*ð *ð *ð *ð *ð
4ð 4ð 4ð 4ð 4ð 4r   r;   c                  óP   — e Zd ZdZ ej        d¦  «        ddd„¦   «         Zdd„ZdS )ÚObjectDeletedErroraï  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.

    r.   NÚstateúInstanceState[Any]r1   r2   c                óœ   — t           j        j        }|sd|                     |¦  «        z  }t          j                             | |¦  «         d S )NzDInstance '%s' has been deleted, or its row is otherwise not present.)r   r6   r7   Ú	state_strÚsa_excÚInvalidRequestErrorr=   )r>   rV   r1   r?   s       r   r=   zObjectDeletedError.__init__�   sT   € åŒ~Ô&ˆàð 	ð0Ø26·.².ÀÑ2GÔ2GñHð õ
 	Ô"×+Ò+¨D°#Ñ6Ô6Ð6Ð6Ð6r   rA   r   c                ó.   — | j         d | j        d         ffS rC   rD   rG   s    r   rH   zObjectDeletedError.__reduce__©   rI   r   rJ   )rV   rW   r1   r2   rK   rL   r   r   r   rU   rU   ‰   sf   € € € € € ðð ð& €TÔÐ.Ñ/Ô/ð	7ð 	7ð 	7ð 	7ñ 0Ô/ð	7ð4ð 4ð 4ð 4ð 4ð 4r   rU   c                  ó   — e Zd ZdZdS )ÚUnmappedColumnErrorz5Mapping operation was requested on an unknown column.Nr   r   r   r   r^   r^   ­   s   € € € € € Ø?Ð?Ð?Ð?r   r^   c                  ó   — e Zd ZdZdd„ZdS )ÚLoaderStrategyExceptionz2A loader strategy for an attribute does not exist.Úapplied_to_property_typeú	Type[Any]Úrequesting_propertyúMapperProperty[Any]Ú
applies_toú#Optional[Type[MapperProperty[Any]]]Úactual_strategy_typeúOptional[Type[LoaderStrategy]]Ústrategy_keyúTuple[Any, ...]c                ó  — |€(t           j                             | d|›d|›�¦  «         d S |€J ‚t           j                             | dt          j        |¦  «        ›d|›dt          |¦  «        ›dt          |¦  «        ›d�	¦  «         d S )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".)rZ   r[   r=   r   Úclsname_as_plain_namer   )r>   ra   rc   re   rg   ri   s         r   r=   z LoaderStrategyException.__init__´   sÆ   € ð  Ð'ÝÔ&×/Ò/Ø�à�<�<Ð!4Ð!4ð6ñô ð ð ð ð Ð)Ð)Ð)ÝÔ&×/Ò/Ø�õ
 Ô.Ð/CÑDÔDÐDÐDØ'Ð'Ð'Ý2Ð3KÑLÔLÐLÐLÝ2°:Ñ>Ô>Ð>Ð>ðñô ð ð ð r   N)
ra   rb   rc   rd   re   rf   rg   rh   ri   rj   )r   r   r   r   r=   r   r   r   r`   r`   ±   s.   € € € € € Ø<Ð<ðð ð ð ð ð r   r`   rO   rb   rA   Ústrc                ó°   — 	 d                      | j        | j        f¦  «        }n2# t          $ r% t	          | dd ¦  «        }|€t          | ¦  «        }Y nw xY w|S )Nú.r   )Újoinr   r   ÚAttributeErrorÚgetattrÚrepr)rO   Úcls_names     r   r:   r:   Ò   si   € ð!Ø—8’8˜Sœ^¨S¬\Ð:Ñ;Ô;ˆˆøÝð !ð !ð !Ý˜3 
¨DÑ1Ô1ˆØÐÝ˜C‘y”yˆHøøð!øøøð €Os   ‚!$ ¤,AÁAr.   r2   c                óÐ   — t           j        j        }	 |                     | ¦  «        j        }n!# t
          t          ft          z   $ r i }Y nw xY wt          | ¦  «        }|sd|› d�S d S )Nr4   r5   )	r   r6   r7   Úmanager_of_classÚmappersr;   Ú	TypeErrorÚNO_STATEr:   )rO   r?   rw   r@   s       r   rR   rR   Ý   sŽ   € åŒ>Ô"€DðØ×'Ò'¨Ñ,Ô,Ô4ˆˆøåÝðõ 	ñð ð ð ð ˆˆˆð	øøøõ
 ˜#ÑÔ€Dàð Ø.˜Ð.Ð.Ð.Ð.àˆts   “. ®AÁAN)rO   rb   rA   rm   )rO   rb   rA   r2   ),r   Ú
__future__r   Útypingr   r   r   r   r   r	   r   r   Ú r   rZ   r   r   Ú
interfacesr   r   rV   r   r   rq   ÚKeyErrorry   ÚSQLAlchemyErrorr   ÚConcurrentModificationErrorr!   ÚArgumentErrorr#   r[   r%   r'   r)   r-   r;   rU   r^   r`   r:   rM   rR   r   r   r   ú<module>r‚      s”  ðð !Ð  à "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø  Ð  Ð  Ð  Ð  Ð  Ø Ð Ð Ð Ð Ð à 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &Ø Ð Ð Ð Ð Ð àð %Ø*Ð*Ð*Ð*Ð*Ð*Ø*Ð*Ð*Ð*Ð*Ð*Ø$Ð$Ð$Ð$Ð$Ð$à€WˆT˜ÐÑÔ€à˜HÐ%€Ø Lðð ð ð ð �VÔ+ñ ô ð ð2 -Ð ð;ð ;ð ;ð ;ð ;�Ô'ñ ;ô ;ð ;ðð ð ð ð ˜FÔ0ñ ô ð ðJð Jð Jð Jð J�FÔ.ñ Jô Jð Jðð ð ð ð ˜fÔ4ñ ô ð ðð ð ð ð ˜FÔ2ñ ô ð ð4ð 4ð 4ð 4ð 4˜Mñ 4ô 4ð 4ð<	4ð 	4ð 	4ð 	4ð 	4˜ñ 	4ô 	4ð 	4ð!4ð !4ð !4ð !4ð !4˜Ô3ñ !4ô !4ð !4ðH@ð @ð @ð @ð @˜&Ô4ñ @ô @ð @ðð ð ð ð ˜fÔ8ñ ô ð ðBð ð ð ð €ÔÐ*Ñ+Ô+ðð ð ñ ,Ô+ðð ð r   