
    ؄_                        d Z ddlmZ ddlm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          Z G d d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d Z ej        d          d             ZdS ) zSQLAlchemy ORM exceptions.   )exc)utilc                       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__     W/var/www/book.euthymeo.com/html/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 )UnmappedErrorz?Base for exceptions that involve expected mappings not present.Nr   r   r   r   r   r   1   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   5   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   <   s        ) ) DDDr   r   c                   L    e Zd ZdZ ej        d          dd            Zd ZdS )UnmappedInstanceErrorz;An mapping operation was requested for an unknown instance.sqlalchemy.orm.baseNc                 ~   |s	 |                     t          |                     t          t          |                    }d|d|d}nV# t          $ rI t	          t          |                    }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.z;; was a class (%s) supplied where an instance was required?)class_mappertype_safe_cls_nameUnmappedClassError_default_unmapped
isinstancer   __init__)selfbaseobjmsgnames        r   r#   zUnmappedInstanceError.__init__F   s     	!!$s)),,,%d3ii00
 &*TT4441  &   'S		22c4(( $&4S&9&9:C 	tS)))))s   AA ABBc                 .    | j         d | j        d         ffS N    	__class__argsr$   s    r   
__reduce__z UnmappedInstanceError.__reduce__[       ~dil333r   Nr   r	   r
   r   r   dependenciesr#   r0   r   r   r   r   r   C   sV        EET,--* * * .-*(4 4 4 4 4r   r   c                        e Zd ZdZddZd ZdS )r    z8An mapping operation was requested for an unknown class.Nc                 ^    |st          |          }t                              | |           d S r2   )r!   r   r#   )r$   clsr'   s      r   r#   zUnmappedClassError.__init__b   s3     	)#C((CtS)))))r   c                 .    | j         d | j        d         ffS r*   r,   r/   s    r   r0   zUnmappedClassError.__reduce__g   r1   r   r2   )r   r	   r
   r   r#   r0   r   r   r   r    r    _   s=        BB* * * *
4 4 4 4 4r   r    c                   L    e Zd ZdZ ej        d          dd            Z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   Nc                 z    |sd|                     |          z  }t          j                            | |           d S )NzDInstance '%s' has been deleted, or its row is otherwise not present.)	state_strsa_excInvalidRequestErrorr#   )r$   r%   stater'   s       r   r#   zObjectDeletedError.__init__   sJ     	026..2G2GH 
 	"++D#66666r   c                 .    | j         d | j        d         ffS r*   r,   r/   s    r   r0   zObjectDeletedError.__reduce__   r1   r   r2   r3   r   r   r   r:   r:   k   s\         & T,--7 7 7 .-74 4 4 4 4r   r:   c                       e Zd ZdZdS )UnmappedColumnErrorz5Mapping operation was requested on an unknown column.Nr   r   r   r   rB   rB      s        ????r   rB   c                       e Zd ZdZdS )NoResultFoundz2A database result was required but none was found.Nr   r   r   r   rD   rD      s        <<<<r   rD   c                       e Zd ZdZdS )MultipleResultsFoundzCA single database result was required but more than one were found.Nr   r   r   r   rF   rF      s        MMMMr   rF   c                       e Zd ZdZd ZdS )LoaderStrategyExceptionz2A loader strategy for an attribute does not exist.c                     |(t           j                            | d|d|           d S t           j                            | dt          j        |          d|dt          j        |          dt          j        |          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".)r=   r>   r#   r   clsname_as_plain_name)r$   applied_to_property_typerequesting_property
applies_toactual_strategy_typestrategy_keys         r   r#   z LoaderStrategyException.__init__   s      '&//<<!4!46     &//
 ./CDDDD'''./GHHHH.z::::    r   N)r   r	   r
   r   r#   r   r   r   rH   rH      s)        <<    r   rH   c                     	 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)r7   cls_names     r   r   r      si    !88S^S\:;; ! ! !3
D11CyyH! Os   !$ ,AAr   c                     	 |                      |          j        }n# t          $ r i }Y nt          $ r i }Y nw xY wt	          |          }|sd|z  S d S )NzClass '%s' is not mapped)manager_of_classmappersNO_STATE	TypeErrorr   )r%   r7   rY   r(   s       r   r!   r!      s    '',,4      #D 1)D001 1s    999N)r    r   r=   r   rS   KeyErrorrZ   SQLAlchemyErrorr   ConcurrentModificationErrorr   r>   r   r   r   r   r    r:   rB   rD   rF   rH   r   r4   r!   r   r   r   <module>r`      s   !               H% L    V+   2 - ; ; ; ; ;' ; ; ;J J J J JF. J J J    f4       F2   4 4 4 4 4M 4 4 48	4 	4 	4 	4 	4 	4 	4 	44 4 4 4 43 4 4 4D@ @ @ @ @&4 @ @ @= = = = =F. = = =N N N N N65 N N N    f8   @   ())
1 
1 *)
1 
1 
1r   