Enable PEP8 checks for F401, E202, E271, E272, E711, E712

* F401 module imported but unused
* E271 multiple spaces after keyword
* E272 multiple spaces before keyword
* E202 remove extraneous whitespace
* E711 comparison to None should be 'if cond is None:'
* E712 comparison to True/False should be 'if cond is True/False:' or 'if cond:'

Change-Id: I56a1dbee2ae17b8315a55215e2c676e0de8311f7
This commit is contained in:
Christian Berendt 2015-01-16 12:59:54 +01:00
parent 64c2850441
commit 713b745e0e
17 changed files with 12 additions and 36 deletions

View File

@ -11,7 +11,7 @@
# All configuration values have a default; values that are commented out # All configuration values have a default; values that are commented out
# serve to show the default. # serve to show the default.
import sys, os import sys
sys.path.append('..') sys.path.append('..')
from packstack import version as packstackversion from packstack import version as packstackversion

View File

@ -5,7 +5,6 @@ This module provides all the predefined variables.
""" """
import os import os
import pwd
import sys import sys
import datetime import datetime
import tempfile import tempfile

View File

@ -3,7 +3,7 @@
""" """
Base class for steps & sequences Base class for steps & sequences
""" """
import re
import sys import sys
import logging import logging
import traceback import traceback

View File

@ -197,7 +197,7 @@ def _addDefaultsToMaskedValueSet():
for group in controller.getAllGroups(): for group in controller.getAllGroups():
for param in group.parameters.itervalues(): for param in group.parameters.itervalues():
# Keep default password values masked, but ignore default empty values # Keep default password values masked, but ignore default empty values
if ((param.MASK_INPUT == True) and param.DEFAULT_VALUE != ""): if ((param.MASK_INPUT is True) and param.DEFAULT_VALUE != ""):
masked_value_set.add(param.DEFAULT_VALUE) masked_value_set.add(param.DEFAULT_VALUE)
@ -210,7 +210,7 @@ def _updateMaskedValueSet():
global masked_value_set global masked_value_set
for confName in controller.CONF: for confName in controller.CONF:
# Add all needed values to masked_value_set # Add all needed values to masked_value_set
if (controller.getParamKeyValue(confName, "MASK_INPUT") == True): if (controller.getParamKeyValue(confName, "MASK_INPUT") is True):
masked_value_set.add(controller.CONF[confName]) masked_value_set.add(controller.CONF[confName])
@ -284,7 +284,7 @@ def process_param_value(param, value):
try: try:
new_value = proc_func(_value, param.CONF_NAME, controller.CONF) new_value = proc_func(_value, param.CONF_NAME, controller.CONF)
if new_value != _value: if new_value != _value:
if param.MASK_INPUT == False: if param.MASK_INPUT is False:
msg = output_messages.INFO_CHANGED_VALUE msg = output_messages.INFO_CHANGED_VALUE
print msg % (_value, new_value) print msg % (_value, new_value)
_value = new_value _value = new_value
@ -603,7 +603,7 @@ def _summaryParamsToLog():
for param in group.parameters.itervalues(): for param in group.parameters.itervalues():
if controller.CONF.has_key(param.CONF_NAME): if controller.CONF.has_key(param.CONF_NAME):
maskedValue = mask(controller.CONF[param.CONF_NAME]) maskedValue = mask(controller.CONF[param.CONF_NAME])
logging.debug("%s: %s" % (param.CMD_OPTION, maskedValue )) logging.debug("%s: %s" % (param.CMD_OPTION, maskedValue))
def runSequences(): def runSequences():

View File

