a
    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eeeed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ee eee ef dddZee eee dddZ eeef eee ef dddZ!ee eeeef d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 d S )Nz# object does not support mutation. )	TypeErrortype__name___help_mutation)r   r   r    r   L/var/www/auris/lib/python3.9/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edddZeee eeedf  f d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edddZeee eeeeef df  f d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   )dr   c                 C   s   t | S r"   )r
   r>   r   r   r   _immutable_list_flattenW   s    r@   )valuescontextr   c                 C   s   t t| |S r"   )r   r   rA   rB   r   r   r   _immutable_list_unflatten[   s    rD   c                 C   s   t | S r"   )r   r?   r   r   r   _immutable_dict_flattenb   s    rE   c                 C   s   t t| |S r"   )r   r	   rC   r   r   r   _immutable_dict_unflattenf   s    rF   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@   rD   rE   rF   r   r   r   r   <module>   sL   (	 $
