@@ -46,9 +46,15 @@ module. See module :mod:`glob` for pathname expansion (:mod:`glob` uses
46
46
a period are not special for this module, and are matched by the ``* `` and ``? ``
47
47
patterns.
48
48
49
- Also note that :func: `functools.lru_cache ` with the *maxsize * of 32768 is used to
50
- cache the compiled regex patterns in the following functions: :func: `fnmatch `,
51
- :func: `fnmatchcase `, :func: `.filter `.
49
+ Unless stated otherwise, "filename string" and "pattern string" either refer to
50
+ :class: `str ` or ``ISO-8859-1 `` encoded :class: `bytes ` objects. Note that the
51
+ functions documented below do not allow to mix a :class: `!bytes ` pattern with
52
+ a :class: `!str ` filename, and vice-versa.
53
+
54
+ Finally, note that :func: `functools.lru_cache ` with a *maxsize * of 32768
55
+ is used to cache the (typed) compiled regex patterns in the following
56
+ functions: :func: `fnmatch `, :func: `fnmatchcase `, :func: `.filter `.
57
+
52
58
53
59
.. function :: fnmatch(name, pat)
54
60
@@ -78,16 +84,16 @@ cache the compiled regex patterns in the following functions: :func:`fnmatch`,
78
84
79
85
.. function :: filter(names, pat)
80
86
81
- Construct a list from those elements of the :term: `iterable ` * names *
82
- that match pattern *pat *.
87
+ Construct a list from those elements of the :term: `iterable ` of filename
88
+ strings * names * that match the pattern string *pat *.
83
89
It is the same as ``[n for n in names if fnmatch(n, pat)] ``,
84
90
but implemented more efficiently.
85
91
86
92
87
93
.. function :: translate(pat)
88
94
89
95
Return the shell-style pattern *pat * converted to a regular expression for
90
- using with :func: `re.match `.
96
+ using with :func: `re.match `. The pattern is expected to be a :class: ` str `.
91
97
92
98
Example:
93
99
0 commit comments