FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Enable several PEP8 checks · redhat-openstack/packstack@c532db1 · GitHub

Commit c532db1

Browse files
committed
Enable several PEP8 checks
* E122 continuation line missing indentation or outdented * E126 continuation line over-indented for hanging indent * E127 continuation line over-indented for visual indent * E128 continuation line under-indented for visual indent * E131 continuation line unaligned for hanging indent * E303 too many blank lines * W601 .has_key() is deprecated, use 'in' * H234 assertEquals is deprecated, use assertEqual * H401 docstring should not start with a space * H402 one line docstring needs punctuation. Change-Id: I1c264dba19bfe7cb9173e8999429827bd026b930
1 parent 62e5e8c commit c532db1

19 files changed

Lines changed: 79 additions & 83 deletions

File tree

‎docs/conf.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@
173173
# -- Options for LaTeX output --------------------------------------------------
174174

175175
latex_elements = {
176-
# The paper size ('letterpaper' or 'a4paper').
177-
# 'papersize': 'letterpaper',
176+
# The paper size ('letterpaper' or 'a4paper').
177+
# 'papersize': 'letterpaper',
178178

179-
# The font size ('10pt', '11pt' or '12pt').
180-
# 'pointsize': '10pt',
179+
# The font size ('10pt', '11pt' or '12pt').
180+
# 'pointsize': '10pt',
181181

182-
# Additional stuff for the LaTeX preamble.
183-
# 'preamble': '',
182+
# Additional stuff for the LaTeX preamble.
183+
# 'preamble': '',
184184
}
185185

186186
# Grouping the document tree into LaTeX files. List of tuples
@@ -229,8 +229,8 @@
229229
# dir menu entry, description, category)
230230
texinfo_documents = [
231231
('index', 'packstack', u'packstack Documentation',
232-
u'Derek Higgins', 'packstack', 'One line description of project.',
233-
'Miscellaneous'),
232+
u'Derek Higgins', 'packstack', 'One line description of project.',
233+
'Miscellaneous'),
234234
]
235235

236236
# Documents to append as an appendix to all manuals.

‎packstack/installer/basedefs.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@
5252
DIR_PLUGINS = os.path.join(DIR_PROJECT_DIR, "plugins")
5353
DIR_MODULES = os.path.join(DIR_PROJECT_DIR, "modules")
5454

55-
56-
5755
EXEC_RPM = "rpm"
5856
EXEC_SEMANAGE = "semanage"
5957
EXEC_NSLOOKUP = "nslookup"

