From dfa10c5c5de6131b62ed01f2e95ee2583c3b57a3 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Sat, 17 May 2014 08:30:42 +0200 Subject: [PATCH] fixed several pep8 issues * E129 visually indented line with same indent as next logical line * E129 visually indented line with same indent as next logical line * E265 block comment should start with '# ' * E713 test for membership should be 'not in' Change-Id: I8488f7ad4399153d99325806fe87919c0b4cda7e --- .../extract_swift_flags.py | 6 ++--- autogenerate_config_docs/test/generator.py | 6 ++--- cleanup/remove_unnecessary_spaces.py | 4 ++-- os_doc_tools/commands.py | 2 +- os_doc_tools/doctest.py | 24 +++++++++---------- os_doc_tools/handle_pot.py | 16 ++++++------- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/autogenerate_config_docs/extract_swift_flags.py b/autogenerate_config_docs/extract_swift_flags.py index a2ac5cf5..9985e16a 100644 --- a/autogenerate_config_docs/extract_swift_flags.py +++ b/autogenerate_config_docs/extract_swift_flags.py @@ -19,7 +19,7 @@ import sys from xml.dom import minidom import xml.sax.saxutils -#Swift configuration example files live in +# Swift configuration example files live in # swift/etc/*.conf-sample # and contain sections enclosed in [], with # options one per line containing = @@ -67,7 +67,7 @@ def get_existing_options(optfiles): except IndexError: continue if option not in options or 'No help text' in options[option]: - #options[option.split('=',1)[0]] = helptext + # options[option.split('=',1)[0]] = helptext options[option] = helptext return options @@ -151,7 +151,7 @@ def create_new_tables(repo, verbose): existing_tables = glob.glob('../../doc/common/tables/swift*xml') options = {} - #use the existing tables to get a list of option names + # use the existing tables to get a list of option names options = get_existing_options(existing_tables) option_descs = extract_descriptions_from_devref(repo, options) conf_samples = glob.glob(repo + '/etc/*conf-sample') diff --git a/autogenerate_config_docs/test/generator.py b/autogenerate_config_docs/test/generator.py index 937331cc..645fa290 100755 --- a/autogenerate_config_docs/test/generator.py +++ b/autogenerate_config_docs/test/generator.py @@ -35,13 +35,13 @@ import textwrap from oslo.config import cfg -#from openstack.common import gettextutils +# from openstack.common import gettextutils from openstack.common import importutils # sld # ...not sure about these being needed, so they are commented for now. -#gettextutils.install('nova') -#gettextutils.install('ceilometer') +# gettextutils.install('nova') +# gettextutils.install('ceilometer') STROPT = "StrOpt" BOOLOPT = "BoolOpt" diff --git a/cleanup/remove_unnecessary_spaces.py b/cleanup/remove_unnecessary_spaces.py index ec3e382e..0755a70a 100755 --- a/cleanup/remove_unnecessary_spaces.py +++ b/cleanup/remove_unnecessary_spaces.py @@ -1,7 +1,7 @@ #!/usr/bin/python -## copyright: B1 Systems GmbH , 2013. -## author: Christian Berendt , 2013. +# copyright: B1 Systems GmbH , 2013. +# author: Christian Berendt , 2013. # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain diff --git a/os_doc_tools/commands.py b/os_doc_tools/commands.py index aeb857d1..320b1a01 100644 --- a/os_doc_tools/commands.py +++ b/os_doc_tools/commands.py @@ -157,7 +157,7 @@ def extract_options(line): break if last_was_option: if (words[1].startswith(("-", '<', '{', '[')) or - is_option(words[1])): + is_option(words[1])): words[0] = words[0] + ' ' + words[1] del words[1] else: diff --git a/os_doc_tools/doctest.py b/os_doc_tools/doctest.py index ae57b26a..2c07fb43 100755 --- a/os_doc_tools/doctest.py +++ b/os_doc_tools/doctest.py @@ -132,9 +132,9 @@ def get_wadl_schema(): # NOTE(jaegerandi): We could use the RelaxNG instead # like follows but this gives quite some errors at the # moment, so only validate using the XMLSchema - #url = WADL_RNG - #relaxng_doc = etree.parse(url, base_url=BASE_RNG) - #return etree.RelaxNG(relaxng_doc) + # url = WADL_RNG + # relaxng_doc = etree.parse(url, base_url=BASE_RNG) + # return etree.RelaxNG(relaxng_doc) url = WADL_XSD schema = etree.parse(url, base_url=BASE_RNG) return etree.XMLSchema(schema) @@ -569,7 +569,7 @@ def validate_individual_files(files_to_check, rootdir, exceptions, verbose, # Files ending with ".xml" in subdirectories of # wadls and samples files are not docbook files. if (f.endswith('.xml') and - ("wadls" in f or "samples" in f)): + ("wadls" in f or "samples" in f)): validate_schema = False # Right now we can only validate docbook .xml # and .wadl files with a schema @@ -636,7 +636,7 @@ def validate_all_files(rootdir, exceptions, verbose, for f in files: # Ignore maven files, which are called pom.xml if (is_xml_like(f) and - f not in exceptions): + f not in exceptions): path = os.path.abspath(os.path.join(root, f)) files_to_check.append(path) @@ -919,7 +919,7 @@ def find_affected_books(rootdir, book_exceptions, file_exceptions, # Filter out directories to be ignored if ignore_dirs: - dirs[:] = [d for d in dirs if not d in ignore_dirs] + dirs[:] = [d for d in dirs if d not in ignore_dirs] if os.path.basename(root) in book_exceptions: break @@ -1011,14 +1011,14 @@ def find_affected_books(rootdir, book_exceptions, file_exceptions, # Filter out directories to be ignored if ignore_dirs: - dirs[:] = [d for d in dirs if not d in ignore_dirs] + dirs[:] = [d for d in dirs if d not in ignore_dirs] for f in files: f_base = os.path.basename(f) f_abs = os.path.abspath(os.path.join(root, f)) if (f_abs not in included_by and f_base != "pom.xml" - and not is_book_master(f_base)): + and not is_book_master(f_base)): f_rel = os.path.relpath(f_abs, rootdir) print (" %s " % f_rel) print("\n") @@ -1089,7 +1089,7 @@ def generate_index_file(): for root, dirs, files in os.walk(publish_path): - dirs[:] = [d for d in dirs if not d in ['common', 'webapp', 'content']] + dirs[:] = [d for d in dirs if d not in ['common', 'webapp', 'content']] # Ignore top-level index.html files if root == publish_path: @@ -1350,7 +1350,7 @@ def handle_options(): add_build_exceptions(CONF.build_file_exception, CONF.verbose) if (not CONF.check_build and not CONF.check_deletions and - not CONF.check_niceness and not CONF.check_syntax): + not CONF.check_niceness and not CONF.check_syntax): CONF.check_all = True if CONF.check_all: @@ -1368,7 +1368,7 @@ def handle_options(): "relationship.") sys.exit(1) if (CONF.publish_dir and - len(CONF.publish_dir) != len(CONF.target_dir)): + len(CONF.publish_dir) != len(CONF.target_dir)): print("ERROR: publish_dir and target_dir need to have a 1:1 " "relationship if publish_dir is specified.") sys.exit(1) @@ -1410,7 +1410,7 @@ def main(): # Do not publish www directory if we build for external # publishing if (CONF.check_build and - (www_touched(False) and not CONF.publish)): + (www_touched(False) and not CONF.publish)): publish_www() if not CONF.force and www_touched(True): diff --git a/os_doc_tools/handle_pot.py b/os_doc_tools/handle_pot.py index f3ba11e0..f0bcc273 100644 --- a/os_doc_tools/handle_pot.py +++ b/os_doc_tools/handle_pot.py @@ -89,13 +89,13 @@ def mergeSingleDocument(folder, language, root): if len(xmlfiles) > 0: popath = os.path.join(abspath, "locale", language + ".po") - #generate MO file + # generate MO file mofile_handler, mofile_tmppath = tempfile.mkstemp() os.close(mofile_handler) os.system("msgfmt -o %s %s" % (mofile_tmppath, popath)) for aXML in xmlfiles: - #(filename, ext) = os.path.splitext(os.path.basename(aXML)) + # (filename, ext) = os.path.splitext(os.path.basename(aXML)) relpath = os.path.relpath(aXML, root) outputpath = os.path.join(os.path.curdir, "generated", language, relpath) @@ -122,7 +122,7 @@ def changeXMLLangSetting(xmlFile, language): root.setAttribute("xml:lang", language[:2]) fileObj = codecs.open(xmlFile, "wb", encoding="utf-8") - #add namespace to link + # add namespace to link nodelists = root.getElementsByTagName("link") for node in nodelists: if node.hasAttribute("href"): @@ -144,7 +144,7 @@ def get_xml_list(sms, dr, flst): for f in flst: if (f.endswith(".xml") and (f != "pom.xml") and - not (f in IGNORE_FILE)): + not (f in IGNORE_FILE)): sms.append(os.path.join(dr, f)) @@ -208,9 +208,9 @@ def generatedocbook(): if options.book is None: options.book = get_default_book(root) - #change working directory + # change working directory - #copy folders + # copy folders folder = options.book language = options.language root = options.root @@ -281,8 +281,8 @@ def generateSinglePoT(folder, root): except IOError: print("Error: cannot open aFile %s for writing." % (output)) sys.exit(5) - #print(xmlfiles) - #print(">>>outout: %s ", output) + # print(xmlfiles) + # print(">>>outout: %s ", output) xml2po_main.to_pot(xmlfiles)