
    Gui<                    B   d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	m
Z ej                  r
ddlZddlmZ  ej                   e      ZdZ ej(                  dez   dz   ej*                  ej,                  z        Zd5d	Zd
Z ej(                  de dej,                        Zd6dZ	 	 ddlmZ d7dZ!d7dZ#d7dZ$d8dZ% G d d      Z&	 ddl'm(Z) d7dZ*d7dZ+d7dZ,dZ- ej(                  de- dej,                        Z.dZ/ ej(                  de/ dej,                        Z0dZ1 ej(                  de1 dej,                        Z2d7dZ3d7dZ4d7d Z5d7d!Z6d7d"Z7d7d#Z8d7d$Z9d9d%Z:d9d&Z;d9d'Z<d9d(Z=d9d)Z>d9d*Z?d9d+Z@d9d,ZAd9d-ZBd9d.ZC	 dd/lmDZE d7d0ZF ej(                  d3ej*                        ZGd7d4ZHy# e$ r
 ddl mZ Y w xY w# e$ r ejE                  d       d7dZ!Y 2w xY w# e$ r  e&       Z*Y $w xY w# e$ r ejE                  d1       d7d2ZFY w xY w):a@  
The functions in this module are used to validate schemas with the
`format JSON Schema keyword
<https://json-schema.org/understanding-json-schema/reference/string#format>`_.

The correspondence is given by replacing the ``_`` character in the name of the
function with a ``-`` to obtain the format name and vice versa.
    )annotationsN)chain)Literala  
    v?
    (?:
        (?:(?P<epoch>[0-9]+)!)?                           # epoch
        (?P<release>[0-9]+(?:\.[0-9]+)*)                  # release segment
        (?P<pre>                                          # pre-release
            [-_\.]?
            (?P<pre_l>alpha|a|beta|b|preview|pre|c|rc)
            [-_\.]?
            (?P<pre_n>[0-9]+)?
        )?
        (?P<post>                                         # post release
            (?:-(?P<post_n1>[0-9]+))
            |
            (?:
                [-_\.]?
                (?P<post_l>post|rev|r)
                [-_\.]?
                (?P<post_n2>[0-9]+)?
            )
        )?
        (?P<dev>                                          # dev release
            [-_\.]?
            (?P<dev_l>dev)
            [-_\.]?
            (?P<dev_n>[0-9]+)?
        )?
    )
    (?:\+(?P<local>[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
z^\s*z\s*$c                0    t         j                  |       duS )zpSee :ref:`PyPA's version specification <pypa:version-specifiers>`
    (initially introduced in :pep:`440`).
    N)VERSION_REGEXmatch)versions    _/opt/pipecat/venv/lib/python3.12/site-packages/setuptools/config/_validate_pyproject/formats.pypep440r   B   s     w't33    z'([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])^$c                0    t         j                  |       duS )zlSee :ref:`PyPA's name specification <pypa:name-format>`
    (initially introduced in :pep:`508#names`).
    N)PEP508_IDENTIFIER_REGEXr   )names    r
   pep508_identifierr   P   s     #((.d::r   )requirementsc                b    	 t        j                  |        y# t         j                  $ r Y yw xY w)z{See :ref:`PyPA's dependency specifiers <pypa:dependency-specifiers>`
        (initially introduced in :pep:`508`).
        FT)_reqRequirementInvalidRequirementvalues    r
   pep508r   `   s4    	U#  && 		    ..zCould not find an installation of `packaging`. Requirements, dependencies and versions might not be validated. To enforce validation, please install `packaging`.c                     yNT r   s    r
   r   r   q       r   c                J     t         fddD              ryt        d        S )zExpression that can be used to specify/lock versions (including ranges)
    See ``versionspec`` in :ref:`PyPA's dependency specifiers
    <pypa:dependency-specifiers>` (initially introduced in :pep:`508`).
    c              3  &   K   | ]  }|v  
 y wNr   ).0cr   s     r
   	<genexpr>z%pep508_versionspec.<locals>.<genexpr>z   s     
/!1:
/s   );]@Frequirement)anyr   r   s   `r
   pep508_versionspecr+   u   s,    
 
