o
    §ià  ã                
   @   sn   d dl Z d dlmZ d dlmZmZ d dlmZmZ de	fdd„Z
ddœd	ed
ededB dee fdd„ZdS )é    N)ÚPath)ÚAnyÚget_args)ÚresolveÚtoken_countÚreturnc                 C   s4   | t u rdS t| ƒD ]}t|ƒ}t|ƒr dS q
dS )NTF)r   r   r   Ú_is_path)Útype_Ú
inner_type© r   úW/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/cyclopts/_env_var.pyr      s   ÿr   )Ú	delimiterr	   Úvalr   c                C   sD   t | ƒ} t| ƒ\}}|dks|rt| ƒr| tj¡S | |¡S |gS )a2  Type-dependent environment variable value splitting.

    Converts a single string into a list of strings. Splits when:

    * The ``type_`` is some variant of ``Iterable[pathlib.Path]`` objects.
      If Windows, split on ``;``, otherwise split on ``:``.

    * Otherwise, if the ``type_`` is an ``Iterable``, split on whitespace.
      Leading/trailing whitespace of each output element will be stripped.

    This function is the default value for :attr:`cyclopts.App.env_var_split`.

    Parameters
    ----------
    type_: type
        Type hint that we will eventually coerce into.
    val: str
        String to split.
    delimiter: str | None
        Delimiter to split ``val`` on.
        If None, defaults to whitespace.

    Returns
    -------
    list[str]
        List of individual string tokens.
    é   )r   r   r   ÚsplitÚosÚpathsep)r	   r   r   ÚcountÚconsume_allr   r   r   Úenv_var_split   s
   !r   )r   Úpathlibr   Útypingr   r   Úcyclopts._convertr   r   Úboolr   ÚstrÚlistr   r   r   r   r   Ú<module>   s    üÿþüû