MCPcopy Index your code
hub / github.com/python/cpython / translate

Function translate

Lib/fnmatch.py:95–102  ·  view source on GitHub ↗

Translate a shell PATTERN to a regular expression. There is no way to quote meta-characters.

(pat)

Source from the content-addressed store, hash-verified

93
94
95def translate(pat):
96 """Translate a shell PATTERN to a regular expression.
97
98 There is no way to quote meta-characters.
99 """
100
101 parts, star_indices = _translate(pat, '*', '.')
102 return _join_translated_parts(parts, star_indices)
103
104
105_re_setops_sub = re.compile(r'([&~|])').sub

Callers 4

test_translateMethod · 0.90
_compile_patternFunction · 0.70

Calls 2

_translateFunction · 0.85
_join_translated_partsFunction · 0.85

Tested by 3

test_translateMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…