MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / __forwardmethods

Function __forwardmethods

tools/python-3.11.9-amd64/Lib/turtle.py:310–328  ·  view source on GitHub ↗
(fromClass, toClass, toPart, exclude = ())

Source from the content-addressed store, hash-verified

308 'self.%(attribute)s.%(method)s(*args, **kw)')
309
310def __forwardmethods(fromClass, toClass, toPart, exclude = ()):
311 ### MANY CHANGES ###
312 _dict_1 = {}
313 __methodDict(toClass, _dict_1)
314 _dict = {}
315 mfc = __methods(fromClass)
316 for ex in _dict_1.keys():
317 if ex[:1] == '_' or ex[-1:] == '_' or ex in exclude or ex in mfc:
318 pass
319 else:
320 _dict[ex] = _dict_1[ex]
321
322 for method, func in _dict.items():
323 d = {'method': method, 'func': func}
324 if isinstance(toPart, str):
325 execString = \
326 __stringBody % {'method' : method, 'attribute' : toPart}
327 exec(execString, d)
328 setattr(fromClass, method, d[method]) ### NEWU!
329
330
331class ScrolledCanvas(TK.Frame):

Callers 1

turtle.pyFile · 0.85

Calls 4

__methodDictFunction · 0.85
__methodsFunction · 0.85
keysMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected