[gtk-doc] autopep8: cleanup python style



commit c2a0385b8980389cd2b36a76ad2745f2cda67bb1
Author: Stefan Sauer <ensonic users sf net>
Date:   Wed Apr 5 20:27:54 2017 +0200

    autopep8: cleanup python style

 gtkdoc-check.in    |    3 ++-
 gtkdoc-mkhtml.in   |    6 ++++--
 gtkdoc-mkman.in    |    3 ++-
 gtkdoc-mkpdf.in    |    3 ++-
 gtkdoc-rebase.in   |    3 ++-
 gtkdoc-scangobj.in |    4 +++-
 gtkdoc/check.py    |   12 +++++++-----
 gtkdoc/common.py   |    5 +++--
 gtkdoc/mkhtml.py   |    8 ++++++--
 gtkdoc/mkman.py    |    5 ++++-
 gtkdoc/mkpdf.py    |    5 ++++-
 gtkdoc/rebase.py   |   40 ++++++++++++++++++++++------------------
 gtkdoc/scangobj.py |   25 ++++++++++++++++++++-----
 13 files changed, 81 insertions(+), 41 deletions(-)
---
diff --git a/gtkdoc-check.in b/gtkdoc-check.in
index 4a54a96..40da4b6 100755
--- a/gtkdoc-check.in
+++ b/gtkdoc-check.in
@@ -20,7 +20,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
-import argparse, sys
+import argparse
+import sys
 sys.path.append('@PYTHON_PACKAGE_DIR@')
 
 from gtkdoc import check, config
diff --git a/gtkdoc-mkhtml.in b/gtkdoc-mkhtml.in
index 9ee85f4..4ebf8f1 100644
--- a/gtkdoc-mkhtml.in
+++ b/gtkdoc-mkhtml.in
@@ -22,13 +22,15 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
-import argparse, sys
+import argparse
+import sys
 sys.path.append('@PYTHON_PACKAGE_DIR@')
 
 from gtkdoc import config, mkhtml
 
 if __name__ == '__main__':
-    parser = argparse.ArgumentParser(description='gtkdoc-mkhtml version %s - generate documentation in html 
format' % config.version)
+    parser = argparse.ArgumentParser(
+        description='gtkdoc-mkhtml version %s - generate documentation in html format' % config.version)
     parser.add_argument('--version', action='version', version=config.version)
     parser.add_argument('--verbose', default=False, action='store_true',
                         help='Print extra output while processing')
diff --git a/gtkdoc-mkman.in b/gtkdoc-mkman.in
index 32cc032..1fdf1c3 100644
--- a/gtkdoc-mkman.in
+++ b/gtkdoc-mkman.in
@@ -22,7 +22,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
-import argparse, sys
+import argparse
+import sys
 sys.path.append('@PYTHON_PACKAGE_DIR@')
 
 from gtkdoc import config, mkman
diff --git a/gtkdoc-mkpdf.in b/gtkdoc-mkpdf.in
index 7363047..11d9f00 100755
--- a/gtkdoc-mkpdf.in
+++ b/gtkdoc-mkpdf.in
@@ -20,7 +20,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
-import argparse, sys
+import argparse
+import sys
 sys.path.append('@PYTHON_PACKAGE_DIR@')
 
 from gtkdoc import config, mkpdf
diff --git a/gtkdoc-rebase.in b/gtkdoc-rebase.in
index 4ab9d81..1d3cb6b 100755
--- a/gtkdoc-rebase.in
+++ b/gtkdoc-rebase.in
@@ -21,7 +21,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
-import argparse, sys
+import argparse
+import sys
 sys.path.append('@PYTHON_PACKAGE_DIR@')
 
 from gtkdoc import config, rebase
diff --git a/gtkdoc-scangobj.in b/gtkdoc-scangobj.in
index d3d9302..db85c4c 100644
--- a/gtkdoc-scangobj.in
+++ b/gtkdoc-scangobj.in
@@ -20,7 +20,9 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
-import argparse, os, sys
+import argparse
+import os
+import sys
 sys.path.append('@PYTHON_PACKAGE_DIR@')
 
 from gtkdoc import config, scangobj
diff --git a/gtkdoc/check.py b/gtkdoc/check.py
index dbfae48..8acf5d0 100755
--- a/gtkdoc/check.py
+++ b/gtkdoc/check.py
@@ -19,17 +19,19 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
-#############################################################################
+#
 # Script      : gtkdoc-check
 # Description : Runs various checks on built documentation and outputs test
 #                results. Can be run druring make check, by adding this to the
 #                documentations Makefile.am: TESTS = $(GTKDOC_CHECK)
-#############################################################################
+#
 
 # Support both Python 2 and 3
 from __future__ import print_function
 
-import os, re, subprocess
+import os
+import re
+import subprocess
 from glob import glob
 
 
@@ -62,7 +64,7 @@ def check_includes(filename):
             try:
                 next(line for line in lines if include in line)
             except StopIteration:
-                num_missing += 1;
+                num_missing += 1
                 print('%s:1:E: doesn\'t appear to include "%s"' % (filename, xml_file))
 
     return num_missing
@@ -70,7 +72,7 @@ def check_includes(filename):
 
 def get_variable(env, lines, variable):
     value = env.get(variable,
-        grep(r'^\s*' + variable + '\s*=\s*(\S+)', lines, variable))
+                    grep(r'^\s*' + variable + '\s*=\s*(\S+)', lines, variable))
     return value
 
 
