diff --git a/autogenerate-config-docs/autohelp.py b/autogenerate-config-docs/autohelp.py
index 5b6e0e5e..2263025e 100755
--- a/autogenerate-config-docs/autohelp.py
+++ b/autogenerate-config-docs/autohelp.py
@@ -6,7 +6,6 @@
# For an example of usage, run this program with the -h switch.
#
-import os
import sys
# this is for the internationalisation function in gettext
@@ -54,7 +53,7 @@ def main(action, file, format, repo, verbose=0, name=False, test=False):
sys.exit(0)
-if __name__ == "__main__":
+if __name__ == "__main__":
args = common.parse_me_args()
main(args['action'],
args['file'],
diff --git a/autogenerate-config-docs/common.py b/autogenerate-config-docs/common.py
index 5ff8aa39..f691af56 100644
--- a/autogenerate-config-docs/common.py
+++ b/autogenerate-config-docs/common.py
@@ -7,7 +7,6 @@ from oslo.config import cfg
import os
import string
import sys
-import pkgutil
import glob
from collections import defaultdict
from xml.sax.saxutils import escape
@@ -64,15 +63,20 @@ def extract_flags(repo_location, module_name, verbose=0, names_only=True):
for root, dirs, files in os.walk(module_location + '/' + module_name):
for name in dirs:
abs_path = os.path.join(root.split(module_location)[1][1:], name)
- if ('/tests' not in abs_path and '/locale' not in abs_path and
- '/cmd' not in abs_path and '/db/migration' not in abs_path and
- '/transfer' not in abs_path):
- usable_dirs.append(os.path.join(root.split(module_location)[1][1:], name))
+ if ('/tests' not in abs_path and
+ '/locale' not in abs_path and
+ '/cmd' not in abs_path and
+ '/db/migration' not in abs_path and
+ '/transfer' not in abs_path):
+ usable_dirs.append(os.path.join(root.split(module_location)
+ [1][1:], name))
for directory in usable_dirs:
- for python_file in glob.glob(module_location + '/' + directory + "/*.py"):
+ for python_file in glob.glob(module_location + '/' + directory
+ + "/*.py"):
if '__init__' not in python_file:
- usable_dirs.append(os.path.splitext(python_file)[0][len(module_location) + 1:])
+ usable_dirs.append(os.path.splitext(python_file)
+ [0][len(module_location) + 1:])
package_name = directory.replace('/', '.')
try:
@@ -112,20 +116,24 @@ def extract_flags_test(repo_loc, module, verbose=0):
TEST TEST TEST TEST TEST TEST
"""
flag_data = {}
- flag_files = []
usable_dirs = []
module_location = os.path.dirname(repo_loc + '/' + module)
for root, dirs, files in os.walk(module_location + '/' + module):
for name in dirs:
abs_path = os.path.join(root.split(module_location)[1][1:], name)
- if ('/tests' not in abs_path and '/locale' not in abs_path and
- '/cmd' not in abs_path and '/db/migration' not in abs_path):
- usable_dirs.append(os.path.join(root.split(module_location)[1][1:], name))
+ if ('/tests' not in abs_path and
+ '/locale' not in abs_path and
+ '/cmd' not in abs_path and
+ '/db/migration' not in abs_path):
+ usable_dirs.append(os.path.join(root.split(module_location)
+ [1][1:], name))
for directory in usable_dirs:
- for python_file in glob.glob(module_location + '/' + directory + "/*.py"):
+ for python_file in glob.glob(module_location + '/' + directory +
+ "/*.py"):
if '__init__' not in python_file:
- usable_dirs.append(os.path.splitext(python_file)[0][len(module_location) + 1:])
+ usable_dirs.append(os.path.splitext(python_file)[0]
+ [len(module_location) + 1:])
package_name = directory.replace('/', '.')
try:
@@ -165,7 +173,7 @@ def write_test(file, repo_dir, pkg_name):
print "\n -- end file name area --\n"
print len(flag_info)
for name, value in flag_info:
- opt = value['opt']
+ #opt = value['opt']
#print type(opt)
#print opt
#print name
@@ -183,7 +191,9 @@ def write_header(filepath, verbose=0):
def write_buffer(file, flags, verbose=0):
"""
- Write flag data to file. (The header is written with the write_header function.)
+ Write flag data to file.
+
+ Note that the header is written with the write_header function.
"""
pass
#with open(os.path.expanduser(filepath), 'wb') as f:
@@ -253,7 +263,8 @@ def write_docbook(directory, flags, groups, package_name, verbose=0):
opt = flag[1]["opt"]
if not opt.help:
opt.help = "No help text available for this option"
- if type(opt).__name__ == "ListOpt" and opt.default is not None:
+ if (type(opt).__name__ == "ListOpt" and
+ opt.default is not None):
opt.default = ",".join(opt.default)
groups_file.write('\n
\n\
' + flag_name + '=' + str(opt.default) + ' | \n\
diff --git a/autogenerate-config-docs/extract_swift_flags.py b/autogenerate-config-docs/extract_swift_flags.py
index 9e3440b9..c208a9aa 100644
--- a/autogenerate-config-docs/extract_swift_flags.py
+++ b/autogenerate-config-docs/extract_swift_flags.py
@@ -80,33 +80,37 @@ def extract_descriptions_from_devref(repo, options):
+ ' ' + line.strip())
for option in options:
line_parts = line.strip().split(None, 2)
- if (' ' in line and len(line_parts) == 3
- and option == line_parts[0]
- and line_parts[1] != '=' and option != 'use'
- and (option not in option_descs or
+ if (' ' in line and
+ len(line_parts) == 3 and
+ option == line_parts[0] and
+ line_parts[1] != '=' and
+ option != 'use' and
+ (option not in option_descs or
len(option_descs[option]) < len(line_parts[2]))):
- option_descs[option] = line_parts[2]
- prev_option = option
+ option_descs[option] = line_parts[2]
+ prev_option = option
return option_descs
def new_section_file(sample, current_section):
- section_filename = ('swift-' +
- path.basename(sample).split('.conf')[0]
- + '-'
- + current_section.replace('[', '').replace(']', '').replace(':', '-')
- + '.xml')
- section_file = open(section_filename, 'w')
- section_file.write('\n\
+ section_filename = ('swift-' +
+ path.basename(sample).split('.conf')[0]
+ + '-'
+ + current_section.replace('[', '').
+ replace(']', '').replace(':', '-')
+ + '.xml')
+ section_file = open(section_filename, 'w')
+ section_file.write('\n\
\n\
\n\
\n\
Description of configuration options for '
- + current_section + ' in ' + path.basename(sample) +
- '\n\
- \n\
+ + current_section + ' in '
+ + path.basename(sample) +
+ '\n\
+ \n\
\n\
\n\
\n\
@@ -115,7 +119,7 @@ def new_section_file(sample, current_section):
\n\
\n\
')
- return section_file
+ return section_file
def create_new_tables(repo, verbose):
@@ -159,10 +163,12 @@ def create_new_tables(repo, verbose):
if (parsed_line[0] in options.keys()
and 'No help text' not in options[parsed_line[0]]):
# use the help text from existing tables
- option_desc = options[parsed_line[0]].replace(u'\xa0', u' ')
+ option_desc = options[parsed_line[0]].replace(u'\xa0',
+ u' ')
elif parsed_line[0] in option_descs:
# use the help text from the devref
- option_desc = option_descs[parsed_line[0]].replace(u'\xa0', u' ')
+ option_desc = option_descs[parsed_line[0]].replace(
+ u'\xa0', u' ')
else:
option_desc = 'No help text available for this option'
if verbose > 0:
@@ -187,5 +193,5 @@ def main(repo, verbose=0):
create_new_tables(repo, verbose)
-if __name__ == "__main__":
+if __name__ == "__main__":
main(sys.argv[1])
diff --git a/autogenerate-config-docs/test/generator.py b/autogenerate-config-docs/test/generator.py
index ca26ce9e..ef761bac 100755
--- a/autogenerate-config-docs/test/generator.py
+++ b/autogenerate-config-docs/test/generator.py
@@ -35,7 +35,7 @@ import textwrap
from oslo.config import cfg
-from openstack.common import gettextutils
+#from openstack.common import gettextutils
from openstack.common import importutils
# sld
diff --git a/cleanup/remove_unnecessary_spaces.py b/cleanup/remove_unnecessary_spaces.py
index 6ed8c308..b39119e7 100755
--- a/cleanup/remove_unnecessary_spaces.py
+++ b/cleanup/remove_unnecessary_spaces.py
@@ -13,7 +13,8 @@ import tempfile
import shutil
# should be the same like in tools/validate.py
-FILE_EXCEPTIONS = ['ha-guide-docinfo.xml','bk001-ch003-associate-general.xml']
+FILE_EXCEPTIONS = ['ha-guide-docinfo.xml',
+ 'bk001-ch003-associate-general.xml']
elements = [
'listitem',
@@ -31,8 +32,10 @@ elements = [
checks = []
for element in elements:
- checks.append(re.compile("(.*<%s>)\s+([\w\-().:!?{}\[\]]+.*\n)" % element)),
- checks.append(re.compile("(.*[\w\-().:!?{}\[\]]+)\s+(<\/%s>.*\n)" % element))
+ checks.append(re.compile("(.*<%s>)\s+([\w\-().:!?{}\[\]]+.*\n)"
+ % element)),
+ checks.append(re.compile("(.*[\w\-().:!?{}\[\]]+)\s+(<\/%s>.*\n)"
+ % element))
for root, dirs, files in os.walk('doc/'):
for f in files:
@@ -42,7 +45,7 @@ for root, dirs, files in os.walk('doc/'):
continue
docfile = os.path.abspath(os.path.join(root, f))
tmpfile = tempfile.mkstemp()
- tmpfd = os.fdopen(tmpfile[0], "w")
+ tmpfd = os.fdopen(tmpfile[0], "w")
match = False
for line in open(docfile, 'r'):
for check in checks:
diff --git a/os_doc_tools/doctest.py b/os_doc_tools/doctest.py
index 5130b251..2f55c110 100755
--- a/os_doc_tools/doctest.py
+++ b/os_doc_tools/doctest.py
@@ -790,12 +790,15 @@ def main():
if prog_args.check_syntax or prog_args.check_niceness:
if prog_args.force:
- validate_all_files(prog_args.path, FILE_EXCEPTIONS, prog_args.verbose,
- prog_args.check_syntax, prog_args.check_niceness,
+ validate_all_files(prog_args.path, FILE_EXCEPTIONS,
+ prog_args.verbose,
+ prog_args.check_syntax,
+ prog_args.check_niceness,
prog_args.ignore_errors)
else:
validate_individual_files(prog_args.path, FILE_EXCEPTIONS,
- prog_args.verbose, prog_args.check_syntax,
+ prog_args.verbose,
+ prog_args.check_syntax,
prog_args.check_niceness,
prog_args.ignore_errors)
@@ -804,7 +807,8 @@ def main():
if prog_args.check_build:
build_affected_books(prog_args.path, BOOK_EXCEPTIONS,
- prog_args.verbose, prog_args.force, prog_args.ignore_errors)
+ prog_args.verbose, prog_args.force,
+ prog_args.ignore_errors)
def default_root():