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

Method register

Lib/idlelib/redirector.py:66–79  ·  view source on GitHub ↗

Return OriginalCommand(operation) after registering function. Registration adds an operation: function pair to ._operations. It also adds a widget function attribute that masks the tkinter class instance method. Method masking operates independently from command dis

(self, operation, function)

Source from the content-addressed store, hash-verified

64 # if instance is deleted after close, as in Percolator.
65
66 def register(self, operation, function):
67 '''Return OriginalCommand(operation) after registering function.
68
69 Registration adds an operation: function pair to ._operations.
70 It also adds a widget function attribute that masks the tkinter
71 class instance method. Method masking operates independently
72 from command dispatch.
73
74 If a second function is registered for the same operation, the
75 first function is replaced in both places.
76 '''
77 self._operations[operation] = function
78 setattr(self.widget, operation, function)
79 return OriginalCommand(self, operation)
80
81 def unregister(self, operation):
82 '''Return the function for the operation, or None.

Callers 2

_widget_redirectorFunction · 0.95
test_closeMethod · 0.95

Calls 1

OriginalCommandClass · 0.85

Tested by 1

test_closeMethod · 0.76