o
    `Û·i2  ã                
   @   sl   d Z ddlmZ ddlmZmZ ddlmZ eƒ Z	ede
defdd„ƒZedde
d
ededefdd„ƒZd	S )z.Registry of connector names for global access.é    )ÚAny)Ú	ConnectorÚConnectorContext)ÚOldAPIStackÚnameÚclsc                 C   s,   | t v rdS t|tƒstd|ƒ‚|t | < dS )zƒRegister a connector for use with RLlib.

    Args:
        name: Name to register.
        cls: Callable that creates an env.
    Nz!Can only register Connector type.)ÚALL_CONNECTORSÚ
issubclassr   Ú	TypeError)r   r   © r   úS/home/ubuntu/vllm_env/lib/python3.10/site-packages/ray/rllib/connectors/registry.pyÚregister_connector
   s
   

r   NÚctxÚparamsÚreturnc                 C   s"   | t vr	td| ƒ‚t |   ||¡S )zìGet a connector by its name and serialized config.

    Args:
        name: name of the connector.
        ctx: Connector context.
        params: serialized parameters of the connector.

    Returns:
        Constructed connector.
    zconnector not found.)r   Ú	NameErrorÚ
from_state)r   r   r   r   r   r   Úget_connector   s   
r   )N)Ú__doc__Útypingr   Úray.rllib.connectors.connectorr   r   Úray.rllib.utils.annotationsr   Údictr   Ústrr   r   r   r   r   r   Ú<module>   s    "