
    Ǆgk                     :    d dl Z d dlmZ d dlmZ  G d de      Zy)    N)ChainMap)typesc                   6    e Zd ZdZd	dZd Zd Zd Zd Zd Z	y)
DataModelManagerzBManages mapping of FE types to their corresponding data model
    Nc                 L    |xs i | _         t        j                         | _        y)z
        Parameters
        -----------
        handlers: Mapping[Type, DataModel] or None
            Optionally provide the initial handlers mapping.
        N)	_handlersweakrefWeakKeyDictionary_cache)selfhandlerss     d/home/mcse/projects/flask_80/flask-venv/lib/python3.12/site-packages/numba/core/datamodel/manager.py__init__zDataModelManager.__init__   s     "R//1    c                 Z    t        |t        j                        sJ || j                  |<   y)zNRegister the datamodel factory corresponding to a frontend-type class
        N)
issubclassr   Typer   )r   	fetypeclshandlers      r   registerzDataModelManager.register   s&     )UZZ000$+y!r   c                     	 | j                   |   S # t        $ r Y nw xY w| j                  t        |         } || |      x}| j                   |<   |S )zMReturns the corresponding datamodel given the frontend-type instance
        )r   KeyErrorr   type)r   fetyper   models       r   lookupzDataModelManager.lookup   sY    	;;v&& 		..f.&-dF&;;F#s    	c                 $    | j                  |      S )zShorthand for lookup()
        )r   )r   r   s     r   __getitem__zDataModelManager.__getitem__(   s     {{6""r   c                 H    t        | j                  j                               S )z
        Make a copy of the manager.
        Use this to inherit from the default data model and specialize it
        for custom target.
        )r   r   copy)r   s    r   r    zDataModelManager.copy-   s       3 3 566r   c                 X    t        | j                  |j                        }t        |      S )a  Create a new DataModelManager by chaining the handlers mapping of
        `other_manager` with a fresh handlers mapping.

        Any existing and new handlers inserted to `other_manager` will be
        visible to the new manager. Any handlers inserted to the new manager
        can override existing handlers in `other_manager` without actually
        mutating `other_manager`.

        Parameters
        ----------
        other_manager: DataModelManager
        )r   r   r   )r   other_managerchaineds      r   chainzDataModelManager.chain5   s%     4>>=+B+BC((r   )N)
__name__
__module____qualname____doc__r   r   r   r   r    r$    r   r   r   r      s%    
2,	#
7)r   r   )r	   collectionsr   
numba.corer   objectr   r)   r   r   <module>r-      s       <)v <)r   