MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / __forwardmethods

Function __forwardmethods

Python/Turtle.py:207–225  ·  view source on GitHub ↗
(fromClass, toClass, toPart, exclude = ())

Source from the content-addressed store, hash-verified

205 'self.%(attribute)s.%(method)s(*args, **kw)')
206
207def __forwardmethods(fromClass, toClass, toPart, exclude = ()):
208 ### MANY CHANGES ###
209 _dict_1 = {}
210 __methodDict(toClass, _dict_1)
211 _dict = {}
212 mfc = __methods(fromClass)
213 for ex in _dict_1.keys():
214 if ex[:1] == '_' or ex[-1:] == '_' or ex in exclude or ex in mfc:
215 pass
216 else:
217 _dict[ex] = _dict_1[ex]
218
219 for method, func in _dict.items():
220 d = {'method': method, 'func': func}
221 if isinstance(toPart, str):
222 execString = \
223 __stringBody % {'method' : method, 'attribute' : toPart}
224 exec(execString, d)
225 setattr(fromClass, method, d[method]) ### NEWU!
226
227
228class ScrolledCanvas(TK.Frame):

Callers 1

Turtle.pyFile · 0.85

Calls 2

__methodDictFunction · 0.85
__methodsFunction · 0.85

Tested by

no test coverage detected