HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/__pycache__/exc.cpython-310.pyc
o

���g��@s�dZddlmZddlmZddlmZddlmZddlmZddlmZddlm	Z	d	d
l
mZddlm
Zdd
lm
Z
ddl
mZddl
mZer^d	dlmZd	dlmZd	dlmZe	ded�ZeefZ	Gdd�dej�ZeZGdd�dej�ZGdd�dej�ZGdd�dej�Z Gdd�dej�Z!Gdd �d e�Z"Gd!d"�d"e�Z#Gd#d$�d$ej�Z$Gd%d&�d&ej�Z%Gd'd(�d(ej�Z&d4d-d.�Z'e
�(d/�d5d1d2��Z)d3S)6zSQLAlchemy ORM exceptions.�)�annotations)�Any)�Optional)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar�)�_mapper_property_as_plain_name�)�exc)�util)�MultipleResultsFound)�
NoResultFound)�LoaderStrategy)�MapperProperty)�
InstanceState�_T)�boundc@�eZdZdZdS)�StaleDataErroraaAn 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__�rr�=/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/exc.pyr$�rc@r)�
FlushErrorz0A invalid condition was detected during flush().Nrrrrrr@rrc@r)�
UnmappedErrorz?Base for exceptions that involve expected mappings not present.Nrrrrrr Drr c@r)�ObjectDereferencedErrorzPAn operation cannot complete due to an object being garbage
    collected.

    Nrrrrrr!Hrr!c@seZdZdZdZdS)�DetachedInstanceErrorzSAn attempt to access unloaded attributes on a
    mapped instance that is detached.�bhk3N)rrrr�coderrrrr"Osr"c@�0eZdZdZe�d�dddd	��Zddd
�ZdS)�UnmappedInstanceErrorz;An mapping operation was requested for an unknown instance.�sqlalchemy.orm.baseN�obj�object�msg�
Optional[str]cCs�tjj}|s<z|�t|��tt|��}d||f}Wn ty;dtt|���d�}t|t�r9|dt|�7}Ynwt�	||�dS)Nz�Class %r is mapped, but this instance lacks instrumentation.  This occurs when the instance is created before sqlalchemy.orm.mapper(%s) 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(r*�base�namerrrr5Ys(��
����zUnmappedInstanceError.__init__�returnrcC�|jd|jdffS�Nr��	__class__�args�r6rrr�
__reduce__p�z UnmappedInstanceError.__reduce__�N)r(r)r*r+�r9r�rrrrr
�preload_moduler5r@rrrrr&Vs
r&c@s&eZdZdZd
ddd�Zddd�ZdS)r3z8An mapping operation was requested for an unknown class.N�cls�Type[_T]r*r+cCs|st|�}t�||�dSrB)�_default_unmappedr r5)r6rFr*rrrr5wszUnmappedClassError.__init__r9rcCr:r;r<r?rrrr@|rAzUnmappedClassError.__reduce__rB)rFrGr*r+rC)rrrrr5r@rrrrr3tsr3c@r%)�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]r*r+cCs,tjj}|s
d|�|�}tj�||�dS)NzDInstance '%s' has been deleted, or its row is otherwise not present.)r
r.r/�	state_str�sa_exc�InvalidRequestErrorr5)r6rJr*r7rrrr5�s��zObjectDeletedError.__init__r9rcCr:r;r<r?rrrr@�rAzObjectDeletedError.__reduce__rB)rJrKr*r+rCrDrrrrrI�s
rIc@r)�UnmappedColumnErrorz5Mapping operation was requested on an unknown column.NrrrrrrO�rrOc@seZdZdZddd
�ZdS)�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	CsZ|durtj�|d||f�dS|dusJ�tj�|dt�|�|t|�t|�f�dS)NzCan't find strategy %s for %szuCan't apply "%s" strategy to property "%s", which is a "%s"; this loader strategy is intended to be used with a "%s".)rMrNr5r
�clsname_as_plain_namer
)r6rQrSrUrWrYrrrr5�s$�����z LoaderStrategyException.__init__N)
rQrRrSrTrUrVrWrXrYrZ)rrrrr5rrrrrP�srPrFrRr9�strcCsPzd�|j|jf�}W|Sty't|dd�}|dur$t|�}Y|SY|Sw)N�.r)�joinrr�AttributeError�getattr�repr)rF�cls_namerrrr2�s�
��r2r'r+c	CsTtjj}z|�|�j}Wnttftyi}Ynwt|�}|s(d|�d�SdS)Nr,r-)	r
r.r/�manager_of_class�mappersr3�	TypeError�NO_STATEr2)rFr7rdr8rrrrH�s�
��rHN)rFrRr9r\)rFrRr9r+)*r�
__future__r�typingrrrrrrr
r
�rrMrr�
interfacesrrrJrrr_�KeyErrorrf�SQLAlchemyErrorr�ConcurrentModificationErrorrrNr r!r"r&r3rIrOrPr2rErHrrrr�<module>sD$
!