o
    ©it  ã                   @  s2   d Z ddlmZ ddlZddlmZ dd	d
„ZdS )zAuthentication utility helpers.é    )ÚannotationsN)ÚAnyÚvaluer   Úreturnúlist[str] | Nonec                 C  s¶   | du s| dkr| du rdS g S t | tƒrdd„ | D ƒS t | tƒrY|  ¡ } | s)g S |  d¡rLzt | ¡}t |tƒrAdd„ |D ƒW S W n	 tyK   Y nw dd„ |  dd	¡ 	¡ D ƒS | S )
zóParse scopes from environment variables or settings values.

    Accepts either a JSON array string, a comma- or space-separated string,
    a list of strings, or ``None``. Returns a list of scopes or ``None`` if
    no value is provided.
    NÚ c                 S  ó$   g | ]}t |ƒ ¡ rt |ƒ ¡ ‘qS © ©ÚstrÚstrip©Ú.0Úvr	   r	   ú\/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/fastmcp/utilities/auth.pyÚ
<listcomp>   ó   $ z parse_scopes.<locals>.<listcomp>ú[c                 S  r   r	   r
   r   r	   r	   r   r      r   c                 S  s   g | ]
}|  ¡ r|  ¡ ‘qS r	   )r   )r   Úsr	   r	   r   r   !   s    ú,ú )
Ú
isinstanceÚlistr   r   Ú
startswithÚjsonÚloadsÚ	ExceptionÚreplaceÚsplit)r   Údatar	   r	   r   Úparse_scopes	   s&   




ÿÿr    )r   r   r   r   )Ú__doc__Ú
__future__r   r   Útypingr   r    r	   r	   r	   r   Ú<module>   s
    