summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
diff options
context:
space:
mode:
authorDmitry Shachnev <mitya57@gmail.com>2014-01-19 14:17:10 +0400
committerDmitry Shachnev <mitya57@gmail.com>2014-01-19 14:17:10 +0400
commitce2185ce279664e54ba22b14663091abc5a3a8f2 (patch)
tree97b00b55be0e28a73399acc0f80e21e6a4e24b28 /sphinx/directives/code.py
parentfa9695dbe0b090eb9907647b7a8d1c20210efa5b (diff)
downloadsphinx-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/directives/code.py')
-rw-r--r--sphinx/directives/code.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index 7b1acfd58..d48da2eee 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -39,7 +39,7 @@ class Highlight(Directive):
except Exception:
linenothreshold = 10
else:
- linenothreshold = sys.maxint
+ linenothreshold = sys.maxsize
return [addnodes.highlightlang(lang=self.arguments[0].strip(),
linenothreshold=linenothreshold)]
@@ -68,7 +68,7 @@ class CodeBlock(Directive):
try:
nlines = len(self.content)
hl_lines = [x+1 for x in parselinenos(linespec, nlines)]
- except ValueError, err:
+ except ValueError as err:
document = self.state.document
return [document.reporter.warning(str(err), line=self.lineno)]
else:
@@ -162,7 +162,7 @@ class LiteralInclude(Directive):
if linespec is not None:
try:
linelist = parselinenos(linespec, len(lines))
- except ValueError, err:
+ except ValueError as err:
return [document.reporter.warning(str(err), line=self.lineno)]
# just ignore nonexisting lines
nlines = len(lines)
@@ -176,7 +176,7 @@ class LiteralInclude(Directive):
if linespec:
try:
hl_lines = [x+1 for x in parselinenos(linespec, len(lines))]
- except ValueError, err:
+ except ValueError as err:
return [document.reporter.warning(str(err), line=self.lineno)]
else:
hl_lines = None