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

Method _replace_expand

Lib/idlelib/replace.py:109–120  ·  view source on GitHub ↗

Expand replacement text if regular expression.

(self, m, repl)

Source from the content-addressed store, hash-verified

107 self.do_find(False)
108
109 def _replace_expand(self, m, repl):
110 "Expand replacement text if regular expression."
111 if self.engine.isre():
112 try:
113 new = m.expand(repl)
114 except re.PatternError:
115 self.engine.report_error(repl, 'Invalid Replace Expression')
116 new = None
117 else:
118 new = repl
119
120 return new
121
122 def replace_all(self, event=None):
123 """Handle the Replace All button.

Callers 2

replace_allMethod · 0.95
do_replaceMethod · 0.95

Calls 3

isreMethod · 0.80
report_errorMethod · 0.80
expandMethod · 0.45

Tested by

no test coverage detected