From ad66742e3459addfaf7542808611c7dca254a8fd Mon Sep 17 00:00:00 2001 From: "Kurt B. Kaiser" Date: Thu, 23 Aug 2007 01:06:15 +0000 Subject: 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 --- Lib/idlelib/EditorWindow.py | 6 +++--- Lib/idlelib/IOBinding.py | 2 +- Lib/idlelib/RemoteDebugger.py | 4 ++-- Lib/idlelib/TreeWidget.py | 2 +- Lib/idlelib/configHandler.py | 10 +++++----- Lib/idlelib/rpc.py | 8 ++++---- Lib/idlelib/tabpage.py | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 2d11f90..e051348 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -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) diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index 1be1a21..dd51062 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -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 diff --git a/Lib/idlelib/RemoteDebugger.py b/Lib/idlelib/RemoteDebugger.py index 38583db..11bbc2d 100644 --- a/Lib/idlelib/RemoteDebugger.py +++ b/Lib/idlelib/RemoteDebugger.py @@ -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: diff --git a/Lib/idlelib/TreeWidget.py b/Lib/idlelib/TreeWidget.py index 09cb714..c508410 100644 --- a/Lib/idlelib/TreeWidget.py +++ b/Lib/idlelib/TreeWidget.py @@ -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.""" diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py index 2c9056e..0c88396 100644 --- a/Lib/idlelib/configHandler.py +++ b/Lib/idlelib/configHandler.py @@ -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=';') diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py index c75be10..eb262f4 100644 --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -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, diff --git a/Lib/idlelib/tabpage.py b/Lib/idlelib/tabpage.py index 12f8929..0f7017b 100644 --- a/Lib/idlelib/tabpage.py +++ b/Lib/idlelib/tabpage.py @@ -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() -- cgit v0.12