o
    E6d                     @  sj   d dl mZ d dlZddlmZ ddlmZ e	 Z
G dd dZe	 ZG dd	 d	ZG d
d deeZdS )    )annotationsN   )exc)WriteOnlyCollectionc                   @     e Zd Zdd Zdd ZdS )BasicEntityc                 K  s"   |  D ]
\}}t| || qd S N)itemssetattr)selfkwkeyvalue r   rC:\Users\jesus\OneDrive\Desktop\erpjis_fastapi\backend\jisbackend\Lib\site-packages\sqlalchemy/testing/entities.py__init__   s   zBasicEntity.__init__c              
     st   t  tv rt S tt   zd jjd fddt j	
 D f W tt   S tt   w )Nz%s(%s)z, c                   s(   g | ]}| d sd|t |f qS )_z%s=%r)
startswithgetattr).0r   r   r   r   
<listcomp>    s    z(BasicEntity.__repr__.<locals>.<listcomp>)id_repr_stackobject__repr__add	__class____name__joinsorted__dict__keysremover   r   r   r   r      s   

 zBasicEntity.__repr__N)r   
__module____qualname__r   r   r   r   r   r   r      s    r   c                   @  r   )ComparableMixinc                 C  s   |  | S r   )__eq__)r   otherr   r   r   __ne__/   s   zComparableMixin.__ne__c              
   C  s  || u rdS | j |j ksdS t| tv rdS tt|  zz
tjj| j}W n tjj	j
y6   d}Y nw |du r@| }|}n|durI|}| }n| }|}t|jD ]}|drZqRt||}t|treqRzt||}W n ttjfy   Y  W tt|  dS w t|drt|tst|drt|dst|t|kr W tt|  dS qRt|t|kr W tt|  dS qR|dur||kr W tt|  dS qRW tt|  dS tt|  w )z'Deep, sparse compare.

        Deeply compare two entities, following the non-None attributes of the
        non-persisted object, if possible.

        TFNr   __iter____getitem__r"   )r   r   _recursion_stackr   saZorm
attributesZinstance_stater   r   ZNO_STATElistr!   r   r   
isinstancer   AttributeErrorsa_excZUnboundExecutionErrorr#   hasattrstrset)r   r(   Zself_keyabattrr   Zbattrr   r   r   r'   2   sf   


	"zComparableMixin.__eq__N)r   r$   r%   r)   r'   r   r   r   r   r&   .   s    r&   c                   @  s   e Zd Zdd ZdS )ComparableEntityc                 C  s
   t | jS r   )hashr   r   r   r   r   __hash__t   s   
zComparableEntity.__hash__N)r   r$   r%   r;   r   r   r   r   r9   s   s    r9   )
__future__r   Z
sqlalchemyr-    r   r2   Zorm.writeonlyr   r5   r   r   r,   r&   r9   r   r   r   r   <module>   s   	E