Back
Type Name Operations
Icons Open
__pycache__ Open
CREDITS.txt
ChangeLog
HISTORY.txt
NEWS2x.txt
News3.txt
README.txt
TODO.txt
__init__.py
__main__.py
autocomplete.py
autocomplete_w.py
autoexpand.py
browser.py
calltip.py
calltip_w.py
codecontext.py
colorizer.py
config-extensions.def
config-highlight.def
config-keys.def
config-main.def
config.py
config_key.py
configdialog.py
debugger.py
debugger_r.py
debugobj.py
debugobj_r.py
delegator.py
dynoption.py
editor.py
extend.txt
filelist.py
format.py
grep.py
help.html
help.py
help_about.py
history.py
hyperparser.py
idle.bat
idle.py
idle.pyw
iomenu.py
macosx.py
mainmenu.py
multicall.py
outwin.py
parenmatch.py
pathbrowser.py
percolator.py
pyparse.py
pyshell.py
query.py
redirector.py
replace.py
rpc.py
run.py
runscript.py
scrolledlist.py
search.py
searchbase.py
searchengine.py
sidebar.py
squeezer.py
stackviewer.py
statusbar.py
textview.py
tooltip.py
tree.py
undo.py
util.py
window.py
zoomheight.py
zzdummy.py

File Transfer

Upload files to current directory

File Editor: delegator.py

class Delegator: def __init__(self, delegate=None): self.delegate = delegate self.__cache = set() # Cache is used to only remove added attributes # when changing the delegate. def __getattr__(self, name): attr = getattr(self.delegate, name) # May raise AttributeError setattr(self, name, attr) self.__cache.add(name) return attr def resetcache(self): "Removes added attributes while leaving original attributes." # Function is really about resetting delegator dict # to original state. Cache is just a means for key in self.__cache: try: delattr(self, key) except AttributeError: pass self.__cache.clear() def setdelegate(self, delegate): "Reset attributes and change delegate." self.resetcache() self.delegate = delegate if __name__ == '__main__': from unittest import main main('idlelib.idle_test.test_delegator', verbosity=2)