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

Function replace

Lib/idlelib/replace.py:14–29  ·  view source on GitHub ↗

Create or reuse a singleton ReplaceDialog instance. The singleton dialog saves user entries and preferences across instances. Args: text: Text widget containing the text to be searched.

(text, insert_tags=None)

Source from the content-addressed store, hash-verified

12
13
14def replace(text, insert_tags=None):
15 """Create or reuse a singleton ReplaceDialog instance.
16
17 The singleton dialog saves user entries and preferences
18 across instances.
19
20 Args:
21 text: Text widget containing the text to be searched.
22 """
23 root = text._root()
24 engine = searchengine.get(root)
25 if not hasattr(engine, "_replacedialog"):
26 engine._replacedialog = ReplaceDialog(root, engine)
27 dialog = engine._replacedialog
28 searchphrase = text.get("sel.first", "sel.last")
29 dialog.open(text, searchphrase, insert_tags=insert_tags)
30
31
32class ReplaceDialog(SearchDialogBase):

Callers 7

show_replaceFunction · 0.70
test_replace_simpleMethod · 0.50
test_replace_regexMethod · 0.50

Calls 4

ReplaceDialogClass · 0.85
_rootMethod · 0.80
getMethod · 0.45
openMethod · 0.45

Tested by 6

test_replace_simpleMethod · 0.40
test_replace_regexMethod · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…