§
    ÿYj  ã                  óB   — d Z ddlmZ ddlmZ ddlmZ ddlmZ dd„Z	dS )zPeer-related utility functions.é    )Úannotations)ÚAnyé   )ÚSessionPeerConfig)ÚPeerBaseÚpeersúÝstr | PeerBase | tuple[str, SessionPeerConfig] | tuple[PeerBase, SessionPeerConfig] | list[PeerBase | str] | list[tuple[PeerBase | str, SessionPeerConfig]] | list[PeerBase | str | tuple[PeerBase | str, SessionPeerConfig]]Úreturnúdict[str, Any]c                óX  — t          | t          ¦  «        s| g} i }| D ]Œ}t          |t          ¦  «        rRt          |d         t          ¦  «        r|d         n|d         j        }|d         }|                     d¬¦  «        ||<   Œit          |t          ¦  «        r|n|j        }i ||<   Œ|S )aO  
    Normalize various peer input formats into a dict mapping peer IDs to configs.

    Accepts:
        - str: Single peer ID
        - PeerBase: Single Peer object
        - tuple[str, SessionPeerConfig]: Single peer ID with config
        - tuple[PeerBase, SessionPeerConfig]: Single Peer object with config
        - list[PeerBase | str]: List of peers/IDs
        - list[tuple[PeerBase | str, SessionPeerConfig]]: List of peers with configs
        - Mixed lists combining all of the above

    Returns:
        Dict mapping peer IDs to their config dicts (empty dict if no config)
    r   é   T)Úexclude_none)Ú
isinstanceÚlistÚtupleÚstrÚidÚ
model_dump)r   Ú	peer_dictÚpeerÚpeer_idÚpeer_configs        úY/home/ubuntu/.hermes/hermes-agent/venv/lib/python3.11/site-packages/honcho/utils/peers.pyÚnormalize_peers_to_dictr      s½   € õ2 eTÑ"Ô"ð Øˆà "€IØð $ð $ˆÝdEÑ"Ô"ð 	$Ý!+¨D°¬GµSÑ!9Ô!9ÐId˜1”gg¸tÀA¼w¼zˆGØ˜qœ'ˆKØ!,×!7Ò!7ÀTÐ!7Ñ!JÔ!JˆIgÑÐå(¨­sÑ3Ô3Ð@dd¸¼ˆGØ!#ˆIgÑÐàÐó    N)r   r	   r
   r   )
Ú__doc__Ú
__future__r   Útypingr   Ú	api_typesr   Úbaser   r   © r   r   ú<module>r"      sq   ðØ %Ð %à "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð à )Ð )Ð )Ð )Ð )Ð )Ø Ð Ð Ð Ð Ð ð&ð &ð &ð &ð &ð &r   