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

Function _all_string_prefixes

Lib/tokenize.py:85–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83
84# Return the empty string, plus all of the valid string prefixes.
85def _all_string_prefixes():
86 # The valid string prefixes. Only contain the lower case versions,
87 # and don't contain any permutations (include 'fr', but not
88 # 'rf'). The various permutations will be generated.
89 _valid_string_prefixes = ['b', 'r', 'u', 'f', 't', 'br', 'fr', 'tr']
90 # if we add binary f-strings, add: ['fb', 'fbr']
91 result = {''}
92 for prefix in _valid_string_prefixes:
93 for t in _itertools.permutations(prefix):
94 # create a list with upper and lower versions of each
95 # character
96 for u in _itertools.product(*[(c, c.upper()) for c in t]):
97 result.add(''.join(u))
98 return result
99
100@functools.lru_cache
101def _compile(expr):

Callers 1

tokenize.pyFile · 0.85

Calls 3

upperMethod · 0.45
addMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…