@ -86,7 +86,7 @@ class Controller(object):
sequence will be inserted BEFORE "update x" sequence will be inserted BEFORE "update x"
""" """
index = self.__getSequenceIndexByDesc(sequenceName) index = self.__getSequenceIndexByDesc(sequenceName)
if index == None: if index is None:
index = len(self.getAllSequences()) index = len(self.getAllSequences())
self.__SEQUENCES.insert(index, Sequence(desc, self.__SEQUENCES.insert(index, Sequence(desc,
steps_new_format(steps), steps_new_format(steps),
@ -119,7 +119,7 @@ class Controller(object):
group will be inserted BEFORE "update x" group will be inserted BEFORE "update x"
""" """
index = self.__getGroupIndexByDesc(groupName) index = self.__getGroupIndexByDesc(groupName)
if index == None: if index is None:
index = len(self.getAllGroups()) index = len(self.getAllGroups())
self.__GROUPS.insert(index, Group(group, params)) self.__GROUPS.insert(index, Group(group, params))

View File

@ -8,13 +8,9 @@ import os
import re import re
import socket import socket
import logging import logging
import tempfile
import traceback
import basedefs
from . import utils from . import utils
from .setup_controller import Controller
from .exceptions import ParamValidationError from .exceptions import ParamValidationError

View File

@ -1,12 +1,9 @@
import logging
import os import os
import re
import yaml import yaml
from packstack.installer import basedefs from packstack.installer import basedefs
from packstack.installer.setup_controller import Controller from packstack.installer.setup_controller import Controller
from packstack.installer.exceptions import PackStackError
controller = Controller() controller = Controller()

View File

@ -4,8 +4,6 @@
Installs and configures Trove Installs and configures Trove
""" """
import uuid
from packstack.installer import utils from packstack.installer import utils
from packstack.installer import validators from packstack.installer import validators
from packstack.installer import processors from packstack.installer import processors

View File

@ -8,7 +8,6 @@ import random
import subprocess import subprocess
import sys import sys
import tempfile import tempfile
import time
import uuid import uuid
import unittest import unittest

View File

@ -4,7 +4,6 @@
import os import os
import shutil import shutil
import subprocess import subprocess
import sys
from setuptools import setup, find_packages, Command from setuptools import setup, find_packages, Command

View File

@ -18,12 +18,10 @@
import os import os
import shutil import shutil
import tempfile import tempfile
import subprocess
from unittest import TestCase from unittest import TestCase
from ..test_base import PackstackTestCaseMixin from ..test_base import PackstackTestCaseMixin
from packstack.installer.core.drones import * from packstack.installer.core.drones import *
from packstack.installer import utils
class SshTarballTransferMixinTestCase(PackstackTestCaseMixin, TestCase): class SshTarballTransferMixinTestCase(PackstackTestCaseMixin, TestCase):

View File

@ -16,8 +16,6 @@
# under the License. # under the License.
import os import os
import shutil
import tempfile
from unittest import TestCase from unittest import TestCase
from packstack.installer.processors import * from packstack.installer.processors import *

View File

@ -15,7 +15,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import os
from unittest import TestCase from unittest import TestCase
from ..test_base import PackstackTestCaseMixin from ..test_base import PackstackTestCaseMixin

View File

@ -21,7 +21,7 @@ from unittest import TestCase
from ..test_base import PackstackTestCaseMixin from ..test_base import PackstackTestCaseMixin
from packstack.installer.exceptions import PuppetError from packstack.installer.exceptions import PuppetError
from packstack.modules.puppet import validate_logfile, scan_logfile from packstack.modules.puppet import validate_logfile
class PuppetTestCase(PackstackTestCaseMixin, TestCase): class PuppetTestCase(PackstackTestCaseMixin, TestCase):

View File

@ -19,12 +19,7 @@ import shutil
import tempfile import tempfile
import subprocess import subprocess
import logging import logging
import re
from packstack.installer.utils.shell import block_fmt
from packstack.installer.exceptions import (ScriptRuntimeError,
NetworkError)
from packstack.installer.utils.strings import mask_string
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -14,12 +14,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import os
from unittest import TestCase from unittest import TestCase
from test_base import PackstackTestCaseMixin from test_base import PackstackTestCaseMixin
from packstack.plugins import serverprep_001 from packstack.plugins import serverprep_001
from packstack.installer.setup_controller import Controller
class OSPluginUtilsTestCase(PackstackTestCaseMixin, TestCase): class OSPluginUtilsTestCase(PackstackTestCaseMixin, TestCase):

View File

@ -33,6 +33,6 @@ commands = python setup.py build_sphinx
# E123, E125 skipped as they are invalid PEP-8. # E123, E125 skipped as they are invalid PEP-8.
# #
# All other checks should be enabled in the future. # All other checks should be enabled in the future.
ignore = E123,E125,H803,E128,F403,F821,E127,F811,F401,F841,E501,E272,E111,E502,E202,W601,E271,E721,E712,E261,E131,E126,E303,E711,E241,E713,E122,E401,H402,H302,H303,H304,H301,H306,H234,H405,H404,H904,H201,H305,H307,H501,H102,H233,H101,H233,H401,H232 ignore = E123,E125,H803,E128,F403,F821,E127,F811,F841,E501,E111,E502,W601,E721,E261,E131,E126,E303,E241,E713,E122,E401,H402,H302,H303,H304,H301,H306,H234,H405,H404,H904,H201,H305,H307,H501,H102,H233,H101,H233,H401,H232
show-source = True show-source = True
exclude=.venv,.git,.tox exclude=.venv,.git,.tox