o
     ªZh}  ã                   @  sª   d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ ddlmZ ej	r1d	d
l
mZ G dd„ deeef ƒZG dd„ deeedf eed ef f ƒZdS )é    )ÚannotationsN)ÚAny)ÚDict)ÚTuple)ÚUnioné   )ÚLiteralé   )Ú
CacheConstc                   @  s   e Zd ZdZddd„ZdS )	Úprefix_anon_mapaf  A map that creates new keys for missing key access.

    Considers keys of the form "<ident> <name>" to produce
    new symbols "<name>_<index>", where "index" is an incrementing integer
    corresponding to <name>.

    Inlines the approach taken by :class:`sqlalchemy.util.PopulateDict` which
    is otherwise usually used for this type of operation.

    ÚkeyÚstrÚreturnc                 C  sB   |  dd¡\}}|  |d¡}|d | |< |› d|› }|| |< |S )Nú r	   Ú_)ÚsplitÚget)Úselfr   ÚidentZderivedZanonymous_counterÚvalue© r   úN/var/www/html/lang_env/lib/python3.10/site-packages/sqlalchemy/sql/_py_util.pyÚ__missing__"   s   zprefix_anon_map.__missing__N)r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r      s    r   c                   @  s(   e Zd ZdZdZddd„Zddd„ZdS )Úcache_anon_mapaU  A map that creates new keys for missing key access.

    Produces an incrementing sequence given a series of unique keys.

    This is similar to the compiler prefix_anon_map class although simpler.

    Inlines the approach taken by :class:`sqlalchemy.util.PopulateDict` which
    is otherwise usually used for this type of operation.

    r   Úobject_r   r   úTuple[str, bool]c                 C  sT   t |ƒ}|| v r| | }|dusJ ‚|dfS t| jƒ | |< }|  jd7  _|dfS )NTr	   F)Úidr   Ú_index)r   r   ZidselfZs_valZid_r   r   r   Úget_anon;   s   zcache_anon_map.get_anonr   Úintr   c                 C  s$   t | jƒ | |< }|  jd7  _|S )Nr	   )r   r!   )r   r   Úvalr   r   r   r   H   s   zcache_anon_map.__missing__N)r   r   r   r   )r   r#   r   r   )r   r   r   r   r!   r"   r   r   r   r   r   r   +   s
    
r   zLiteral[CacheConst.NO_CACHE]T)Ú
__future__r   Útypingr   r   r   r   Zutil.typingr   ÚTYPE_CHECKINGÚ	cache_keyr
   r   r   r#   r   r   r   r   r   Ú<module>   s   
ÿ