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
This commit is contained in:
Christian Berendt 2014-05-17 08:30:42 +02:00
parent bd36d6f4b8
commit dfa10c5c5d
6 changed files with 29 additions and 29 deletions

View File

@ -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')

View File

@ -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"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
## copyright: B1 Systems GmbH <info@b1-systems.de>, 2013.
## author: Christian Berendt <berendt@b1-systems.de>, 2013.
# copyright: B1 Systems GmbH <info@b1-systems.de>, 2013.
# author: Christian Berendt <berendt@b1-systems.de>, 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

View File

@ -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:

View File

@ -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):

View File

@ -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)