mirror of
https://github.com/python/cpython.git
synced 2024-11-27 11:55:13 +08:00
Remove has_key() references from idlelib. IDLE still doesn't run due
to relative import issues. Any volunteers?
This commit is contained in:
parent
d204a715f4
commit
811c4e0b7c
@ -648,8 +648,8 @@ class EditorWindow(object):
|
||||
if accel:
|
||||
itemName = menu.entrycget(index, 'label')
|
||||
event = ''
|
||||
if menuEventDict.has_key(menubarItem):
|
||||
if menuEventDict[menubarItem].has_key(itemName):
|
||||
if menubarItem in menuEventDict:
|
||||
if itemName in menuEventDict[menubarItem]:
|
||||
event = menuEventDict[menubarItem][itemName]
|
||||
if event:
|
||||
accel = get_accelerator(keydefs, event)
|
||||
|
@ -25,7 +25,7 @@ class FileList:
|
||||
master=self.root)
|
||||
return None
|
||||
key = os.path.normcase(filename)
|
||||
if self.dict.has_key(key):
|
||||
if key in self.dict:
|
||||
edit = self.dict[key]
|
||||
edit.top.wakeup()
|
||||
return edit
|
||||
@ -79,7 +79,7 @@ class FileList:
|
||||
newkey = os.path.normcase(filename)
|
||||
if newkey == key:
|
||||
return
|
||||
if self.dict.has_key(newkey):
|
||||
if newkey in self.dict:
|
||||
conflict = self.dict[newkey]
|
||||
self.inversedict[conflict] = None
|
||||
tkMessageBox.showerror(
|
||||
|
@ -187,7 +187,7 @@ class _ComplexBinder:
|
||||
seq, handler)))
|
||||
|
||||
def bind(self, triplet, func):
|
||||
if not self.bindedfuncs.has_key(triplet[2]):
|
||||
if triplet[2] not in self.bindedfuncs:
|
||||
self.bindedfuncs[triplet[2]] = [[] for s in _states]
|
||||
for s in _states:
|
||||
lists = [ self.bindedfuncs[detail][i]
|
||||
|
@ -9,7 +9,7 @@ class MultiStatusBar(Frame):
|
||||
self.labels = {}
|
||||
|
||||
def set_label(self, name, text='', side=LEFT):
|
||||
if not self.labels.has_key(name):
|
||||
if name not in self.labels:
|
||||
label = Label(self, bd=1, relief=SUNKEN, anchor=W)
|
||||
label.pack(side=side)
|
||||
self.labels[name] = label
|
||||
|
@ -126,7 +126,7 @@ dispatch = {
|
||||
|
||||
def make_objecttreeitem(labeltext, object, setfunction=None):
|
||||
t = type(object)
|
||||
if dispatch.has_key(t):
|
||||
if t in dispatch:
|
||||
c = dispatch[t]
|
||||
else:
|
||||
c = ObjectTreeItem
|
||||
|
@ -78,7 +78,7 @@ class DirBrowserTreeItem(TreeItem):
|
||||
normed_name = os.path.normcase(name)
|
||||
if normed_name[i:] == suff:
|
||||
mod_name = name[:i]
|
||||
if not modules.has_key(mod_name):
|
||||
if mod_name not in modules:
|
||||
modules[mod_name] = None
|
||||
sorted.append((normed_name, name))
|
||||
allnames.remove(name)
|
||||
|
@ -231,7 +231,7 @@ class FrameProxy:
|
||||
return self._get_dict_proxy(did)
|
||||
|
||||
def _get_dict_proxy(self, did):
|
||||
if self._dictcache.has_key(did):
|
||||
if did in self._dictcache:
|
||||
return self._dictcache[did]
|
||||
dp = DictProxy(self._conn, self._oid, did)
|
||||
self._dictcache[did] = dp
|
||||
|
@ -410,7 +410,7 @@ class FileTreeItem(TreeItem):
|
||||
|
||||
class ScrolledCanvas:
|
||||
def __init__(self, master, **opts):
|
||||
if not opts.has_key('yscrollincrement'):
|
||||
if 'yscrollincrement' not in opts:
|
||||
opts['yscrollincrement'] = 17
|
||||
self.master = master
|
||||
self.frame = Frame(master)
|
||||
|
@ -29,7 +29,7 @@ class WidgetRedirector:
|
||||
tk.call("rename", orig, w)
|
||||
|
||||
def register(self, name, function):
|
||||
if self.dict.has_key(name):
|
||||
if name in self.dict:
|
||||
previous = dict[name]
|
||||
else:
|
||||
previous = OriginalCommand(self, name)
|
||||
@ -38,7 +38,7 @@ class WidgetRedirector:
|
||||
return previous
|
||||
|
||||
def unregister(self, name):
|
||||
if self.dict.has_key(name):
|
||||
if name in self.dict:
|
||||
function = self.dict[name]
|
||||
del self.dict[name]
|
||||
if hasattr(self.widget, name):
|
||||
|
@ -550,7 +550,7 @@ class ConfigDialog(Toplevel):
|
||||
|
||||
def AddChangedItem(self,type,section,item,value):
|
||||
value=str(value) #make sure we use a string
|
||||
if not self.changedItems[type].has_key(section):
|
||||
if section not in self.changedItems[type]:
|
||||
self.changedItems[type][section]={}
|
||||
self.changedItems[type][section][item]=value
|
||||
|
||||
@ -697,7 +697,7 @@ class ConfigDialog(Toplevel):
|
||||
return
|
||||
#remove key set from config
|
||||
idleConf.userCfg['keys'].remove_section(keySetName)
|
||||
if self.changedItems['keys'].has_key(keySetName):
|
||||
if keySetName in self.changedItems['keys']:
|
||||
del(self.changedItems['keys'][keySetName])
|
||||
#write changes
|
||||
idleConf.userCfg['keys'].Save()
|
||||
@ -724,7 +724,7 @@ class ConfigDialog(Toplevel):
|
||||
return
|
||||
#remove theme from config
|
||||
idleConf.userCfg['highlight'].remove_section(themeName)
|
||||
if self.changedItems['highlight'].has_key(themeName):
|
||||
if themeName in self.changedItems['highlight']:
|
||||
del(self.changedItems['highlight'][themeName])
|
||||
#write changes
|
||||
idleConf.userCfg['highlight'].Save()
|
||||
@ -859,9 +859,9 @@ class ConfigDialog(Toplevel):
|
||||
#handle any unsaved changes to this theme
|
||||
if theme in self.changedItems['highlight'].keys():
|
||||
themeDict=self.changedItems['highlight'][theme]
|
||||
if themeDict.has_key(element+'-foreground'):
|
||||
if element+'-foreground' in themeDict:
|
||||
colours['foreground']=themeDict[element+'-foreground']
|
||||
if themeDict.has_key(element+'-background'):
|
||||
if element+'-background' in themeDict:
|
||||
colours['background']=themeDict[element+'-background']
|
||||
self.textHighlightSample.tag_config(element, **colours)
|
||||
self.SetColourSample()
|
||||
|
@ -169,7 +169,7 @@ class SocketIO(object):
|
||||
how, (oid, methodname, args, kwargs) = request
|
||||
except TypeError:
|
||||
return ("ERROR", "Bad request format")
|
||||
if not self.objtable.has_key(oid):
|
||||
if oid not in self.objtable:
|
||||
return ("ERROR", "Unknown object id: %r" % (oid,))
|
||||
obj = self.objtable[oid]
|
||||
if methodname == "__methods__":
|
||||
@ -304,7 +304,7 @@ class SocketIO(object):
|
||||
# wait for notification from socket handling thread
|
||||
cvar = self.cvars[myseq]
|
||||
cvar.acquire()
|
||||
while not self.responses.has_key(myseq):
|
||||
while myseq not in self.responses:
|
||||
cvar.wait()
|
||||
response = self.responses[myseq]
|
||||
self.debug("_getresponse:%s: thread woke up: response: %s" %
|
||||
@ -552,7 +552,7 @@ class RPCProxy(object):
|
||||
return MethodProxy(self.sockio, self.oid, name)
|
||||
if self.__attributes is None:
|
||||
self.__getattributes()
|
||||
if self.__attributes.has_key(name):
|
||||
if name in self.__attributes:
|
||||
value = self.sockio.remotecall(self.oid, '__getattribute__',
|
||||
(name,), {})
|
||||
return value
|
||||
|
Loading…
Reference in New Issue
Block a user