Ë
    §Œjp  ã                  óŽ   — d dl mZ d dlmZmZ d dlmZmZ h d£Zdd„Z	dd„Z
dd„Zdd„Ze G d	„ d
«      «       Z	 	 	 	 	 	 	 	 dd„Zy)é    )Úannotations)Ú	dataclassÚfield)ÚListÚOptional>   Ú(Ú)Ú[Ú]Ú{Ú}c                óv   — | D ]4  }t        |«      dk  st        |«      dkD  s	|t        v sŒ(t        |› d�«      ‚ y)zÐEnsure value contains only printable ASCII without spaces or braces.

    This mirrors the constraints enforced by other Redis clients for values that
    will appear in CLIENT LIST / CLIENT INFO output.
    é!   é~   zG must not contain spaces, newlines, non-printable characters, or bracesN)ÚordÚ_BRACESÚ
ValueError)ÚvalueÚ
field_nameÚchs      ú[/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/redis/driver_info.pyÚ_validate_no_invalid_charsr   	   sA   € ó ˆäˆr‹7�TŠ>œS ›W tš^¨r´Wª}ÜØ�,ÐeÐfóð ñ ó    c                ó^   — ddl }t        | d«       |j                  d| «      st        d«      ‚y)ao  Validate an upstream driver name.

    The name should look like a typical Python distribution or package name,
    following a simplified form of PEP 503 normalisation rules:

    * start with a lowercase ASCII letter
    * contain only lowercase letters, digits, hyphens and underscores

    Examples of valid names: ``"django-redis"``, ``"celery"``, ``"rq"``.
    r   NzDriver namez^[a-z][a-z0-9_-]*$zµUpstream driver name must use a Python package-style name: start with a lowercase letter and contain only lowercase letters, digits, hyphens, and underscores (e.g., 'django-redis').)Úrer   Úmatchr   )Únamer   s     r   Ú_validate_driver_namer      s8   € ó ä˜t ]Ô3Ø�8‰8Ð)¨4Ô0ÜðGó
ð 	
ð 1r   c                ó   — t        | d«       y )NzDriver version)r   )Úversions    r   Ú_validate_driver_versionr!   /   s   € Ü˜wÐ(8Õ9r   c                ó   — | › d|› �S )NÚ_v© )Údriver_nameÚdriver_versions     r   Ú_format_driver_entryr'   3   s   € Øˆ]˜"˜^Ð,Ð-Ð-r   c                  óˆ   — e Zd ZU dZdZded<   dZded<    ee¬«      Z	d	ed
<   d„ Z
edd„«       Z	 	 	 	 	 	 dd„Zedd„«       Zy)Ú
DriverInfoa²  Driver information used to build the CLIENT SETINFO LIB-NAME and LIB-VER values.

    This class consolidates all driver metadata (redis-py version and upstream drivers)
    into a single object that is propagated through connection pools and connections.

    The formatted name follows the pattern::

        name(driver1_vVersion1;driver2_vVersion2)

    Parameters
    ----------
    name : str, optional
        The base library name (default: "redis-py")
    lib_version : str, optional
        The redis-py library version. If None, the version will be determined
        automatically from the installed package.

    Examples
    --------
    >>> info = DriverInfo()
    >>> info.formatted_name
    'redis-py'

    >>> info = DriverInfo().add_upstream_driver("django-redis", "5.4.0")
    >>> info.formatted_name
    'redis-py(django-redis_v5.4.0)'

    >>> info = DriverInfo(lib_version="5.0.0")
    >>> info.lib_version
    '5.0.0'
    úredis-pyÚstrr   NúOptional[str]Úlib_version)Údefault_factoryú	List[str]Ú	_upstreamc                óB   — | j                   €ddlm}  |«       | _         yy)z'Initialize lib_version if not provided.Nr   ©Úget_lib_version)r-   Úredis.utilsr3   )Úselfr3   s     r   Ú__post_init__zDriverInfo.__post_init__]   s!   € à×ÑÐ#Ý3á.Ó0ˆDÕð $r   c                ó,   — t        | j                  «      S )zuReturn a copy of the upstream driver entries.

        Each entry is in the form ``"driver-name_vversion"``.
        )Úlistr0   ©r5   s    r   Úupstream_driverszDriverInfo.upstream_driversd   s   € ô �D—N‘NÓ#Ð#r   c                ó¶   — |€t        d«      ‚|€t        d«      ‚t        |«       t        |«       t        ||«      }| j                  j                  d|«       | S )z”Add an upstream driver to this instance and return self.

        The most recently added driver appears first in :pyattr:`formatted_name`.
        zDriver name must not be NonezDriver version must not be Noner   )r   r   r!   r'   r0   Úinsert)r5   r%   r&   Úentrys       r   Úadd_upstream_driverzDriverInfo.add_upstream_driverm   s]   € ð ÐÜÐ;Ó<Ð<ØÐ!ÜÐ>Ó?Ð?ä˜kÔ*Ü  Ô0ä$ [°.ÓAˆà�‰×Ñ˜a Ô'Øˆr   c                óˆ   — | j                   s| j                  S | j                  › ddj                  | j                   «      › d�S )z¹Return the base name with upstream drivers encoded, if any.

        With no upstream drivers, this is just :pyattr:`name`. Otherwise::

            name(driver1_vX;driver2_vY)
        r   Ú;r	   )r0   r   Újoinr9   s    r   Úformatted_namezDriverInfo.formatted_name‚   s:   € ð �~Š~Ø—9‘9ÐØ—)‘)�˜A˜cŸh™h t§~¡~Ó6Ð7°qÐ9Ð9r   )Úreturnr/   )r%   r+   r&   r+   rC   z'DriverInfo')rC   r+   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__r-   r   r8   r0   r6   Úpropertyr:   r>   rB   r$   r   r   r)   r)   7   sw   … ñð@ €Dˆ#ÓØ!%€K�Ó%Ù °Ô6€IˆyÓ6ò1ð ò$ó ð$ðØðØ03ðà	óð* ò
:ó ñ
:r   r)   c                óR   — | �| S ddl m} |�|nd}|�|n |«       }t        ||¬«      S )a  Resolve driver_info from parameters.

    If driver_info is provided, use it. Otherwise, create DriverInfo from
    lib_name and lib_version (using defaults if not provided).

    Parameters
    ----------
    driver_info : DriverInfo, optional
        The DriverInfo instance to use
    lib_name : str, optional
        The library name (default: "redis-py")
    lib_version : str, optional
        The library version (default: auto-detected)

    Returns
    -------
    DriverInfo
        The resolved DriverInfo instance
    r   r2   r*   )r   r-   )r4   r3   r)   )Údriver_infoÚlib_namer-   r3   r   r    s         r   Úresolve_driver_inforM   �   s=   € ð0 ÐØÐõ ,àÐ+‰8°€DØ(Ð4‰k¹/Ó:K€GÜ˜4¨WÔ5Ð5r   N)r   r+   r   r+   rC   ÚNone)r   r+   rC   rN   )r    r+   rC   rN   )r%   r+   r&   r+   rC   r+   )rK   zOptional[DriverInfo]rL   r,   r-   r,   rC   r)   )Ú
__future__r   Údataclassesr   r   Útypingr   r   r   r   r   r!   r'   r)   rM   r$   r   r   Ú<module>rR      sm   ðÝ "ç (ß !â
(€óó
ó.:ó.ð ÷U:ð U:ó ðU:ðp 6Ø%ð 6àð 6ð ð 6ð ô	 6r   