[gtk-doc] gtkdoc: apply pyflakes fixes



commit a7abf5f0df039d2f325cf388c31569a0e64acef8
Author: Stefan Sauer <ensonic users sf net>
Date:   Mon Apr 1 22:17:48 2019 +0200

    gtkdoc: apply pyflakes fixes

 gtkdoc/check.py   |  2 --
 gtkdoc/fixxref.py | 12 ++++++------
 gtkdoc/mkdb.py    |  4 ++--
 gtkdoc/mkhtml2.py |  2 +-
 gtkdoc/mkman.py   |  1 +
 gtkdoc/rebase.py  |  1 -
 6 files changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/gtkdoc/check.py b/gtkdoc/check.py
index 5658fb7..c2815ac 100755
--- a/gtkdoc/check.py
+++ b/gtkdoc/check.py
@@ -29,8 +29,6 @@ import os
 import re
 from glob import glob
 
-from . import common
-
 
 class FileFormatError(Exception):
     pass
diff --git a/gtkdoc/fixxref.py b/gtkdoc/fixxref.py
index c8f03b7..21ee962 100755
--- a/gtkdoc/fixxref.py
+++ b/gtkdoc/fixxref.py
@@ -412,8 +412,8 @@ def HighlightSourceVim(src_lang, type, source):
     try:
         temp_source_file = HighlightSourcePreProcess(f, source)
         if os.name == 'nt':
-          temp_source_file = temp_source_file.replace ('\\', '/')
-        f.close ()
+            temp_source_file = temp_source_file.replace('\\', '/')
+        f.close()
 
         # format source
         script = "echo 'let html_number_lines=0|" + \
@@ -427,16 +427,16 @@ def HighlightSourceVim(src_lang, type, source):
                  "run! syntax/2html.vim|" + \
                  "w! {}.html|".format(temp_source_file) + \
                  "qa' | " + \
-                 "{} -n -e -u NONE -T xterm".format (config.highlight)
-        p = subprocess.Popen([os.getenv ('SHELL', 'sh')], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
-        output = p.communicate(script.encode ('utf-8'))
+                 "{} -n -e -u NONE -T xterm".format(config.highlight)
+        p = subprocess.Popen([os.getenv('SHELL', 'sh')], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+        p.communicate(script.encode('utf-8'))
         if p.returncode != 0:
             raise Exception("Highlighter failed. The command was: {}".format(script))
 
         html_filename = temp_source_file + ".html"
         try:
             with open(html_filename, 'rb') as html_file:
-                highlighted_source = html_file.read().decode ('utf-8')
+                highlighted_source = html_file.read().decode('utf-8')
             highlighted_source = re.sub(r'.*<pre\b[^>]*>\n', '', highlighted_source, flags=re.DOTALL)
             highlighted_source = re.sub(r'</pre>.*', '', highlighted_source, flags=re.DOTALL)
 
diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py
index e4457d7..903e866 100644
--- a/gtkdoc/mkdb.py
+++ b/gtkdoc/mkdb.py
@@ -2791,7 +2791,7 @@ def ExpandAbbreviationsCallback2(text, symbol, tag):
         text = re.sub(r'#(\w+)', lambda m: '%s;' % MakeHashXRef(m.group(1), ''), text)
     elif tag == "<![CDATA[":
         # NOTE: this is a fallback. It is normally done by the Markdown parser.
-        text = ReplaceEntities(text, symbol)
+        text = md_to_db.ReplaceEntities(text, symbol)
 
     return text
 
@@ -3879,7 +3879,7 @@ def ParseCommentBlock(lines, line_number=0, ifile=''):
         # We must be in the middle of a parameter description, so add it on
         # to the last element in @params.
         if not param_name:
-            common.LogWarning(file, line_number, "Parsing comment block file : parameter expected, but got 
'%s'" % line)
+            common.LogWarning(ifile, line_number, "Parsing comment block file : parameter expected, but got 
'%s'" % line)
         else:
             params[param_name] += line
 
diff --git a/gtkdoc/mkhtml2.py b/gtkdoc/mkhtml2.py
index 4d04ec2..c663202 100644
--- a/gtkdoc/mkhtml2.py
+++ b/gtkdoc/mkhtml2.py
@@ -96,7 +96,6 @@ cd tests/bugs/docs/;
 rm html-build.stamp; time make html-build.stamp
 """
 
-import argparse
 import logging
 import os
 import shutil
@@ -108,6 +107,7 @@ from glob import glob
 from lxml import etree
 from pygments import highlight
 from pygments.lexers import CLexer
+from pygments.lexers import get_lexer_by_name
 from pygments.formatters import HtmlFormatter
 from timeit import default_timer as timer
 
diff --git a/gtkdoc/mkman.py b/gtkdoc/mkman.py
index cc4deb3..f1725f5 100644
--- a/gtkdoc/mkman.py
+++ b/gtkdoc/mkman.py
@@ -21,6 +21,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
+import logging
 import subprocess
 
 from . import config
diff --git a/gtkdoc/rebase.py b/gtkdoc/rebase.py
index 0cefed0..31a9b4f 100755
--- a/gtkdoc/rebase.py
+++ b/gtkdoc/rebase.py
@@ -27,7 +27,6 @@ The rebase tool rewrites URI references in installed HTML documentation.
 import logging
 import os
 import re
-import subprocess
 
 from . import common
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]