a
    8g                     @  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                   @  s   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   x/var/www/vosh/data/www/fastworkle.ru/webshop-tgbot-v.1.0/venv/lib/python3.9/site-packages/sqlalchemy/testing/entities.py__init__   s    zBasicEntity.__init__c              
     sx   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   0 d S )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                   @  s   e Zd Zdd Zdd ZdS )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
yn   d}Y n0 |du r| }|}n|dur|}| }n| }|}t|jD ]}|drqt||}t|trqzt||}W n. ttjfy
   Y  W tt|  dS 0 t|drt|tst|drft|dsft|t|kr W tt|  dS n(t|t|kr W tt|  dS q|dur||kr W tt|  dS qW tt|  dS tt|  0 dS )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   sh    



	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   r8   s   s   r8   )
__future__r   Z
sqlalchemyr,    r   r1   Zorm.writeonlyr   r4   r   r   r+   r%   r8   r   r   r   r   <module>
   s   E