diff --git a/gtkdoc/common.py b/gtkdoc/common.py
index 0bfb966..813c356 100644
--- a/gtkdoc/common.py
+++ b/gtkdoc/common.py
@@ -20,7 +20,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
-import logging, os
+import logging
+import os
 
 
 def UpdateFileIfChanged(old_file, new_file, make_backup):
@@ -39,7 +40,7 @@ def UpdateFileIfChanged(old_file, new_file, make_backup):
         bool: It returns False if the file hasn't changed, and True if it has.
     """
 
-    logging.debug("Comparing %s with %s...", old_file, new_file);
+    logging.debug("Comparing %s with %s...", old_file, new_file)
 
     if os.path.exists(old_file):
         old_contents = open(old_file, 'rb').read()
diff --git a/gtkdoc/mkhtml.py b/gtkdoc/mkhtml.py
index 803d16b..5b1e1ad 100644
--- a/gtkdoc/mkhtml.py
+++ b/gtkdoc/mkhtml.py
@@ -25,7 +25,11 @@
 # Support both Python 2 and 3
 from __future__ import print_function
 
-import os, sys, argparse, subprocess, shutil
+import os
+import sys
+import argparse
+import subprocess
+import shutil
 from glob import glob
 
 from . import config
@@ -92,4 +96,4 @@ def run(options):
         shutil.copy(f, '.')
 
     open('../html.stamp', 'w').write('timestamp')
-    return res
\ No newline at end of file
+    return res
diff --git a/gtkdoc/mkman.py b/gtkdoc/mkman.py
index b3fca8f..03536b0 100644
--- a/gtkdoc/mkman.py
+++ b/gtkdoc/mkman.py
@@ -25,7 +25,10 @@
 # Support both Python 2 and 3
 from __future__ import print_function
 
-import os, sys, argparse, subprocess
+import os
+import sys
+import argparse
+import subprocess
 from glob import glob
 
 from . import config
diff --git a/gtkdoc/mkpdf.py b/gtkdoc/mkpdf.py
index abcc5f5..8066fda 100755
--- a/gtkdoc/mkpdf.py
+++ b/gtkdoc/mkpdf.py
@@ -23,7 +23,10 @@
 # Support both Python 2 and 3
 from __future__ import print_function
 
-import os, sys, argparse, subprocess
+import os
+import sys
+import argparse
+import subprocess
 
 from . import config
 
diff --git a/gtkdoc/rebase.py b/gtkdoc/rebase.py
index a32f041..a5ff41e 100755
--- a/gtkdoc/rebase.py
+++ b/gtkdoc/rebase.py
@@ -21,14 +21,17 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
-#############################################################################
+#
 # Script      : gtkdoc-rebase
 # Description : Rebases URI references in installed HTML documentation.
-#############################################################################
+#
 
 from __future__ import print_function
 
-import os, sys, subprocess, re
+import os
+import sys
+import subprocess
+import re
 
 from . import config
 
@@ -71,10 +74,10 @@ def Run(options):
     # Check all other dirs, but skip already scanned dirs ord subdirs of those
 
     for dir in other_dirs:
-        ScanDirectory(dir, options);
+        ScanDirectory(dir, options)
 
     if options.relative:
-        RelativizeLocalMap(options.html_dir, options);
+        RelativizeLocalMap(options.html_dir, options)
 
     RebaseReferences(options.html_dir, options)
     PrintWhatWeHaveDone()
@@ -103,7 +106,7 @@ def ScanDirectory(dir, options):
 
         if entry.endswith('.devhelp2'):
             log(options, "Reading index from " + entry)
-            o = ReadDevhelp(dir, entry);
+            o = ReadDevhelp(dir, entry)
             # Prefer this location over possibly stale index.sgml
             if o is not None:
                 onlinedir = o
@@ -111,7 +114,7 @@ def ScanDirectory(dir, options):
 
         if onlinedir and entry == "index.sgml":
             log(options, "Reading index from index.sgml")
-            onlinedir = ReadIndex(dir, entry);
+            onlinedir = ReadIndex(dir, entry)
             have_index = True
         elif entry == "index.sgml.gz" and not os.path.exists(os.path.join(dir, 'index.sgml')):
             # debian/ubuntu started to compress this as index.sgml.gz :/
@@ -126,11 +129,11 @@ gunzip %d/%s
         # we could consider supporting: gzip module
 
     if have_index:
-        AddMap(dir, onlinedir);
+        AddMap(dir, onlinedir)
 
     # Now recursively scan the subdirectories.
     for subdir in subdirs:
-        ScanDirectory(os.path.join(dir, subdir), options);
+        ScanDirectory(os.path.join(dir, subdir), options)
 
 
 def ReadDevhelp(dir, file):
@@ -166,18 +169,18 @@ def AddMap(dir, onlinerdir, options):
 
     package = os.path.split(dir)[1]
     if options.dest_dir != '' and dir.startswith(options.dest_dir):
-        dir = dir[len(options.dest_dir)-1:]
+        dir = dir[len(options.dest_dir) - 1:]
 
     if onlinedir:
         log(options, "On-line location of %s." % onlinedir)
-        OnlineMap[package] = onlinedir;
-        RevMap[onlinedir] = package;
+        OnlineMap[package] = onlinedir
+        RevMap[onlinedir] = package
     else:
         log(options, "No On-line location for %s found" % package)
 
     log(options,  "Local location of $package: " + dir)
-    LocalMap[package] = dir;
-    RevMap[dir] = package;
+    LocalMap[package] = dir
+    RevMap[dir] = package
 
 
 def RelativizeLocalMap(dirname, options):
@@ -192,6 +195,7 @@ def RelativizeLocalMap(dirname, options):
             LocalMap[package] = dir
             log(options, "Relativizing local location of $package to " + dir)
 
+
 def RebaseReferences(dirname, options):
     for ifile in os.listdir(dirname):
         if ifile.endswith('.html'):
@@ -230,16 +234,16 @@ def RebaseLink(href, options):
                 package = match.groups(1)
             elif options.aggressive:
                 match = re.search(r'''([^/]+)/$''', href)
-                package = match.groups(1);
+                package = match.groups(1)
 
         if package:
             if options.online and package in OnlineMap:
-              dir = OnlineMap[package]
+                dir = OnlineMap[package]
             elif package in LocalMap:
-              dir = LocalMap[package]
+                dir = LocalMap[package]
             href = os.path.join(dir, file)
         else:
-          log(options, "Can't determine package for '%s'" % href);
+            log(options, "Can't determine package for '%s'" % href)
 
         if dir != origdir:
             if origdir in Mapped:
diff --git a/gtkdoc/scangobj.py b/gtkdoc/scangobj.py
index e7df3e5..45bf1dd 100644
--- a/gtkdoc/scangobj.py
+++ b/gtkdoc/scangobj.py
@@ -20,16 +20,21 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
-#############################################################################
+#
 # This gets information about object hierarchies and signals
 # by compiling a small C program. CFLAGS and LDFLAGS must be
 # set appropriately before running this script.
-#############################################################################
+#
 
 
 from __future__ import print_function
 
-import logging, os, re, string, subprocess, sys
+import logging
+import os
+import re
+import string
+import subprocess
+import sys
 
 from . import common, config
 
@@ -1130,8 +1135,18 @@ output_object_args (FILE *fp, GType object_type)
       type_desc = describe_type (spec);
       default_value = describe_default (spec);
       type_name = get_type_name (spec->value_type, &is_pointer);
-      fprintf (fp, 
"<ARG>\\n<NAME>%s::%s</NAME>\\n<TYPE>%s%s</TYPE>\\n<RANGE>%s</RANGE>\\n<FLAGS>%s</FLAGS>\\n<NICK>%s</NICK>\\n<BLURB>%s%s</BLURB>\\n<DEFAULT>%s</DEFAULT>\\n</ARG>\\n\\n",
-               object_class_name, g_param_spec_get_name (spec), type_name, is_pointer ? "*" : "", type_desc, 
flags, nick ? nick : "(null)", blurb ? blurb : "(null)", dot, default_value);
+      fprintf (fp, "<ARG>\\n"
+                   "<NAME>%s::%s</NAME>\\n"
+                   "<TYPE>%s%s</TYPE>\\n"
+                   "<RANGE>%s</RANGE>\\n"
+                   "<FLAGS>%s</FLAGS>\\n"
+                   "<NICK>%s</NICK>\\n"
+                   "<BLURB>%s%s</BLURB>\\n"
+                   "<DEFAULT>%s</DEFAULT>\\n"
+                   "</ARG>\\n\\n",
+               object_class_name, g_param_spec_get_name (spec), type_name,
+               is_pointer ? "*" : "", type_desc, flags, nick ? nick : "(null)",
+               blurb ? blurb : "(null)", dot, default_value);
       g_free (type_desc);
       g_free (default_value);
     }


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