/
//  Kw'((r   c                    | j                  d      \  }}}d t        |j                  d      |j                  d            D        }t        d |D              S )zSee PyPA's specification for defining build-backend references
    introduced in :pep:`517#source-trees`.

    This is similar to an entry-point reference (e.g., ``package.module:object``).
    :c              3  <   K   | ]  }|j                           y wr"   stripr#   is     r
   r%   z+pep517_backend_reference.<locals>.<genexpr>   s     P1779P   .c              3  8   K   | ]  }|st        |        y wr"   python_identifierr1   s     r
   r%   z+pep517_backend_reference.<locals>.<genexpr>   s     >A #>s   )	partition_chainsplitall)r   module_objidentifierss        r
   pep517_backend_referencer@      sK     __S)NFAsPfV\\#->		#&OPK>[>>>r   c                    dd l } ddlm} ddlm} d}| j                         } |||      5 } |       }|j                  dd      |d<   |j                         j                  |j                  d	d
            cd d d        S # 1 sw Y   y xY w)Nr   )Message)urlopenz.https://pypi.org/pypi?:action=list_classifiers)contextzcontent-typez
text/plaincontent_typecharsetzutf-8)
sslemail.messagerB   urllib.requestrC   create_default_context	getheaderreaddecode	get_param)rG   rB   rC   urlrD   responseheaderss          r
   _download_classifiersrR      s    %&
:C((*G	g	& M()"*"4"4^\"R}}%%g&7&7	7&KLM M Ms   ABBc                  6    e Zd ZU dZded<   	 ddZddZd	dZy)
_TroveClassifierak  The ``trove_classifiers`` package is the official way of validating classifiers,
    however this package might not be always available.
    As a workaround we can still download a list from PyPI.
    We also don't want to be over strict about it, so simply skipping silently is an
    option (classifiers will be validated anyway during the upload to PyPI).
    z None | Literal[False] | set[str]
downloadedc                .    d | _         d| _        d| _        y )NFtrove_classifier)rU   _skip_download__name__selfs    r
   __init__z_TroveClassifier.__init__   s    #*r   c                    d| _         y r   )rX   rZ   s    r
   _disable_downloadz"_TroveClassifier._disable_download   s
    "r   c                   | j                   du s| j                  du ryt        j                  d      st        j                  d      rd| _         d}t        j                  |       y| j                   >d}t        j                  |       	 t        t               j                               | _         || j                   v xs |j                         j                  d      S # t        $ r d| _         t        j                  d       Y yw xY w)	NFT
