o
    Zh                     @   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   M/var/www/auris/lib/python3.10/site-packages/torch/fx/immutable_collections.py_no_mutation$   s   r    T)Z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#   r8   r$   r   r   r   r&   R   s   zimmutable_dict.__reduce__N)r   r'   r(   r)   r    r*   __ior__r-   r/   r2   popitem
setdefaultupdater6   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      r@   valuescontextc                 C      t t| |S r!   )r   r   rB   rC   r   r   r   _immutable_list_unflatten[      rF   c                 C   r>   r!   )r   r?   r   r   r   _immutable_dict_flattenb   rA   rH   c                 C   rD   r!   )r   r	   rE   r   r   r   _immutable_dict_unflattenf   rG   rI   z-torch.fx.immutable_collections.immutable_list)Zserialized_type_nameZflatten_with_keys_fnz-torch.fx.immutable_collections.immutable_dictN)#collections.abcr   typingr   r   r   Ztyping_extensionsr   Ztorch.utils._pytreer   r   r	   r
   r   r   r   r   Z_compatibilityr   __all__stripr   r   r   r   r    listr   dictr   r#   r@   rF   rH   rI   r   r   r   r   <module>   s^    (	"
&