‎packstack/installer/core/drones.py‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def _transfer(self, pack_path, pack_dest, res_dir):
2424
script.append("scp %(pack_path)s root@%(node)s:%(pack_dest)s"
2525
% args)
2626
script.append("ssh -o StrictHostKeyChecking=no "
27-
"-o UserKnownHostsFile=/dev/null root@%(node)s "
28-
"tar -C %(res_dir)s -xpzf %(pack_dest)s" % args)
27+
"-o UserKnownHostsFile=/dev/null root@%(node)s "
28+
"tar -C %(res_dir)s -xpzf %(pack_dest)s" % args)
2929
try:
3030
script.execute()
3131
except ScriptRuntimeError as ex:
@@ -124,15 +124,15 @@ def __init__(self, node, resource_dir=None, recipe_dir=None,
124124
# remote host IP or hostname
125125
self.node = node
126126
# working directories on remote host
127-
self.resource_dir = resource_dir or \
128-
'/tmp/drone%s' % uuid.uuid4().hex[:8]
129-
self.recipe_dir = recipe_dir or \
130-
os.path.join(self.resource_dir, 'recipes')
127+
self.resource_dir = (resource_dir or
128+
'/tmp/drone%s' % uuid.uuid4().hex[:8])
129+
self.recipe_dir = (recipe_dir or
130+
os.path.join(self.resource_dir, 'recipes'))
131131
# temporary directories
132-
self.remote_tmpdir = remote_tmpdir or \
133-
'/tmp/drone%s' % uuid.uuid4().hex[:8]
134-
self.local_tmpdir = local_tmpdir or \
135-
tempfile.mkdtemp(prefix='drone')
132+
self.remote_tmpdir = (remote_tmpdir or
133+
'/tmp/drone%s' % uuid.uuid4().hex[:8])
134+
self.local_tmpdir = (local_tmpdir or
135+
tempfile.mkdtemp(prefix='drone'))
136136

137137
def init_node(self):
138138
"""
@@ -335,7 +335,7 @@ def init_node(self):
335335
server = utils.ScriptRunner(self.node)
336336
for pkg in ("puppet", "openssh-clients", "tar"):
337337
server.append("rpm -q --whatprovides %(pkg)s || "
338-
"yum install -y %(pkg)s" % locals())
338+
"yum install -y %(pkg)s" % locals())
339339
server.execute()
340340

341341
def add_resource(self, path, resource_type=None):
@@ -352,8 +352,8 @@ def _finished(self, recipe):
352352
recipe_base.replace(".finished", ".log"))
353353
local = utils.ScriptRunner()
354354
local.append('scp -o StrictHostKeyChecking=no '
355-
'-o UserKnownHostsFile=/dev/null '
356-
'root@%s:%s %s' % (self.node, recipe, log))
355+
'-o UserKnownHostsFile=/dev/null '
356+
'root@%s:%s %s' % (self.node, recipe, log))
357357
try:
358358
# once a remote puppet run has finished, we retrieve
359359
# the log file and check it for errors
@@ -390,8 +390,8 @@ def _apply(self, recipe):
390390
mdir = self._module_dir
391391
server.append(
392392
"( flock %(rdir)s/ps.lock "
393-
"puppet apply %(loglevel)s --modulepath %(mdir)s "
394-
"%(recipe)s > %(running)s 2>&1 < /dev/null; "
393+
"puppet apply %(loglevel)s --modulepath %(mdir)s "
394+
"%(recipe)s > %(running)s 2>&1 < /dev/null; "
395395
"mv %(running)s %(finished)s ) "
396396
"> /dev/null 2>&1 < /dev/null &" % locals())
397397
server.execute()

‎packstack/installer/core/sequences.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ def run(self, config=None, messages=None):
4848
sys.stdout.flush()
4949

5050

51-
5251
class Sequence(object):
5352
"""
5453
Wrapper for sequence of setup steps.

‎packstack/installer/output_messages.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252

5353
WARN_WEAK_PASS = "Warning: Weak Password."
5454
WARN_NM_ENABLED = ("Warning: NetworkManager is active on %s. OpenStack "
55-
"networking currently does not work on systems that have "
56-
"the Network Manager service enabled.")
55+
"networking currently does not work on systems that have "
56+
"the Network Manager service enabled.")
5757

5858
ERR_PING = "Error: the provided hostname is unreachable"
5959
ERR_SSH = "Error: could not connect to the ssh server: %s"

‎packstack/installer/run_setup.py‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def _getInputFromUser(param):
7777
else:
7878
while loop:
7979
# If the value was not supplied by the command line flags
80-
if not commandLineValues.has_key(param.CONF_NAME):
80+
if param.CONF_NAME not in commandLineValues:
8181
message = StringIO()
8282
message.write(param.PROMPT)
8383

