
    3jJ                    H    S SK Jr  S SKrS SKJr  \\\   -  r " S S5      rg)    )annotationsN)Iterablec                  |    \ rS rSrSrSSS.     SS jjrS rS rSS	 jr\	SSS
 jj5       r
\	SSS jj5       rSrg)	GlobGroup   a1  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 (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 (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	separatorc                   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_listincluder
   r   )selfr   r
   r   s       R/home/wildlama/miniconda3/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__3       yyr   c                    U R                   $ r   r   r   s    r   __repr__GlobGroup.__repr__6   r   r   c                   ^ 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p	candidates     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.matches9   sH    NNY.	@4<<@@ 
S I
04I
 F
 	
r   c                    [        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)elemsr   es      r   r   GlobGroup._glob_list?   sF    eS!!))%;<<AFGAI))!7GGGs   Ac                   ^^ 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>Q   s      M*>QBIIaLL*>s   #%*)r:   r;   
ValueErrorjoinsplit)	componentr   s    r   component_to_re.GlobGroup._glob_to_re.<locals>.component_to_reJ   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%   crC   s     r   r(   (GlobGroup._glob_to_re.<locals>.<genexpr>U   s     N5M++5Ms   )r@   rA   r:   compile)patternr   resultrC   s    ` @r   r2   GlobGroup._glob_to_reF   s6    		 NW]]95MNNzz&!!r   )r   r
   r   r   N)r   GlobPatternr
   rM   r   r1   )r'   r1   returnbool)r	   )r3   rM   r   r1   )rJ   r1   r   r1   )__name__
__module____qualname____firstlineno____doc__r   r   r   r-   staticmethodr   r2   __static_attributes__r   r   r   r   r      sg    @ ?ASV#"#0;#MP#
 H H " "r   r   )
__future__r   r:   collections.abcr   r1   rM   r   r   r   r   <module>rY      s*    " 	 $ HSM!K" K"r   