o
    qoiU                     @   s   d dl Z d dlZd dlmZmZ d dlmZmZ dZe	de
e dZe	de	dd	Zd
edefddZdededefddZdS )    N)AnyUnion)is_dict_annotationis_list_annotationz\()[]{}:=, 	[z]+z(\\)+'z(\\)+")'"sreturnc                 C   sn   t | }|s	| S td|}z|d W n	 ty    Y nw | dd} |D ]}| |d| } q)| S )z Escape special characters in `s` \z\\)
_ESC_REGEXfindallsetjoinremoveKeyErrorreplace)r	   matchesall_specialspecial_char r   Q/home/ubuntu/.local/lib/python3.10/site-packages/hydra/_internal/grammar/utils.pyescape_special_characters   s   
r   valuetype_c                 C   s   t |dr0|jtu r0t|j}t|D ]\}}t|rt}nt|r$t}|||< qt	| t
|S ttttf}||v r@t| |u S |ttjjfv rJdS t	| |S )N
__origin__T)hasattrr   r   list__args__	enumerater   dictr   
isinstancetupleintfloatboolstrtyper   inspect	Signatureempty)r   r   typesidxt
primitivesr   r   r   is_type_matching+   s   


r0   )r)   retypingr   r   omegaconf._utilsr   r   _ESCcompileescaper   _ESC_QUOTED_STRr'   r   r&   r0   r   r   r   r   <module>   s   