()
| 83 | |
| 84 | # Return the empty string, plus all of the valid string prefixes. |
| 85 | def _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 |
| 101 | def _compile(expr): |
no test coverage detected
searching dependent graphs…