NO_NETWORKVALIDATE_PYPROJECT_NO_NETWORKzxInstall ``trove-classifiers`` to ensure proper validation. Skipping download of classifiers list from PyPI (NO_NETWORK).zxInstall ``trove-classifiers`` to ensure proper validation. Meanwhile a list of classifiers will be downloaded from PyPI.z*Problem with download, skipping validation
private ::)rU   rX   osgetenv_loggerdebugsetrR   
splitlines	Exceptionlower
startswith)r[   r   msgs      r
   __call__z_TroveClassifier.__call__   s    ??e#t':':d'B99\"bii0O&P#DOP  MM#??"P  MM#"%&;&=&H&H&J"K 'Q5;;=+C+CL+QQ  "'JKs   &C   %DDN)returnNoner   strrn   bool)rY   
__module____qualname____doc____annotations__r\   r^   rm   r   r   r
   rT   rT      s$     10+
#Rr   rT   )classifiersc                T    | t         v xs | j                         j                  d      S )z!See https://pypi.org/classifiers/rb   )_trove_classifiersrj   rk   r   s    r
   rW   rW      s$    **Tekkm.F.F|.TTr   c           	         | j                  d      ^}}|j                  d      syt        dj                  |dt	        d        g|            S )zName of a directory containing type stubs.
    It must follow the name scheme ``<package>-stubs`` as defined in
    :pep:`561#stub-only-packages`.
    r4   -stubsFN)r:   endswithpython_module_namejoinlen)r   topchildrens      r
   pep561_stub_namer      sO    
 [[%NC(<<!chh,<s8}n(='I'IJKKr   c                   ddl m} 	  ||       }|j                  s8t        j	                  d|         | j                  d      sd| v s |d|        }t        |j                  xr |j                        S # t        $ r Y yw xY w)zValid URL (validation uses :obj:`urllib.parse`).
    For maximum compatibility please make sure to include a ``scheme`` prefix
    in your URL (e.g. ``http://``).
    r   )urlparsezsFor maximum compatibility please make sure to include a `scheme` prefix in your URL (e.g. 'http://'). Given value: )/\r(   zhttp://F)	urllib.parser   schemere   warningrk   rr   netlocri   )r   r   partss      r
   rO   rO      s    
 &||OO  %w(
 $$[1SE\ 75'!23ELL1U\\22 s   A.A7 7	BBz[^\[\s=]([^=]*[^\s=])?z[\w.-]+z\w+(\.\w+)*c                "    | j                         S )zXCan be used as identifier in Python.
    (Validation uses :obj:`str.isidentifier`).
    )isidentifierr   s    r
   r7   r7     s     r   c                    | j                  d      s| j                  d      ryt        d | j                  d      D              S )z
    Python "dotted identifier", i.e. a sequence of :obj:`python_identifier`
    concatenated with ``"."`` (e.g.: ``package.module.submodule``).
    r4   Fc              3  2   K   | ]  }t        |        y wr"   r6   )r#   ms     r
   r%   z.python_qualified_identifier.<locals>.<genexpr>'  s     > #>   )rk   r|   r;   r:   r   s    r
   python_qualified_identifierr      s:    
 s 3>U[[-=>>>r   c                    t        |       S )zsModule name that can be used in an ``import``-statement in Python.
    See :obj:`python_qualified_identifier`.
    )r   r   s    r
   r}   r}   *  s     'u--r   c                    | j                  d      s| j                  d      ry| j                  d      ryt        | j                  dd            S )a  Similar to :obj:`python_module_name`, but relaxed to also accept
    dash characters (``-``) and cover special cases like ``pip-run``.

    It is recommended, however, that beginners avoid dash characters,
    as they require advanced knowledge about Python internals.

    The following are disallowed:

    * names starting/ending in dashes,
    * names ending in ``-stubs`` (potentially collide with :obj:`pep561_stub_name`).
    -Fr{   r=   )rk   r|   r}   replacer   s    r
   python_module_name_relaxedr   1  sE     s 3~~hemmC566r   c                0    t         j                  |       duS )zhSee ``Data model > group`` in the :ref:`PyPA's entry-points specification
    <pypa:entry-points>`.
    N)ENTRYPOINT_GROUP_REGEXr   r   s    r
   python_entrypoint_groupr   D  s     "''.d::r   c                    t         j                  |       syt        j                  |       s$d|  d}|t        z  }t        j                  |       y)zgSee ``Data model > name`` in the :ref:`PyPA's entry-points specification
    <pypa:entry-points>`.
    FzEntry point `z'` does not follow recommended pattern: T)ENTRYPOINT_REGEXr   RECOMMEDED_ENTRYPOINT_REGEXRECOMMEDED_ENTRYPOINT_PATTERNre   r   )r   rl   s     r
   python_entrypoint_namer   K  sL     !!%(&,,U3eW$KL,,r   c                   | j                  d      \  }}}d|v r|j                  d      \  }}}|j                         d   dk7  ryd |j                  t        j                  dz         j	                  d      D        }t        d	 |D              syt        j                  d
|  d       n|}|j	                  d      }|rt        ||j	                  d            n
t        |      }t        d |D              S )zReference to a Python object using in the format::

        importable.module:object.attr

    See ``Data model >object reference`` in the :ref:`PyPA's entry-points specification
    <pypa:entry-points>`.
    r-   [r'   Fc              3  <   K   | ]  }|j                           y wr"   r/   )r#   xs     r
   r%   z.python_entrypoint_reference.<locals>.<genexpr>e  s     X!'')Xr3   z[],c              3  2   K   | ]  }t        |        y wr"   )r   )r#   es     r
   r%   z.python_entrypoint_reference.<locals>.<genexpr>f  s     8A$Q'8r   `z4` - using extras for entry points is not recommendedr4   c              3  N   K   | ]  }t        |j                                 y wr"   )r7   r0   r1   s     r
   r%   z.python_entrypoint_reference.<locals>.<genexpr>n  s     A +As   #%)
r8   r0   string
whitespacer:   r;   re   r   r9   iter)	r   r<   r=   restr>   extras_extrasmodule_partsr?   s	            r
   python_entrypoint_referencer   X  s     ooc*OFAt
