L iQLddlZddlmZddlmZeeeefZGddZy)N)Iterable)UnionceZdZdZddddededefdZd Zd Zd ed e fd Z e ddedefdZ e ddedefdZ y) GlobGroupaA 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 separatorincluder r cd|d|d|_tj|||_tj|||_||_y)NzGlobGroup(include=z , exclude=))_dbgr _glob_listr r r )selfr r r s ^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/torch/package/glob_group.py__init__zGlobGroup.__init__*sI) G9AF  ++GY?  ++GY? "c|jSNrrs r__str__zGlobGroup.__str__2 yyrc|jSrrrs r__repr__zGlobGroup.__repr__5rr candidatereturnc|jztfd|jDxrtfd|jDS)Nc3@K|]}|jywr fullmatch.0prs r z$GlobGroup.matches..:s@a1;;y)@sc3BK|]}|j ywrr r"s rr%z$GlobGroup.matches..:s$I +, I& &I s)r anyr allr )rrs `rmatcheszGlobGroup.matches8sHNNY. @4<<@@ SI 04 I F  relemsct|trtj||gS|Dcgc]}tj||c}Scc}wr) isinstancestrr _glob_to_re)r*r es rrzGlobGroup._glob_list>sC eS !))%;< .component_to_re..PsM%&BIIaLMs!*)r5r6 ValueErrorjoinsplit) componentr s rcomponent_to_rez.GlobGroup._glob_to_re..component_to_reIsy $9!55M/rc3.K|] }|ywrr)r#cr=s rr%z(GlobGroup._glob_to_re..TsN+Ns)r:r;r5compile)r0r resultr=s ` @rr.zGlobGroup._glob_to_reEs6 NW]]95MNNzz&!!rN)r)__name__ __module__ __qualname____doc__ GlobPatternr-rrrboolr) staticmethodrr.rrrrr s@?ASV#"#0;#MP#   H+H#HH "S"S""rr)r5collections.abcrtypingrr-rGrrrrrLs/ $C#&' K"K"r