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

Method star_not_empty

Lib/zipfile/_path/glob.py:91–101  ·  view source on GitHub ↗

Ensure that * will not match an empty segment.

(self, pattern)

Source from the content-addressed store, hash-verified

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
104def separate(pattern):

Callers 1

translate_coreMethod · 0.95

Calls 2

escapeMethod · 0.80
subMethod · 0.45

Tested by

no test coverage detected