Ensure that * will not match an empty segment.
(self, pattern)
| 89 | raise ValueError("** must appear alone in a path segment") |
| 90 | |
| 91 | def star_not_empty(self, pattern): |
| 92 | """ |
| 93 | Ensure that * will not match an empty segment. |
| 94 | """ |
| 95 | |
| 96 | def handle_segment(match): |
| 97 | segment = match.group(0) |
| 98 | return '?*' if segment == '*' else segment |
| 99 | |
| 100 | not_seps_pattern = rf'[^{re.escape(self.seps)}]+' |
| 101 | return re.sub(not_seps_pattern, handle_segment, pattern) |
| 102 | |
| 103 | |
| 104 | def separate(pattern): |
no test coverage detected