
    sg                     F    d dl Z d dlZd dlmZmZ dZdee   dededefdZy)	    N)CallableListzMUsage of '{old_location}' is deprecated; please use '{new_location}' instead.all
old_module
new_modulereturnc                 H     t         j                  |       fd}|S )a@  Import utility to lazily import deprecated packages / modules / functional.

    The old_module and new_module are also used in the deprecation warning defined
    by the `_MESSAGE_TEMPLATE`.

    Args:
        all: The list of the functions that are imported. Generally, the module's
            __all__ list of the module.
        old_module: Old module location
        new_module: New module location / Migrated location

    Returns:
        Callable to assign to the `__getattr__`

    Usage:

        # In the `torch/nn/quantized/functional.py`
        from torch.nn.utils._deprecation_utils import lazy_deprecated_import
        _MIGRATED_TO = "torch.ao.nn.quantized.functional"
        __getattr__ = lazy_deprecated_import(
            all=__all__,
            old_module=__name__,
            new_module=_MIGRATED_TO)
    )old_locationnew_locationc                     | v r;t        j                  t               t        j                        }t        ||       S t        dd| d      )NzModule z has no attribute .)warningswarnRuntimeWarning	importlibimport_modulegetattrAttributeError)namepackager   r   warning_messages     T/var/www/html/venv/lib/python3.12/site-packages/torch/nn/utils/_deprecation_utils.pygetattr_dunderz.lazy_deprecated_import.<locals>.getattr_dunder-   sR    3; MM/>:--j9G7D))wzn4FthaPQQ    )_MESSAGE_TEMPLATEformat)r   r   r   r   r   s   ` ` @r   lazy_deprecated_importr      s-    : (..j / OR r   )r   r   typingr   r   r   strr    r   r   <module>r!      sF      ! U 
*	c** * 	*r   