MCPcopy Index your code
hub / github.com/RustPython/RustPython / convert

Method convert

Lib/string/__init__.py:128–138  ·  view source on GitHub ↗
(mo)

Source from the content-addressed store, hash-verified

126 mapping = ChainMap(kws, mapping)
127 # Helper function for .sub()
128 def convert(mo):
129 # Check the most common path first.
130 named = mo.group('named') or mo.group('braced')
131 if named is not None:
132 return str(mapping[named])
133 if mo.group('escaped') is not None:
134 return self.delimiter
135 if mo.group('invalid') is not None:
136 self._invalid(mo)
137 raise ValueError('Unrecognized named group in pattern',
138 self.pattern)
139 return self.pattern.sub(convert, self.template)
140
141 def safe_substitute(self, mapping=_sentinel_dict, /, **kws):

Callers

nothing calls this directly

Calls 3

_invalidMethod · 0.95
strFunction · 0.85
groupMethod · 0.45

Tested by

no test coverage detected