o
    h                     @   s  d dl mZ d dlmZmZmZ d dlmZ d dlm	Z	m
Z
mZmZmZmZmZmZ ddlmZ ddgZd	 Zed
ZedZedZdedededefddZeddG dd dee ZeddG dd deeef Zdee deee ef fddZdee dedee fddZ deeef deee ef fddZ!dee dedeeef fd d!Z"eeee d"ed# eee!e"d$e
d# d%S )&    )Iterable)AnyNoReturnTypeVar)Self)_dict_flatten_dict_flatten_with_keys_dict_unflatten_list_flatten_list_flatten_with_keys_list_unflattenContextregister_pytree_node   )compatibilityimmutable_listimmutable_dictz
If you are attempting to modify the kwargs or args of a torch.fx.Node object,
instead create a new copy of it and assign the copy to the node:

    new_args = ...  # copy and mutate args
    node.args = new_args
_T_KT_VTselfargskwargsreturnc                 O   s   t t| jdt )Nz# object does not support mutation. )	TypeErrortype__name___help_mutation)r   r   r    r   r/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/torch/fx/immutable_collections.py_no_mutation$   s   r    T)is_backward_compatiblec                   @   st   e Zd ZdZeZeZeZeZeZ	eZ
eZeZeZeZeZeZdefddZdeee eeedf  f fddZdS )	r   z&An immutable version of :class:`list`.r   c                 C   s   t t| S N)hashtupler   r   r   r   __hash__;   s   zimmutable_list.__hash__.c                 C   s   t | t| ffS r"   )r   r$   r%   r   r   r   
__reduce__>   s   zimmutable_list.__reduce__N)r   
__module____qualname____doc__r    __delitem____iadd____imul____setitem__appendclearextendinsertpopremovereversesortintr&   r$   r   r   r   r'   r   r   r   r   r   *   s     *c                   @   sl   e Zd ZdZeZeZeZeZeZ	eZ
eZeZdefddZdeee eeeeef df  f fddZdS )	r   z&An immutable version of :class:`dict`.r   c                 C   s   t t|  S r"   )r#   	frozensetitemsr%   r   r   r   r&   O   s   zimmutable_dict.__hash__.c                 C   s   t | t|  ffS r"   )r   r$   r9   r%   r   r   r   r'   R   s   zimmutable_dict.__reduce__N)r   r(   r)   r*   r    r+   __ior__r.   r0   r3   popitem
setdefaultupdater7   r&   r$   r   r   r   r   r'   r   r   r   r   r   B   s    2dc                 C      t | S r"   )r
   r>   r   r   r   _immutable_list_flattenW      rA   valuescontextc                 C      t t| |S r"   )r   r   rC   rD   r   r   r   _immutable_list_unflatten[      rG   c                 C   r?   r"   )r   r@   r   r   r   _immutable_dict_flattenb   rB   rI   c                 C   rE   r"   )r   r	   rF   r   r   r   _immutable_dict_unflattenf   rH   rJ   z-torch.fx.immutable_collections.immutable_list)serialized_type_nameflatten_with_keys_fnz-torch.fx.immutable_collections.immutable_dictN)#collections.abcr   typingr   r   r   typing_extensionsr   torch.utils._pytreer   r   r	   r
   r   r   r   r   _compatibilityr   __all__stripr   r   r   r   r    listr   dictr   r$   rA   rG   rI   rJ   r   r   r   r   <module>   s^    (	"
&


