summaryrefslogtreecommitdiffstats
path: root/doxygen/siphon
diff options
context:
space:
mode:
Diffstat (limited to 'doxygen/siphon')
-rw-r--r--doxygen/siphon/__init__.py14
-rw-r--r--doxygen/siphon/generate.py6
-rw-r--r--doxygen/siphon/generate_clicmd.py4
-rw-r--r--doxygen/siphon/generate_syscfg.py4
-rw-r--r--doxygen/siphon/process.py50
-rw-r--r--doxygen/siphon/process_clicmd.py4
-rw-r--r--doxygen/siphon/process_syscfg.py3
7 files changed, 49 insertions, 36 deletions
diff --git a/doxygen/siphon/__init__.py b/doxygen/siphon/__init__.py
index 437a1df1597..f6417314d82 100644
--- a/doxygen/siphon/__init__.py
+++ b/doxygen/siphon/__init__.py
@@ -14,11 +14,11 @@
# Siphon classes
-import generate
-import generate_clicmd
-import generate_syscfg
+from . import generate
+from . import generate_clicmd
+from . import generate_syscfg
-import parsers
-import process
-import process_clicmd
-import process_syscfg
+from . import parsers
+from . import process
+from . import process_clicmd
+from . import process_syscfg
diff --git a/doxygen/siphon/generate.py b/doxygen/siphon/generate.py
index d6b6faf34f7..2ae5a1b6f1b 100644
--- a/doxygen/siphon/generate.py
+++ b/doxygen/siphon/generate.py
@@ -14,12 +14,14 @@
# Generate .siphon source fragments for later processing
+import json
import logging
-import os, sys, re, json
+import os
+import re
"""List of (regexp, siphon_name) tuples for matching the start of C
initializer blocks in source files. Each siphon class registers
- themselves on tihs list."""
+ themselves on this list."""
siphon_patterns = []
class Generate(object):
diff --git a/doxygen/siphon/generate_clicmd.py b/doxygen/siphon/generate_clicmd.py
index 7b13111028d..6d24aaf4926 100644
--- a/doxygen/siphon/generate_clicmd.py
+++ b/doxygen/siphon/generate_clicmd.py
@@ -12,7 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import generate, re
+import re
+
+from . import generate
# Register our regexp
generate.siphon_patterns.append((
diff --git a/doxygen/siphon/generate_syscfg.py b/doxygen/siphon/generate_syscfg.py
index c77936a9dc8..52c802e5752 100644
--- a/doxygen/siphon/generate_syscfg.py
+++ b/doxygen/siphon/generate_syscfg.py
@@ -12,7 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import generate, re
+import re
+
+from . import generate
# Register our regexp
generate.siphon_patterns.append((
diff --git a/doxygen/siphon/process.py b/doxygen/siphon/process.py
index f3119ea89e8..57e323e48ac 100644
--- a/doxygen/siphon/process.py
+++ b/doxygen/siphon/process.py
@@ -14,7 +14,13 @@
# Generation template class
-import logging, os,sys, cgi, json, jinja2, HTMLParser
+import html.parser
+import json
+import logging
+import os
+import sys
+
+import jinja2
# Classes register themselves in this dictionary
"""Mapping of known processors to their classes"""
@@ -24,8 +30,8 @@ siphons = {}
formats = {}
-"""Generate rendered output for siphoned data."""
class Siphon(object):
+ """Generate rendered output for siphoned data."""
# Set by subclasses
"""Our siphon name"""
@@ -79,12 +85,11 @@ class Siphon(object):
keep_trailing_newline=True)
# Convenience, get a reference to the internal escape and
- # unescape methods in cgi and HTMLParser. These then become
+ # unescape methods in html.parser. These then become
# available to templates to use, if needed.
- self._h = HTMLParser.HTMLParser()
- self.escape = cgi.escape
- self.unescape = self._h.unescape
-
+ self._h = html.parser.HTMLParser()
+ self.escape = html.escape
+ self.unescape = html.unescape
# Output renderers
@@ -168,12 +173,11 @@ class Siphon(object):
"""Template processor"""
def template(self, name, **kwargs):
- tpl = self._tplenv.get_template(name + self._format.extension)
- return tpl.render(
+ tpl = self._tplenv.get_template(name + self._format.extension)
+ return tpl.render(
this=self,
**kwargs)
-
# Processing methods
"""Parse the input file into a more usable dictionary structure."""
@@ -196,11 +200,11 @@ class Siphon(object):
for item in data["items"]:
try:
o = self._parser.parse(item['block'])
- except:
- self.log.error("Exception parsing item: %s\n%s" \
- % (json.dumps(item, separators=(',', ': '),
- indent=4),
- item['block']))
+ except Exception:
+ self.log.error("Exception parsing item: %s\n%s"
+ % (json.dumps(item, separators=(',', ': '),
+ indent=4),
+ item['block']))
raise
# Augment the item with metadata
@@ -247,8 +251,8 @@ class Siphon(object):
if group.startswith('_'):
continue
- self.log.info("Processing items in group \"%s\" (%s)." % \
- (group, group_sort_key(group)))
+ self.log.info("Processing items in group \"%s\" (%s)." %
+ (group, group_sort_key(group)))
# Generate the section index entry (write it now)
out.write(self.index_section(group))
@@ -260,8 +264,8 @@ class Siphon(object):
return self.item_sort_key(self._cmds[group][key])
for key in sorted(self._cmds[group].keys(), key=item_sort_key):
- self.log.debug("--- Processing key \"%s\" (%s)." % \
- (key, item_sort_key(key)))
+ self.log.debug("--- Processing key \"%s\" (%s)." %
+ (key, item_sort_key(key)))
o = self._cmds[group][key]
meta = {
@@ -283,8 +287,8 @@ class Siphon(object):
out.write(contents)
-"""Output format class"""
class Format(object):
+ """Output format class"""
"""Name of this output format"""
name = None
@@ -293,19 +297,21 @@ class Format(object):
extension = None
-"""Markdown output format"""
class FormatMarkdown(Format):
+ """Markdown output format"""
name = "markdown"
extension = ".md"
+
# Register 'markdown'
formats["markdown"] = FormatMarkdown
-"""Itemlist output format"""
class FormatItemlist(Format):
+ """Itemlist output format"""
name = "itemlist"
extension = ".itemlist"
+
# Register 'itemlist'
formats["itemlist"] = FormatItemlist
diff --git a/doxygen/siphon/process_clicmd.py b/doxygen/siphon/process_clicmd.py
index 9b3bd35c86d..231c7a7cfac 100644
--- a/doxygen/siphon/process_clicmd.py
+++ b/doxygen/siphon/process_clicmd.py
@@ -14,7 +14,8 @@
# Generate clicmd formatted output
-import process, parsers
+from . import process, parsers
+
class SiphonCLICMD(process.Siphon):
@@ -25,7 +26,6 @@ class SiphonCLICMD(process.Siphon):
super(SiphonCLICMD, self).__init__(*args, **kwargs)
self._parser = parsers.MacroInitializer()
-
# Output renderers
def index_sort_key(self, group):
diff --git a/doxygen/siphon/process_syscfg.py b/doxygen/siphon/process_syscfg.py
index 94be591039d..bccde2c153d 100644
--- a/doxygen/siphon/process_syscfg.py
+++ b/doxygen/siphon/process_syscfg.py
@@ -14,7 +14,8 @@
# Generate syscfg formatted output
-import process, parsers
+from . import process, parsers
+
class SiphonSYSCFG(process.Siphon):