d{..-Q==?2#%XW]]63D3Dt3K%L%R%RSV%WX888!E7"VWX<<$L:>&syy~6DDVKA[AAAr   c                "    d| cxk  xr dk  S c S )z/Unsigned 8-bit integer (:math:`0 \leq x < 2^8`)r      r   r   s    r
   uint8r   q  s    r   c                "    d| cxk  xr dk  S c S )z3Unsigned 16-bit integer (:math:`0 \leq x < 2^{16}`)r   i   r   r   s    r
   uint16r   v      r   c                "    d| cxk  xr dk  S c S )z3Unsigned 32-bit integer (:math:`0 \leq x < 2^{32}`)r   l        r   r   s    r
   uint32r   {  r   r   c                "    d| cxk  xr dk  S c S )z3Unsigned 64-bit integer (:math:`0 \leq x < 2^{64}`)r               r   r   s    r
   uint64r     r   r   c                "    d| cxk  xr dk  S c S )z1Signed 64-bit integer (:math:`0 \leq x < 2^{64}`)r   r   r   r   s    r
   uintr     r   r   c                "    d| cxk  xr dk  S c S )z4Signed 8-bit integer (:math:`-2^{7} \leq x < 2^{7}`)i   r   r   s    r
   int8r     s    e"d""""r   c                "    d| cxk  xr dk  S c S )z7Signed 16-bit integer (:math:`-2^{15} \leq x < 2^{15}`)i i   r   r   s    r
   int16r         u$u$$$$r   c                "    d| cxk  xr dk  S c S )z7Signed 32-bit integer (:math:`-2^{31} \leq x < 2^{31}`)i   l        r   r   s    r
   int32r     r   r   c                "    d| cxk  xr dk  S c S z7Signed 64-bit integer (:math:`-2^{63} \leq x < 2^{63}`)l         l            r   r   s    r
   int64r     r   r   c                "    d| cxk  xr dk  S c S r   r   r   s    r
   intr     r   r   )licensesc                b    	 t        j                  |        y# t         j                  $ r Y yw xY w)zSee :ref:`PyPA's License-Expression specification
        <pypa:core-metadata-license-expression>` (added in :pep:`639`).
        FT)	_licensescanonicalize_license_expressionInvalidLicenseExpressionr   s    r
   SPDXr     s4    	55e<  11 		r   zCould not find an up-to-date installation of `packaging`. License expressions might not be validated. To enforce validation, please install `packaging>=24.2`.c                     yr   r   r   s    r
   r   r     r   r   aP  
    ^                                  # start of string
        [A-Za-z_][A-Za-z_0-9]+         # a valid Python identifier
        (?:\.[A-Za-z_][A-Za-z_0-9]*)*  # optionally followed by .identifier's
    (?:\s*;\s*private)?                # optionally followed by ; private
    $                                  # end of string
    c                    t         j                  |       y| j                  d      \  }}}t        d |j	                         j                  d      D              S )zThis is a valid import name. It has to be series of python identifiers
    (not keywords), separated by dots, optionally followed by a semicolon and
    the keyword "private".
    Fr&   c              3  H   K   | ]  }t        j                  |         y wr"   )keyword	iskeyword)r#   idents     r
   r%   zimport_name.<locals>.<genexpr>  s     T7$$U++Ts    "r4   )VALID_IMPORT_NAMEr   r8   r;   rstripr:   )r   identsr=   s      r
   import_namer     sN    
 u%-??3'LFAqT9N9Ns9STTTr   )r	   rq   rn   rr   )r   rq   rn   rr   rp   )rn   rq   )r   zbuiltins.intrn   rr   )Iru   
__future__r   r   loggingrc   rer   typing	itertoolsr   r9   TYPE_CHECKINGbuiltinstyping_extensionsr   	getLoggerrY   re   VERSION_PATTERNcompileVERBOSE
IGNORECASEr   r   PEP508_IDENTIFIER_PATTERNr   r   	packagingr   r   ImportErrorsetuptools._vendor.packagingr   r   r+   r@   rR   rT   trove_classifiersrw   ry   rW   r   rO   ENTRYPOINT_PATTERNr   r   r   ENTRYPOINT_GROUP_PATTERNr   r7   r   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r
   <module>r      s   #   	 	   %	)
'

H
%
> 

o'bmm)C
4 G $"**q)B(C1%Er}}U ;
2*)&?
M2R 2Rj*CUL0 / 2::"4!5Q7G  * (bjj%&a("--  * #a(@'A$CR]]S  ?.7&;
B2




#
%
%
%
%
/* BJJ JJ	 	U[  
	
 	

   OO	=l  *')*`  OO	CsT   .F; 4G 
G. 
H ;G
G 	G

G G+*G+.G>=G>HH