Separate out character sets to avoid translating their contents. >>> [m.group(0) for m in separate('*.txt')] ['*.txt'] >>> [m.group(0) for m in separate('a[?]txt')] ['a', '[?]', 'txt']
(pattern)
| 102 | |
| 103 | |
| 104 | def separate(pattern): |
| 105 | """ |
| 106 | Separate out character sets to avoid translating their contents. |
| 107 | |
| 108 | >>> [m.group(0) for m in separate('*.txt')] |
| 109 | ['*.txt'] |
| 110 | >>> [m.group(0) for m in separate('a[?]txt')] |
| 111 | ['a', '[?]', 'txt'] |
| 112 | """ |
| 113 | return re.finditer(r'([^\[]+)|(?P<set>[\[].*?[\]])|([\[][^\]]*$)', pattern) |
no outgoing calls
no test coverage detected
searching dependent graphs…