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

Method is_valid

Lib/string/__init__.py:163–174  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

161 return self.pattern.sub(convert, self.template)
162
163 def is_valid(self):
164 for mo in self.pattern.finditer(self.template):
165 if mo.group('invalid') is not None:
166 return False
167 if (mo.group('named') is None
168 and mo.group('braced') is None
169 and mo.group('escaped') is None):
170 # If all the groups are None, there must be
171 # another group we're not expecting
172 raise ValueError('Unrecognized named group in pattern',
173 self.pattern)
174 return True
175
176 def get_identifiers(self):
177 ids = []

Calls 1

groupMethod · 0.45