o
    h}                     @  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   identderivedanonymous_countervalue r   k/var/www/html/construction_image-detection-poc/venv/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    idselfs_val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   util.typingr   TYPE_CHECKING	cache_keyr
   r   r   r(   r   r   r   r   r   <module>   s   
