|
32 | 32 |
|
33 | 33 | """ |
34 | 34 |
|
35 | | -import codecs |
36 | 35 | import os |
| 36 | +import re |
37 | 37 | import subprocess |
38 | 38 | import sys |
39 | | -import re |
40 | 39 |
|
41 | | -from docutils import nodes, statemachine |
| 40 | +from docutils import nodes |
42 | 41 | from docutils.statemachine import ViewList |
43 | 42 | from docutils.parsers.rst import directives, Directive |
44 | | -from docutils.utils.error_reporting import ErrorString |
45 | 43 | from sphinx.util.docutils import switch_source_input |
46 | 44 | from sphinx.util import logging |
47 | 45 |
|
48 | | -__version__ = '1.0' |
| 46 | +__version__ = "1.0" |
| 47 | + |
49 | 48 |
|
50 | 49 | def setup(app): |
51 | 50 |
|
52 | 51 | app.add_directive("kernel-abi", KernelCmd) |
53 | | - return dict( |
54 | | - version = __version__ |
55 | | - , parallel_read_safe = True |
56 | | - , parallel_write_safe = True |
57 | | - ) |
| 52 | + return { |
| 53 | + "version": __version__, |
| 54 | + "parallel_read_safe": True, |
| 55 | + "parallel_write_safe": True |
| 56 | + } |
58 | 57 |
|
59 | | -class KernelCmd(Directive): |
60 | 58 |
|
| 59 | +class KernelCmd(Directive): |
61 | 60 | u"""KernelABI (``kernel-abi``) directive""" |
62 | 61 |
|
63 | 62 | required_arguments = 1 |
@@ -99,8 +98,8 @@ def nestedParse(self, lines, fname): |
99 | 98 |
|
100 | 99 | if "debug" in self.options: |
101 | 100 | code_block = "\n\n.. code-block:: rst\n :linenos:\n" |
102 | | - for l in lines.split("\n"): |
103 | | - code_block += "\n " + l |
| 101 | + for line in lines.split("\n"): |
| 102 | + code_block += "\n " + line |
104 | 103 | lines = code_block + "\n\n" |
105 | 104 |
|
106 | 105 | line_regex = re.compile(r"^\.\. LINENO (\S+)\#([0-9]+)$") |
|
0 commit comments