GlobPattern¶
-
class GlobPattern¶
This class can be used to test for string matches against standard Unix- shell filename globbing conventions. It serves as a portable standin for the Posix fnmatch() call.
A GlobPattern is given a pattern string, which can contain operators like *, ?, and []. Then it can be tested against any number of candidate strings; for each candidate, it will indicate whether the string matches the pattern or not. It can be used, for example, to scan a directory for all files matching a particular pattern.
Inheritance diagram
digraph inheritance9483d12d7e { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "GlobPattern" [URL="acron.core.GlobPattern.html#acron.core.GlobPattern",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "GlobPattern" [arrowsize=0.75,style=""]; }- GlobPattern.__eq__()¶
- GlobPattern.__init__()¶
- GlobPattern.__lt__()¶
- GlobPattern.__ne__()¶
- GlobPattern.assign()¶
- GlobPattern.get_case_sensitive()¶
Returns whether the match is case sensitive (true) or case insensitive (false). The default is case sensitive.
- GlobPattern.get_const_prefix()¶
Returns the initial part of the pattern before the first glob character. Since many glob patterns begin with a sequence of static characters and end with one or more glob characters, this can be used to optimized searches through sorted indices.
- GlobPattern.get_nomatch_chars()¶
Returns the set of characters that are not matched by * or ?.
- GlobPattern.get_pattern()¶
Returns the pattern string that the
GlobPatternobject matches.
- GlobPattern.has_glob_characters()¶
Returns true if the pattern includes any special globbing characters, or false if it is just a literal string.
- GlobPattern.match_files()¶
Treats the
GlobPatternas a filename pattern, and returns a list of any actual files that match the pattern. This is the behavior of the standard Posix glob() function. Any part of the filename may contain glob characters, including intermediate directory names.If cwd is specified, it is the directory that relative filenames are taken to be relative to; otherwise, the actual current working directory is assumed.
The return value is the number of files matched, which are added to the results vector.
- GlobPattern.matches()¶
Returns true if the candidate string matches the pattern, false otherwise.
- GlobPattern.matches_file()¶
Treats the
GlobPatternas a filename pattern, and returns true if the given filename matches the pattern. Unlikematches(), this will not match slash characters for single asterisk characters, and it will ignore path components that only contain a dot.
- GlobPattern.output()¶
- GlobPattern.set_case_sensitive()¶
Sets whether the match is case sensitive (true) or case insensitive (false). The default is case sensitive.
- GlobPattern.set_nomatch_chars()¶
Specifies a set of characters that are not matched by * or ?.
- GlobPattern.set_pattern()¶
Changes the pattern string that the
GlobPatternobject matches.