Commit ad66742e authored by Kurt B. Kaiser's avatar Kurt B. Kaiser

Fix raise with 2to3

M    idlelib/configHandler.py
M    idlelib/tabpage.py
M    idlelib/EditorWindow.py
M    idlelib/rpc.py
M    idlelib/IOBinding.py
M    idlelib/RemoteDebugger.py
M    idlelib/TreeWidget.py
parent e45be28b
......@@ -38,7 +38,7 @@ def _find_module(fullname, path=None):
try:
path = module.__path__
except AttributeError:
raise ImportError, 'No source for module ' + module.__name__
raise ImportError('No source for module ' + module.__name__)
return file, filename, descr
class EditorWindow(object):
......@@ -955,14 +955,14 @@ class EditorWindow(object):
value = var.get()
return value
else:
raise NameError, name
raise NameError(name)
def setvar(self, name, value, vartype=None):
var = self.get_var_obj(name, vartype)
if var:
var.set(value)
else:
raise NameError, name
raise NameError(name)
def get_var_obj(self, name, vartype=None):
var = self.tkinter_vars.get(name)
......
......@@ -132,7 +132,7 @@ def coding_spec(str):
codecs.lookup(name)
except LookupError:
# The standard encoding error does not indicate the encoding
raise LookupError, "Unknown encoding "+name
raise LookupError("Unknown encoding "+name)
return name
......
......@@ -206,7 +206,7 @@ class FrameProxy:
def __getattr__(self, name):
if name[:1] == "_":
raise AttributeError, name
raise AttributeError(name)
if name == "f_code":
return self._get_f_code()
if name == "f_globals":
......@@ -270,7 +270,7 @@ class DictProxy:
def __getattr__(self, name):
##print >>sys.__stderr__, "failed DictProxy.__getattr__:", name
raise AttributeError, name
raise AttributeError(name)
class GUIAdapter:
......
......@@ -32,7 +32,7 @@ except NameError:
if os.path.isdir(_icondir):
ICONDIR = _icondir
elif not os.path.isdir(ICONDIR):
raise RuntimeError, "can't find icon directory (%r)" % (ICONDIR,)
raise RuntimeError("can't find icon directory (%r)" % (ICONDIR,))
def listicons(icondir=ICONDIR):
"""Utility to display the available icons."""
......
......@@ -259,13 +259,13 @@ class IdleConf:
configType must be one of ('main','extensions','highlight','keys')
"""
if not (configType in ('main','extensions','highlight','keys')):
raise InvalidConfigType, 'Invalid configType specified'
raise InvalidConfigType('Invalid configType specified')
if configSet == 'user':
cfgParser=self.userCfg[configType]
elif configSet == 'default':
cfgParser=self.defaultCfg[configType]
else:
raise InvalidConfigSet, 'Invalid configSet specified'
raise InvalidConfigSet('Invalid configSet specified')
return cfgParser.sections()
def GetHighlight(self, theme, element, fgBg=None):
......@@ -293,7 +293,7 @@ class IdleConf:
if fgBg == 'bg':
return highlight["background"]
else:
raise InvalidFgBg, 'Invalid fgBg specified'
raise InvalidFgBg('Invalid fgBg specified')
def GetThemeDict(self,type,themeName):
"""
......@@ -309,7 +309,7 @@ class IdleConf:
elif type == 'default':
cfgParser=self.defaultCfg['highlight']
else:
raise InvalidTheme, 'Invalid theme type specified'
raise InvalidTheme('Invalid theme type specified')
#foreground and background values are provded for each theme element
#(apart from cursor) even though all these values are not yet used
#by idle, to allow for their use in the future. Default values are
......@@ -624,7 +624,7 @@ class IdleConf:
elif configSet=='default':
cfgParser=self.defaultCfg['main']
else:
raise InvalidConfigSet, 'Invalid configSet specified'
raise InvalidConfigSet('Invalid configSet specified')
options=cfgParser.GetOptionList('HelpFiles')
for option in options:
value=cfgParser.Get('HelpFiles',option,default=';')
......
......@@ -256,8 +256,8 @@ class SocketIO(object):
return None
if how == "ERROR":
self.debug("decoderesponse: Internal ERROR:", what)
raise RuntimeError, what
raise SystemError, (how, what)
raise RuntimeError(what)
raise SystemError(how, what)
def decode_interrupthook(self):
""
......@@ -331,7 +331,7 @@ class SocketIO(object):
r, w, x = select.select([], [self.sock], [])
n = self.sock.send(s[:BUFSIZE])
except (AttributeError, TypeError):
raise IOError, "socket no longer exists"
raise IOError("socket no longer exists")
except socket.error:
raise
else:
......@@ -557,7 +557,7 @@ class RPCProxy(object):
(name,), {})
return value
else:
raise AttributeError, name
raise AttributeError(name)
def __getattributes(self):
self.__attributes = self.sockio.remotecall(self.oid,
......
......@@ -46,7 +46,7 @@ class TabPageSet(Frame):
if pageName in self.pages.keys():
self.activePage.set(pageName)
else:
raise InvalidTabPage, 'Invalid TabPage Name'
raise InvalidTabPage('Invalid TabPage Name')
## pop up the active 'tab' only
for page in self.pages.keys():
self.pages[page]['tab'].config(relief=RIDGE)
......@@ -59,7 +59,7 @@ class TabPageSet(Frame):
def AddPage(self,pageName):
if pageName in self.pages.keys():
raise AlreadyExists, 'TabPage Name Already Exists'
raise AlreadyExists('TabPage Name Already Exists')
self.pages[pageName]={'tab':PageTab(self.tabBar),
'page':Frame(self,borderwidth=2,relief=RAISED)}
self.pages[pageName]['tab'].button.config(text=pageName,
......@@ -74,7 +74,7 @@ class TabPageSet(Frame):
def RemovePage(self,pageName):
if not pageName in self.pages.keys():
raise InvalidTabPage, 'Invalid TabPage Name'
raise InvalidTabPage('Invalid TabPage Name')
self.pages[pageName]['tab'].pack_forget()
self.pages[pageName]['page'].grid_forget()
self.pages[pageName]['tab'].destroy()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment