
    JThQ                     L    S SK r S SKJr  S SKJr  \\\\   4   r " S S5      rg)    N)Iterable)Unionc                       \ rS rSrSrSSS.S\S\S\4S	 jjrS
 rS r	S\S\
4S jr\SS\S\4S jj5       r\SS\S\4S jj5       rSrg)	GlobGroup
   a=  A set of patterns that candidate strings will be matched against.

A candidate is composed of a list of segments separated by ``separator``, e.g. "foo.bar.baz".

A pattern contains one or more segments. Segments can be:
    - A literal string (e.g. "foo"), which matches exactly.
    - A string containing a wildcard (e.g. "torch*", or "foo*baz*"). The wildcard matches
      any string, including the empty string.
    - A double wildcard ("**"). This matches against zero or more complete segments.

Examples:
    ``torch.**``: matches ``torch`` and all its submodules, e.g. ``torch.nn`` and ``torch.nn.functional``.
    ``torch.*``: matches ``torch.nn`` or ``torch.functional``, but not ``torch.nn.functional``.
    ``torch*.**``: matches ``torch``, ``torchvision``, and all their submodules.

A candidates will match the ``GlobGroup`` if it matches any of the ``include`` patterns and
none of the ``exclude`` patterns.

Args:
    include (Union[str, Iterable[str]]): A string or list of strings,
        each representing a pattern to be matched against. A candidate
        will match if it matches *any* include pattern
    exclude (Union[str, Iterable[str]]): A string or list of strings,
        each representing a pattern to be matched against. A candidate
        will be excluded from matching if it matches *any* exclude pattern.
    separator (str): A string that delimits segments in candidates and
        patterns. By default this is "." which corresponds to how modules are
        named in Python. Another common value for this is "/", which is
        the Unix path separator.
 .)exclude	separatorincluder
   r   c                    SU SU S3U l         [        R                  X5      U l        [        R                  X#5      U l        X0l        g )NzGlobGroup(include=z
, exclude=))_dbgr   
_glob_listr   r
   r   )selfr   r
   r   s       P/var/www/auris/envauris/lib/python3.13/site-packages/torch/package/glob_group.py__init__GlobGroup.__init__*   sC     )	G9AF	 ++G? ++G?"    c                     U R                   $ Nr   r   s    r   __str__GlobGroup.__str__2       yyr   c                     U R                   $ r   r   r   s    r   __repr__GlobGroup.__repr__5   r   r   	candidatereturnc                    ^ U R                   T-   m[        U4S jU R                   5       5      =(       a    [        U4S jU R                   5       5      $ )Nc              3   D   >#    U  H  oR                  T5      v   M     g 7fr   	fullmatch.0pr    s     r   	<genexpr>$GlobGroup.matches.<locals>.<genexpr>:   s     @<a;;y))<s    c              3   N   >#    U  H  oR                  T5      (       + v   M     g 7fr   r$   r&   s     r   r)   r*   :   s"      I
0<1I&&&s   "%)r   anyr   allr
   )r   r    s    `r   matchesGlobGroup.matches8   sH    NNY.	@4<<@@ 
S I
04I
 F
 	
r   elemsc                     [        U [        5      (       a  [        R                  X5      /$ U  Vs/ s H  n[        R                  X!5      PM     sn$ s  snf r   )
isinstancestrr   _glob_to_re)r0   r   es      r   r   GlobGroup._glob_list>   sF    eS!!))%;<<AFGAI))!7GGGs   Apatternc                    ^^ U4S jmSR                  U4S jU R                  T5       5       5      n[        R                  " U5      $ )Nc                    > SU ;   a3  U S:X  a"  S[         R                  " T5      -   S-   T-   S-   $ [        S5      e[         R                  " T5      ST-   S-   R                  S U R	                  S5       5       5      -   $ )	Nz**(z[^z]+)*z,** can only appear as an entire path segmentz]*c              3   N   #    U  H  n[         R                  " U5      v   M     g 7fr   )reescape)r'   xs     r   r)   AGlobGroup._glob_to_re.<locals>.component_to_re.<locals>.<genexpr>P   s      M*>QBIIaLL*>s   #%*)r<   r=   
ValueErrorjoinsplit)	componentr   s    r   component_to_re.GlobGroup._glob_to_re.<locals>.component_to_reI   s    y $9!55<yH6QQ$%STTyy+ti/?$/F.L.L M*3//#*>M /  r    c              3   4   >#    U  H  nT" U5      v   M     g 7fr   r   )r'   crE   s     r   r)   (GlobGroup._glob_to_re.<locals>.<genexpr>T   s     N5M++5Ms   )rB   rC   r<   compile)r7   r   resultrE   s    ` @r   r4   GlobGroup._glob_to_reE   s6    		 NW]]95MNNzz&!!r   )r   r
   r   r   N)r	   )__name__
__module____qualname____firstlineno____doc__GlobPatternr3   r   r   r   boolr.   staticmethodr   r4   __static_attributes__r   r   r   r   r   
   s    @ ?ASV#"#0;#MP#
 
 
 H+ H# H H "S "S " "r   r   )r<   collections.abcr   typingr   r3   rS   r   r   r   r   <module>rY      s/    	 $  C#&'K" K"r   