L idZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z d d l m Z d d l m Zd d l m Z d dl mZd dl mZerd dlmZd dlmZd dlmZe deZeefZ Gddej4ZeZGddej4ZGddej<ZGddej@Z!Gddej4Z"Gdd ej4Z#Gd!d"e!Z$Gd#d$e!Z%Gd%d&ej@Z&Gd'd(ej@Z'Gd)d*ej@Z(d/d+Z)e jTd,d0d-Z+y.)1zSQLAlchemy ORM exceptions.) annotations)Any)Optional)Tuple)Type) TYPE_CHECKING)TypeVar)_mapper_property_as_plain_name)exc)util)MultipleResultsFound) NoResultFound)LoaderStrategy)MapperProperty) InstanceState_T)boundceZdZdZy)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__X/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sqlalchemy/orm/exc.pyrr$srrceZdZdZy) FlushErrorz0A invalid condition was detected during flush().Nrrrrr!r!@s:rr!ceZdZdZy)MappedAnnotationErrorzRaised when ORM annotated declarative cannot interpret the expression present inside of the :class:`.Mapped` construct. .. versionadded:: 2.0.40 Nrrrrr#r#Dsrr#ceZdZdZy) UnmappedErrorz?Base for exceptions that involve expected mappings not present.Nrrrrr%r%MsIrr%ceZdZdZy)ObjectDereferencedErrorzPAn operation cannot complete due to an object being garbage collected. Nrrrrr'r'Qsrr'ceZdZdZdZy)DetachedInstanceErrorzSAn attempt to access unloaded attributes on a mapped instance that is detached.bhk3N)rrrrcoderrrr)r)Xs) Drr)cLeZdZdZej ddddZddZy) UnmappedInstanceErrorz;An mapping operation was requested for an unknown instance.sqlalchemy.orm.baseNchtjj}|s8 |jt |t t |}d|d|d}tj||y#t $r<dt t |d}t|tr|dt |zz }Y[wxYw)NzClass 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 preloadedorm_base class_mappertype_safe_cls_nameUnmappedClassError isinstancer%__init__)selfobjmsgbasenames rr9zUnmappedInstanceError.__init__bs~~&& !!$s),%d3i0 &*41 tS)& tCy 9:/Jc4($&4S&9:C s7A,,AB10B1c<|jd|jdffSNr __class__argsr:s r __reduce__z UnmappedInstanceError.__reduce__y~~diil333rN)r;objectr< Optional[str]returnrrrrrrpreload_moduler9rErrrr-r-_s*ET./*0*,4rr-c"eZdZdZdddZddZy)r7z8An mapping operation was requested for an unknown class.NcJ|s t|}tj||yrG)_default_unmappedr%r9)r:clsr<s rr9zUnmappedClassError.__init__s#C(CtS)rc<|jd|jdffSr@rArDs rrEzUnmappedClassError.__reduce__rFrrG)rQzType[_T]r<rIrJ)rrrrr9rErrrr7r7}sB* 4rr7cLeZdZdZej ddddZddZy) ObjectDeletedErroraA 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.Nctjj}|sd|j|z}tj j ||y)NzDInstance '%s' has been deleted, or its row is otherwise not present.)rr2r3 state_strsa_excInvalidRequestErrorr9)r:stater<r=s rr9zObjectDeletedError.__init__sH~~&&026..2GH  ""++D#6rc<|jd|jdffSr@rArDs rrEzObjectDeletedError.__reduce__rFrrG)rYzInstanceState[Any]r<rIrJrLrrrrTrTs.&T./ 70 74rrTceZdZdZy)UnmappedColumnErrorz5Mapping operation was requested on an unknown column.Nrrrrr\r\s?rr\c,eZdZdZ ddZy)LoaderStrategyExceptionz2A loader strategy for an attribute does not exist.c |'tjj|d|d|y|Jtjj|dtj|d|dt |dt |d y)NzCan'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".)rWrXr9rclsname_as_plain_namer )r:applied_to_property_typerequesting_property applies_toactual_strategy_type strategy_keys rr9z LoaderStrategyException.__init__s{ '  & & / /!46  ) ))  & & / / ../CD'23KL2:> rN) ra Type[Any]rbzMapperProperty[Any]rcz#Optional[Type[MapperProperty[Any]]]rdzOptional[Type[LoaderStrategy]]rezTuple[Any, ...])rrrrr9rrrr^r^s:<"+18  =  & rr^c dj|j|jf}|S#t$rt |dd}| t |}Y|SwxYw)N.r)joinrrAttributeErrorgetattrrepr)rQcls_names rr6r6s]!88S^^S\\:; O !3 D1  CyH O !s'+#AAr.ctjj} |j|j}t|}|sd|dSy#t t ftz$ri}Y.wxYw)Nr0r1) rr2r3manager_of_classmappersr7 TypeErrorNO_STATEr6)rQr=rpr>s rrPrPsw >> " "D'',44 # D o..     sA A&%A&N)rQrfrKstr)rQrfrKrI),r __future__rtypingrrrrrr rr r rWrr interfacesrrrYrrrjKeyErrorrrSQLAlchemyErrorrConcurrentModificationErrorr! ArgumentErrorr#rXr%r'r)r-r7rTr\r^r6rMrPrrrr|sB!" 0&**$ T H %LV++2-;'';F00JF..Jf44F224M4< 4 4!433!4H@&44@f88B*+,r