zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
U
¸ý°dŸã@s¦dZddlmZddlmZddlmZddlmZddlmZddlmZddlm    Z    d    d
l
m Z d    d l
m Z d    d l mZd    d l mZer°ddlmZddlmZddlmZe    dedZeefZGdd„de jƒZeZGdd„de jƒZGdd„de jƒZGdd„de jƒZGdd„de jƒZ Gdd„deƒZ!Gd d!„d!eƒZ"Gd"d#„d#e jƒZ#Gd$d%„d%e jƒZ$Gd&d'„d'e jƒZ%d(d)d*œd+d,„Z&e  'd-¡d(d.d*œd/d0„ƒZ(d1S)2zSQLAlchemy ORM exceptions.é)Ú annotations)ÚAny)ÚOptional)ÚTuple)ÚType)Ú TYPE_CHECKING)ÚTypeVaré)Úexc)Úutil)ÚMultipleResultsFound)Ú NoResultFoundé)ÚLoaderStrategy)ÚMapperProperty)Ú InstanceStateÚ_T)Úboundc@seZdZdZdS)Ú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úId:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/orm/exc.pyr#src@seZdZdZdS)Ú
FlushErrorz0A invalid condition was detected during flush().Nrrrrrr?src@seZdZdZdS)Ú UnmappedErrorz?Base for exceptions that involve expected mappings not present.NrrrrrrCsrc@seZdZdZdS)ÚObjectDereferencedErrorzPAn operation cannot complete due to an object being garbage
    collected.
 
    NrrrrrrGsrc@seZdZdZdZdS)ÚDetachedInstanceErrorzSAn attempt to access unloaded attributes on a
    mapped instance that is detached.Zbhk3N)rrrrÚcoderrrrrNsrc@s:eZdZdZe d¡d dddœdd„ƒZd    d
œd d „ZdS)ÚUnmappedInstanceErrorz;An mapping operation was requested for an unknown instance.úsqlalchemy.orm.baseNÚobjectú Optional[str])ÚobjÚmsgcCsŠtjj}|szz*| t|ƒ¡tt|ƒƒ}d||f}WnBtk
rxdtt|ƒƒ›d}t|tƒrt|dt|ƒ7}YnXt     ||¡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_baseZ class_mapperÚtypeÚ_safe_cls_nameÚUnmappedClassErrorÚ
isinstancerÚ__init__)Úselfr%r&ÚbaseÚnamerrrr/Xs$ ýÿ
ÿÿ
zUnmappedInstanceError.__init__r©ÚreturncCs|jd|jdffS©Nr©Ú    __class__Úargs©r0rrrÚ
__reduce__osz UnmappedInstanceError.__reduce__)N©rrrrr Úpreload_moduler/r:rrrrr!Usr!c@s0eZdZdZd dddœdd„Zdd    œd
d „ZdS) r-z8An mapping operation was requested for an unknown class.NzType[_T]r$)Úclsr&cCs|s t|ƒ}t ||¡dS)N)Ú_default_unmappedrr/)r0r=r&rrrr/vszUnmappedClassError.__init__rr3cCs|jd|jdffSr5r6r9rrrr:{szUnmappedClassError.__reduce__)N)rrrrr/r:rrrrr-ssr-c@s:eZdZdZe d¡d dddœdd„ƒZd    d
œd d „ZdS)Ú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"NzInstanceState[Any]r$)Ústater&cCs,tjj}|sd| |¡}tj ||¡dS)NzDInstance '%s' has been deleted, or its row is otherwise not present.)r r)r*Z    state_strÚsa_excÚInvalidRequestErrorr/)r0r@r&r1rrrr/“sÿÿzObjectDeletedError.__init__rr3cCs|jd|jdffSr5r6r9rrrr:ŸszObjectDeletedError.__reduce__)Nr;rrrrr?s r?c@seZdZdZdS)ÚUnmappedColumnErrorz5Mapping operation was requested on an unknown column.NrrrrrrC£srCc@s&eZdZdZddddddœdd    „Zd
S) ÚLoaderStrategyExceptionz2A loader strategy for an attribute does not exist.ú    Type[Any]zMapperProperty[Any]z#Optional[Type[MapperProperty[Any]]]zOptional[Type[LoaderStrategy]]zTuple[Any, ...])Úapplied_to_property_typeÚrequesting_propertyÚ
applies_toÚactual_strategy_typeÚ strategy_keyc
Cs\|dkr tj |d||f¡n8|dk    s,t‚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".)rArBr/ÚAssertionErrorr Zclsname_as_plain_name)r0rFrGrHrIrJrrrr/ªs$ÿþ üýþz LoaderStrategyException.__init__N)rrrrr/rrrrrD§srDrEÚstr)r=r4cCsLzd |j|jf¡}Wn0tk
rFt|ddƒ}|dkrBt|ƒ}YnX|S)NÚ.r)ÚjoinrrÚAttributeErrorÚgetattrÚrepr)r=Zcls_namerrrr,Ès r,r"r$c    CsZtjj}z| |¡j}Wn ttftk
r8i}YnXt|ƒ}|sRd|›dSdSdS)Nr'r()    r r)r*Zmanager_of_classÚmappersr-Ú    TypeErrorÚNO_STATEr,)r=r1rRr2rrrr>Ósþý 
 r>N))rÚ
__future__rÚtypingrrrrrrÚr
rAr r r Z
interfacesrrr@rrrOÚKeyErrorrTZSQLAlchemyErrorrZConcurrentModificationErrorrrBrrrr!r-r?rCrDr,r<r>rrrrÚ<module>s>                $!