From 90c0a4e83368c3a4dcf56c45705f491bb386c29c 2012-07-01 16:20:52 From: Matthias BUSSONNIER Date: 2012-07-01 16:20:52 Subject: [PATCH] fix more exeptions 2to3 makes a better job than regexp --- diff --git a/docs/sphinxext/docscrape.py b/docs/sphinxext/docscrape.py index 3999cc9..57160d5 100644 --- a/docs/sphinxext/docscrape.py +++ b/docs/sphinxext/docscrape.py @@ -413,7 +413,7 @@ class FunctionDoc(NumpyDocString): doc = inspect.getdoc(func) or '' try: NumpyDocString.__init__(self, doc) - except ValueError, e: + except ValueError as e: print '*'*78 print "ERROR: '%s' while parsing `%s`" % (e, self._f) print '*'*78 @@ -429,7 +429,7 @@ class FunctionDoc(NumpyDocString): argspec = inspect.formatargspec(*argspec) argspec = argspec.replace('*','\*') signature = '%s%s' % (func_name, argspec) - except TypeError, e: + except TypeError as e: signature = '%s()' % func_name self['Signature'] = signature diff --git a/docs/sphinxext/github.py b/docs/sphinxext/github.py index d6215e6..519e146 100644 --- a/docs/sphinxext/github.py +++ b/docs/sphinxext/github.py @@ -36,7 +36,7 @@ def make_link_node(rawtext, app, type, slug, options): raise AttributeError if not base.endswith('/'): base += '/' - except AttributeError, err: + except AttributeError as err: raise ValueError('github_project_url configuration value is not set (%s)' % str(err)) ref = base + type + '/' + slug + '/' @@ -133,7 +133,7 @@ def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]): raise AttributeError if not base.endswith('/'): base += '/' - except AttributeError, err: + except AttributeError as err: raise ValueError('github_project_url configuration value is not set (%s)' % str(err)) ref = base + text diff --git a/docs/sphinxext/inheritance_diagram.py b/docs/sphinxext/inheritance_diagram.py index 407fc13..ebcbd75 100644 --- a/docs/sphinxext/inheritance_diagram.py +++ b/docs/sphinxext/inheritance_diagram.py @@ -380,7 +380,7 @@ def visit_inheritance_diagram(inner_func): def visitor(self, node): try: content = inner_func(self, node) - except DotException, e: + except DotException as e: # Insert the exception as a warning in the document warning = self.document.reporter.warning(str(e), line=node.line) warning.parent = node