@@ -121,11 +121,11 @@ def _getInputFromUser(param):
121121
controller.CONF[param.CONF_NAME] = userInput
122122
continue
123123
else:
124-
if commandLineValues.has_key(param.CONF_NAME):
124+
if param.CONF_NAME in commandLineValues:
125125
del commandLineValues[param.CONF_NAME]
126126
else:
127127
# Delete value from commandLineValues so that we will prompt the user for input
128-
if commandLineValues.has_key(param.CONF_NAME):
128+
if param.CONF_NAME in commandLineValues:
129129
del commandLineValues[param.CONF_NAME]
130130
loop = True
131131
except KeyboardInterrupt:
@@ -144,7 +144,7 @@ def input_param(param):
144144
"""
145145
# We need to check if a param needs confirmation, (i.e. ask user twice)
146146
# Do not validate if it was given from the command line
147-
if (param.NEED_CONFIRM and not commandLineValues.has_key(param.CONF_NAME)):
147+
if param.NEED_CONFIRM and param.CONF_NAME not in commandLineValues:
148148
# create a copy of the param so we can call it twice
149149
confirmedParam = copy.deepcopy(param)
150150
confirmedParamName = param.CONF_NAME + "_CONFIRMED"
@@ -492,9 +492,9 @@ def _handleInteractiveParams():
492492
# we clear the value of all params in the group
493493
# in order to re-input them by the user
494494
for param in group.parameters.itervalues():
495-
if controller.CONF.has_key(param.CONF_NAME):
495+
if param.CONF_NAME in controller.CONF:
496496
del controller.CONF[param.CONF_NAME]
497-
if commandLineValues.has_key(param.CONF_NAME):
497+
if param.CONF_NAME in commandLineValues:
498498
del commandLineValues[param.CONF_NAME]
499499
else:
500500
inputLoop = False
@@ -529,7 +529,7 @@ def _getConditionValue(matchMember):
529529
elif isinstance(matchMember, types.StringType):
530530
# we assume that if we get a string as a member it is the name
531531
# of a member of conf_params
532-
if not controller.CONF.has_key(matchMember):
532+
if matchMember not in controller.CONF:
533533
param = controller.getParamByName(matchMember)
534534
input_param(param)
535535
returnValue = controller.CONF[matchMember]
@@ -546,7 +546,7 @@ def _displaySummary():
546546
logging.info("*** User input summary ***")
547547
for group in controller.getAllGroups():
548548
for param in group.parameters.itervalues():
549-
if not param.USE_DEFAULT and controller.CONF.has_key(param.CONF_NAME):
549+
if not param.USE_DEFAULT and param.CONF_NAME in controller.CONF:
550550
cmdOption = param.CMD_OPTION
551551
l = 30 - len(cmdOption)
552552
maskParam = param.MASK_INPUT
@@ -564,14 +564,14 @@ def _displaySummary():
564564
logging.debug("user chose to re-enter the user parameters")
565565
for group in controller.getAllGroups():
566566
for param in group.parameters.itervalues():
567-
if controller.CONF.has_key(param.CONF_NAME):
567+
if param.CONF_NAME in controller.CONF:
568568
if not param.MASK_INPUT:
569569
param.DEFAULT_VALUE = controller.CONF[param.CONF_NAME]
570570
# Remove the string from mask_value_set in order
571571
# to remove values that might be over overwritten.
572572
removeMaskString(controller.CONF[param.CONF_NAME])
573573
del controller.CONF[param.CONF_NAME]
574-
if commandLineValues.has_key(param.CONF_NAME):
574+
if param.CONF_NAME in commandLineValues:
575575
del commandLineValues[param.CONF_NAME]
576576
print ""
577577
logging.debug("calling handleParams in interactive mode")
@@ -602,7 +602,7 @@ def _summaryParamsToLog():
602602
logging.debug("*** The following params were used as user input:")
603603
for group in controller.getAllGroups():
604604
for param in group.parameters.itervalues():
605-
if controller.CONF.has_key(param.CONF_NAME):
605+
if param.CONF_NAME in controller.CONF:
606606
maskedValue = mask(controller.CONF[param.CONF_NAME])
607607
logging.debug("%s: %s" % (param.CMD_OPTION, maskedValue))
608608

@@ -725,7 +725,7 @@ def generateAnswerFile(outputFile, overrides={}):
725725

726726

727727
def single_step_aio_install(options, logFile):
728-
""" Installs an All in One host on this host"""
728+
"""Installs an All in One host on this host."""
729729

730730
options.install_hosts = utils.get_localhost_ip()
731731

@@ -788,15 +788,15 @@ def initCmdLineParser():
788788
usage = "usage: %prog [options] [--help]"
789789
parser = OptionParser(usage=usage, version="%prog {0} {1}".format(version.release_string(), version.version_string()))
790790
parser.add_option("--gen-answer-file", help="Generate a template of an answer file, using this option excludes all other options")
791-
parser.add_option("--answer-file", help="Runs the configuration in non-interactive mode, extracting all information from the \
792-
configuration file. using this option excludes all other options")
791+
parser.add_option("--answer-file", help="Runs the configuration in non-interactive mode, extracting all information from the"
792+
"configuration file. using this option excludes all other options")
793793
parser.add_option("--install-hosts", help="Install on a set of hosts in a single step. The format should be a comma separated list "
794-
"of hosts, the first is setup as a controller, and the others are setup as compute nodes."
795-
"if only a single host is supplied then it is setup as an all in one installation. An answerfile "
796-
"will also be generated and should be used if Packstack needs to be run a second time ")
794+
"of hosts, the first is setup as a controller, and the others are setup as compute nodes."
795+
"if only a single host is supplied then it is setup as an all in one installation. An answerfile "
796+
"will also be generated and should be used if Packstack needs to be run a second time ")
797797
parser.add_option("--allinone", action="store_true", help="Shorthand for --install-hosts=<local ipaddr> --novanetwork-pubif=<dev> "
798-
"--novacompute-privif=lo --novanetwork-privif=lo --os-swift-install=y --nagios-install=y "
799-
", this option can be used to install an all in one OpenStack on this host")
798+
"--novacompute-privif=lo --novanetwork-privif=lo --os-swift-install=y --nagios-install=y "
799+
", this option can be used to install an all in one OpenStack on this host")
800800

801801
parser.add_option("-t", "--timeout", default=300, help="The timeout for puppet Exec calls")
802802
parser.add_option("-o", "--options", action="store_true", dest="options", help="Print details on options available in answer file(rst format)")

‎packstack/installer/utils/shell.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ def execute(self, can_fail=True, mask_list=None, log=True):
9090
environ = os.environ
9191
environ['LANG'] = 'en_US.UTF8'
9292
obj = subprocess.Popen(cmd, stdin=_PIPE, stdout=_PIPE, stderr=_PIPE,
93-
close_fds=True, shell=False,
94-
env=environ)
93+
close_fds=True, shell=False, env=environ)
9594

9695
script = "function t(){ exit $? ; } \n trap t ERR \n" + script
9796
out, err = obj.communicate(script)

‎packstack/modules/puppet.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
'NetworkManager is not running'
3535
)
3636
re_notice = re.compile(r"notice: .*Notify\[packstack_info\]"
37-
"\/message: defined \'message\' as "
38-
"\'(?P<message>.*)\'")
37+
"\/message: defined \'message\' as "
38+
"\'(?P<message>.*)\'")
3939

4040
surrogates = [
4141
# Value in /etc/sysctl.conf cannot be changed

‎packstack/plugins/ceilometer_800.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,10 @@ def create_redis_manifest(config, messages):
310310

311311
slave_clients = set([config['CONFIG_CONTROLLER_HOST']]).union(
312312
split_hosts(config['CONFIG_REDIS_SLAVE_HOSTS'])).union(
313-
split_hosts(config['CONFIG_REDIS_SENTINEL_HOSTS']))
313+
split_hosts(config['CONFIG_REDIS_SENTINEL_HOSTS']))
314314
config['FIREWALL_REDIS_SLAVE_RULES'] = (
315-
_create_redis_firewall_rules(
316-
slave_clients, config['CONFIG_REDIS_PORT']))
315+
_create_redis_firewall_rules(
316+
slave_clients, config['CONFIG_REDIS_PORT']))
317317

318318
manifestdata += createFirewallResources(
319319
'FIREWALL_REDIS_SLAVE_RULES')

‎packstack/plugins/neutron_350.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ def create_manifests(config, messages):
601601
if use_openvswitch_vxlan(config) or use_openvswitch_gre(config):
602602
for n_host in network_hosts:
603603
cf_fw_nt_key = ("FIREWALL_NEUTRON_TUNNEL_RULES_%s_%s"
604-
% (host, n_host))
604+
% (host, n_host))
605605
fw_details = dict()
606606
key = "neutron_tunnel_%s_%s" % (host, n_host)
607607
fw_details.setdefault(key, {})

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL