diff options
author | Dmitry Shachnev <mitya57@gmail.com> | 2014-01-19 14:17:10 +0400 |
---|---|---|
committer | Dmitry Shachnev <mitya57@gmail.com> | 2014-01-19 14:17:10 +0400 |
commit | ce2185ce279664e54ba22b14663091abc5a3a8f2 (patch) | |
tree | 97b00b55be0e28a73399acc0f80e21e6a4e24b28 /sphinx/ext/autodoc.py | |
parent | fa9695dbe0b090eb9907647b7a8d1c20210efa5b (diff) | |
download | sphinx-git-ce2185ce279664e54ba22b14663091abc5a3a8f2.tar.gz |
Modernize the code now that Python 2.5 is no longer supported
- Use print function instead of print statement;
- Use new exception handling;
- Use in operator instead of has_key();
- Do not use tuple arguments in functions;
- Other miscellaneous improvements.
This is based on output of `futurize --stage1`, with some
manual corrections.
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r-- | sphinx/ext/autodoc.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 571f36cbe..791961b90 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -411,7 +411,7 @@ class Documenter(object): # try to introspect the signature try: args = self.format_args() - except Exception, err: + except Exception as err: self.directive.warn('error while formatting arguments for ' '%s: %s' % (self.fullname, err)) args = None @@ -731,7 +731,7 @@ class Documenter(object): # parse right now, to get PycodeErrors on parsing (results will # be cached anyway) self.analyzer.find_attr_docs() - except PycodeError, err: + except PycodeError as err: self.env.app.debug('[autodoc] module analyzer failed: %s', err) # no source file -- e.g. for builtin and C modules self.analyzer = None @@ -1197,7 +1197,7 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter): ret = ClassLevelDocumenter.import_object(self) if isinstance(self.object, classmethod) or \ (isinstance(self.object, MethodType) and - self.object.im_self is not None): + self.object.__self__ is not None): self.directivetype = 'classmethod' # document class and static members before ordinary ones self.member_order = self.member_order - 1 @@ -1389,7 +1389,7 @@ class AutoDirective(Directive): try: self.genopt = Options(assemble_option_dict( self.options.items(), doc_class.option_spec)) - except (KeyError, ValueError, TypeError), err: + except (KeyError, ValueError, TypeError) as err: # an option is either unknown or has a wrong type msg = self.reporter.error('An option to %s is either unknown or ' 'has an invalid value: %s' % (self.name, err), |