diff --git a/docs/conf.py b/docs/conf.py index c2453bb8c..d9305ca21 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,7 +11,7 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import sys sys.path.append('..') from packstack import version as packstackversion diff --git a/packstack/installer/basedefs.py b/packstack/installer/basedefs.py index e0cd58798..266e20c1e 100644 --- a/packstack/installer/basedefs.py +++ b/packstack/installer/basedefs.py @@ -5,7 +5,6 @@ This module provides all the predefined variables. """ import os -import pwd import sys import datetime import tempfile diff --git a/packstack/installer/core/sequences.py b/packstack/installer/core/sequences.py index b5f8060c5..a9680be8e 100644 --- a/packstack/installer/core/sequences.py +++ b/packstack/installer/core/sequences.py @@ -3,7 +3,7 @@ """ Base class for steps & sequences """ -import re + import sys import logging import traceback diff --git a/packstack/installer/run_setup.py b/packstack/installer/run_setup.py index 4c98f776e..416130aa7 100644 --- a/packstack/installer/run_setup.py +++ b/packstack/installer/run_setup.py @@ -197,7 +197,7 @@ def _addDefaultsToMaskedValueSet(): for group in controller.getAllGroups(): for param in group.parameters.itervalues(): # 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) @@ -210,7 +210,7 @@ def _updateMaskedValueSet(): global masked_value_set for confName in controller.CONF: # 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]) @@ -284,7 +284,7 @@ def process_param_value(param, value): try: new_value = proc_func(_value, param.CONF_NAME, controller.CONF) if new_value != _value: - if param.MASK_INPUT == False: + if param.MASK_INPUT is False: msg = output_messages.INFO_CHANGED_VALUE print msg % (_value, new_value) _value = new_value @@ -541,7 +541,7 @@ def _getConditionValue(matchMember): def _displaySummary(): print output_messages.INFO_DSPLY_PARAMS - print "=" * (len(output_messages.INFO_DSPLY_PARAMS) - 1) + print "=" * (len(output_messages.INFO_DSPLY_PARAMS) - 1) logging.info("*** User input summary ***") for group in controller.getAllGroups(): for param in group.parameters.itervalues(): @@ -603,7 +603,7 @@ def _summaryParamsToLog(): for param in group.parameters.itervalues(): if controller.CONF.has_key(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(): @@ -892,7 +892,7 @@ def countCmdLineFlags(options, flag): """ counter = 0 # make sure only flag was supplied - for key, value in options.__dict__.items(): + for key, value in options.__dict__.items(): if key in (flag, 'debug', 'timeout', 'dry_run', 'default_password'): next # If anything but flag was called, increment diff --git a/packstack/installer/setup_controller.py b/packstack/installer/setup_controller.py index 8de391227..b18b7e7a7 100644 --- a/packstack/installer/setup_controller.py +++ b/packstack/installer/setup_controller.py @@ -86,7 +86,7 @@ class Controller(object): sequence will be inserted BEFORE "update x" """ index = self.__getSequenceIndexByDesc(sequenceName) - if index == None: + if index is None: index = len(self.getAllSequences()) self.__SEQUENCES.insert(index, Sequence(desc, steps_new_format(steps), @@ -119,7 +119,7 @@ class Controller(object): group will be inserted BEFORE "update x" """ index = self.__getGroupIndexByDesc(groupName) - if index == None: + if index is None: index = len(self.getAllGroups()) self.__GROUPS.insert(index, Group(group, params)) diff --git a/packstack/installer/validators.py b/packstack/installer/validators.py index 92c11fc5c..6b6be3f90 100644 --- a/packstack/installer/validators.py +++ b/packstack/installer/validators.py @@ -8,13 +8,9 @@ import os import re import socket import logging -import tempfile -import traceback -import basedefs from . import utils -from .setup_controller import Controller from .exceptions import ParamValidationError diff --git a/packstack/modules/ospluginutils.py b/packstack/modules/ospluginutils.py index d89e444f5..9e7a7df7e 100644 --- a/packstack/modules/ospluginutils.py +++ b/packstack/modules/ospluginutils.py @@ -1,12 +1,9 @@ -import logging import os -import re import yaml from packstack.installer import basedefs from packstack.installer.setup_controller import Controller -from packstack.installer.exceptions import PackStackError controller = Controller() diff --git a/packstack/plugins/trove_850.py b/packstack/plugins/trove_850.py index 6a8916df7..60a92a03d 100644 --- a/packstack/plugins/trove_850.py +++ b/packstack/plugins/trove_850.py @@ -4,8 +4,6 @@ Installs and configures Trove """ -import uuid - from packstack.installer import utils from packstack.installer import validators from packstack.installer import processors diff --git a/packstack/puppet/modules/packstack/lib/facter/netns.py b/packstack/puppet/modules/packstack/lib/facter/netns.py index 076e50ee8..a24d90c4a 100644 --- a/packstack/puppet/modules/packstack/lib/facter/netns.py +++ b/packstack/puppet/modules/packstack/lib/facter/netns.py @@ -8,7 +8,6 @@ import random import subprocess import sys import tempfile -import time import uuid import unittest diff --git a/setup.py b/setup.py index b020f846b..312fbe81c 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,6 @@ import os import shutil import subprocess -import sys from setuptools import setup, find_packages, Command diff --git a/tests/installer/test_drones.py b/tests/installer/test_drones.py index ba755caf2..9df86f7ed 100644 --- a/tests/installer/test_drones.py +++ b/tests/installer/test_drones.py @@ -18,12 +18,10 @@ import os import shutil import tempfile -import subprocess from unittest import TestCase from ..test_base import PackstackTestCaseMixin from packstack.installer.core.drones import * -from packstack.installer import utils class SshTarballTransferMixinTestCase(PackstackTestCaseMixin, TestCase): diff --git a/tests/installer/test_processors.py b/tests/installer/test_processors.py index d7161c1bd..e97ca7276 100644 --- a/tests/installer/test_processors.py +++ b/tests/installer/test_processors.py @@ -16,8 +16,6 @@ # under the License. import os -import shutil -import tempfile from unittest import TestCase from packstack.installer.processors import * diff --git a/tests/modules/test_ospluginutils.py b/tests/modules/test_ospluginutils.py index 0b802ebc4..63077ad67 100644 --- a/tests/modules/test_ospluginutils.py +++ b/tests/modules/test_ospluginutils.py @@ -15,7 +15,6 @@ # License for the specific language governing permissions and limitations # under the License. -import os from unittest import TestCase from ..test_base import PackstackTestCaseMixin diff --git a/tests/modules/test_puppet.py b/tests/modules/test_puppet.py index c3ea9a0bc..0cefdcc16 100644 --- a/tests/modules/test_puppet.py +++ b/tests/modules/test_puppet.py @@ -21,7 +21,7 @@ from unittest import TestCase from ..test_base import PackstackTestCaseMixin 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): diff --git a/tests/test_base.py b/tests/test_base.py index 1045699eb..27d1a0c53 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -19,12 +19,7 @@ import shutil import tempfile import subprocess 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__) diff --git a/tests/test_plugin_serverprep.py b/tests/test_plugin_serverprep.py index ef775880e..11001e42d 100644 --- a/tests/test_plugin_serverprep.py +++ b/tests/test_plugin_serverprep.py @@ -14,12 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -import os from unittest import TestCase from test_base import PackstackTestCaseMixin from packstack.plugins import serverprep_001 -from packstack.installer.setup_controller import Controller class OSPluginUtilsTestCase(PackstackTestCaseMixin, TestCase): diff --git a/tox.ini b/tox.ini index b7a4f6135..19efcc64a 100644 --- a/tox.ini +++ b/tox.ini @@ -33,6 +33,6 @@ commands = python setup.py build_sphinx # E123, E125 skipped as they are invalid PEP-8. # # 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 exclude=.venv,.git,.tox