MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _all_string_prefixes

Function _all_string_prefixes

tools/python-3.11.9-amd64/Lib/tokenize.py:84–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

tokenize.pyFile · 0.85

Calls 3

upperMethod · 0.80
addMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected