a
    ç´«j€  ã                   @  s¤   d dl mZ d dlmZ ddlmZ ddlmZ ddl	m
Z
mZ ddlmZmZ ddlmZ erld d	lmZ d
dgZddœdd„ZG dd
„ d
eƒZG dd„ dƒZdS )é    )Úannotations)ÚTYPE_CHECKINGé   )Úparse_requirement)ÚParserSyntaxError)ÚMarkerÚ_normalize_extra_values)ÚInvalidSpecifierÚSpecifierSet©Úcanonicalize_name)ÚIteratorÚInvalidRequirementÚRequirementz	list[str]©Úreturnc                   C  s   t S ©N)Ú__all__© r   r   úU/var/www/html/laksyashrimp/venv/lib/python3.9/site-packages/packaging/requirements.pyÚ__dir__   s    r   c                   @  s   e Zd ZdZdS )r   zf
    An invalid requirement was found, users should refer to PEP 508.

    .. versionadded:: 16.1
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r      s   c                   @  sŒ   e Zd ZdZdZdddœdd„Zddd	œd
d„Zddœdd„Zdddœdd„Zddœdd„Z	ddœdd„Z
ddœdd„Zdddœdd„ZdS ) r   aÝ  Parse a requirement.

    Parse a given requirement string into its parts, such as name, specifier,
    URL, and extras. Raises InvalidRequirement on a badly-formed requirement
    string.

    .. versionadded:: 16.1

    .. versionchanged:: 22.0
        Added equality (``__eq__``) and hashing (``__hash__``) so requirements
        can be compared and stored in sets / dicts.

    .. versionchanged:: 23.2
        Equality and hashing began canonicalizing requirement names, so
        requirements whose names differ only by normalization (e.g.
        ``Requirement("Foo")`` vs ``Requirement("foo")``) now compare and hash
        equal.

    Instances are safe to serialize with :mod:`pickle`. They use a stable
    format so the same pickle can be loaded in future packaging releases.

    .. versionchanged:: 26.2

        Added a stable pickle format. Pickles created with packaging 26.2+ can
        be unpickled with future releases.  Backward compatibility with pickles
        from packaging < 26.2 is supported but may be removed in a future
        release.

    .. versionchanged:: 26.3

        The dedicated pickle support introduced in 26.2 did not preserve the
        specifier's explicit :attr:`~packaging.specifiers.SpecifierSet.prereleases`
        override; it is now included again.

        Equality and hashing normalize requirement names, extras, and
        equivalent specifiers. The string representation still preserves the
        parsed name and extras spelling.
    )ÚextrasÚmarkerÚnameÚ	specifierÚurlÚstrÚNone)Úrequirement_stringr   c              
   C  sÒ   zt |ƒ}W n2 ty> } ztt|ƒƒ|‚W Y d }~n
d }~0 0 |j| _|jpPd | _t|jƒ| _zt|j	ƒ| _	W n2 t
y¢ } ztt|ƒƒ|‚W Y d }~n
d }~0 0 d | _|jd urÎt t¡| _t|jƒ| j_d S r   )Ú_parse_requirementr   r   r    r   r   Úsetr   r
   r   r	   r   r   Ú__new__r   Ú_markers)Úselfr"   ÚparsedÚer   r   r   Ú__init__R   s    $$
zRequirement.__init__zIterator[str])r   r   c                 c  st   |V  | j r*d t| j ƒ¡}d|› d�V  | jr<t| jƒV  | jr\d| j› �V  | jr\dV  | jrpd| j› �V  d S )Nú,ú[ú]z @ ú z; )r   ÚjoinÚsortedr   r    r   r   )r'   r   Úformatted_extrasr   r   r   Ú_iter_partsd   s    zRequirement._iter_partsztuple[str, bool | None]r   c                 C  s   t | ƒ| jjfS r   )r    r   Ú_prereleases©r'   r   r   r   Ú__getstate__v   s    zRequirement.__getstate__Úobject)Ústater   c              
   C  s  t |tƒr|}d }n’t |tƒr\t|ƒdkr\t |d tƒr\|d d u sRt |d tƒr\|\}}nJt |tƒr˜| ¡ t| jƒkr˜| jD ]}t	| ||| ƒ q~d S t
d|›�ƒ‚zt|ƒ}W n4 tyæ } zt
d|›�ƒ|‚W Y d }~n
d }~0 0 |j| _|j| _|j| _|j| _|| j_|j| _d S )Né   r   r   z Cannot restore Requirement from )Ú
isinstancer    ÚtupleÚlenÚboolÚdictÚkeysr$   Ú	__slots__ÚsetattrÚ	TypeErrorr   r   r   r   r   r   r3   r   )r'   r7   r"   ÚprereleasesÚkeyÚtmpÚexcr   r   r   Ú__setstate__}   s:    
ÿ
þý
üü

&zRequirement.__setstate__c                 C  s   d  |  | j¡¡S )NÚ )r/   r2   r   r4   r   r   r   Ú__str__�   s    zRequirement.__str__c                 C  s   d| j j› dt| ƒ›d�S )Nú<ú(z)>)Ú	__class__r   r    r4   r   r   r   Ú__repr__    s    zRequirement.__repr__Úintc                 C  s.   t t| jƒtdd„ | jD ƒƒ| j| j| jfƒS )Nc                 s  s   | ]}t |ƒV  qd S r   r   ©Ú.0r)   r   r   r   Ú	<genexpr>¬   ó    z'Requirement.__hash__.<locals>.<genexpr>)Úhashr   r   Ú	frozensetr   r   r   r   r4   r   r   r   Ú__hash__£   s    ûÿzRequirement.__hash__r<   )Úotherr   c                 C  sv   t |tƒstS tdd„ | jD ƒƒ}tdd„ |jD ƒƒ}t| jƒt|jƒkot||kot| j|jkot| j|jkot| j	|j	kS )Nc                 s  s   | ]}t |ƒV  qd S r   r   rN   r   r   r   rP   ¸   rQ   z%Requirement.__eq__.<locals>.<genexpr>c                 s  s   | ]}t |ƒV  qd S r   r   rN   r   r   r   rP   ¹   rQ   )
r9   r   ÚNotImplementedrS   r   r   r   r   r   r   )r'   rU   Zself_extrasZother_extrasr   r   r   Ú__eq__³   s    
ÿ
þ
ý
ûzRequirement.__eq__N)r   r   r   r   r?   r*   r2   r5   rF   rH   rL   rT   rW   r   r   r   r   r   #   s   , N)Ú
__future__r   Útypingr   Ú_parserr   r#   Ú
_tokenizerr   Úmarkersr   r   Ú
specifiersr	   r
   Úutilsr   Úcollections.abcr   r   r   Ú
ValueErrorr   r   r   r   r   r   Ú<module>   s   þ