Merge "Enable PEP8 checks for E111, E241, E261, E401, E502, E713, E721"

This commit is contained in:
Jenkins 2015-01-21 13:31:30 +00:00 committed by Gerrit Code Review
commit 62e5e8c703
5 changed files with 19 additions and 18 deletions

View File

@ -249,7 +249,7 @@ class Drone(object):
Registers an observer. Given object should be subclass of class
DroneObserver.
"""
for attr in ('applying', 'checking', 'finished'):
for attr in ('applying', 'checking', 'finished'):
if not hasattr(observer, attr):
raise ValueError('Observer object should be a subclass '
'of class DroneObserver.')

View File

@ -101,7 +101,7 @@ def process_password(param, param_name, config=None):
else:
param = uuid.uuid4().hex[:16]
process_password.pw_dict[unconfirmed_param] = param
elif not param_name in process_password.pw_dict:
elif param_name not in process_password.pw_dict:
param = uuid.uuid4().hex[:16]
process_password.pw_dict[param_name] = param
else:

View File

@ -129,7 +129,8 @@ def _getInputFromUser(param):
del commandLineValues[param.CONF_NAME]
loop = True
except KeyboardInterrupt:
print "" # add the new line so messages wont be displayed in the same line as the question
# add the new line so messages wont be displayed in the same line as the question
print ""
raise
except:
logging.error(traceback.format_exc())
@ -222,21 +223,21 @@ def mask(input):
If it finds, it replaces them with '********'
"""
output = copy.deepcopy(input)
if type(input) == types.DictType:
if isinstance(input, types.DictType):
for key in input:
if type(input[key]) == types.StringType:
if isinstance(input[key], types.StringType):
output[key] = utils.mask_string(input[key],
masked_value_set)
if type(input) == types.ListType:
if isinstance(input, types.ListType):
for item in input:
org = item
orgIndex = input.index(org)
if type(item) == types.StringType:
if isinstance(item, types.StringType):
item = utils.mask_string(item, masked_value_set)
if item != org:
output.remove(org)
output.insert(orgIndex, item)
if type(input) == types.StringType:
if isinstance(input, types.StringType):
output = utils.mask_string(input, masked_value_set)
return output
@ -312,7 +313,7 @@ def _handleGroupCondition(config, conditionName, conditionValue):
# If the condition is a string - just read it to global conf
# We assume that if we get a string as a member it is the name of a member of conf_params
elif type(conditionName) == types.StringType:
elif isinstance(conditionName, types.StringType):
conditionValue = _loadParamFromFile(config, "general", conditionName)
else:
# Any other type is invalid
@ -410,9 +411,9 @@ def _handleAnswerFileParams(answerFile):
# Handle post condition match for group
if postConditionValue != group.POST_CONDITION_MATCH:
logging.error("The group condition (%s) returned: %s, which differs from the excpeted output: %s" %\
logging.error("The group condition (%s) returned: %s, which differs from the excpeted output: %s" %
(group.GROUP_NAME, postConditionValue, group.POST_CONDITION_MATCH))
raise ValueError(output_messages.ERR_EXP_GROUP_VALIDATION_ANS_FILE %\
raise ValueError(output_messages.ERR_EXP_GROUP_VALIDATION_ANS_FILE %
(group.GROUP_NAME, postConditionValue, group.POST_CONDITION_MATCH))
else:
logging.debug("condition (%s) passed" % group.POST_CONDITION)
@ -523,9 +524,9 @@ def _handleParams(configFile):
def _getConditionValue(matchMember):
returnValue = False
if type(matchMember) == types.FunctionType:
if isinstance(matchMember, types.FunctionType):
returnValue = matchMember(controller.CONF)
elif type(matchMember) == types.StringType:
elif isinstance(matchMember, types.StringType):
# we assume that if we get a string as a member it is the name
# of a member of conf_params
if not controller.CONF.has_key(matchMember):
@ -875,9 +876,9 @@ def loadPlugins():
checkPlugin(moduleobj)
controller.addPlugin(moduleobj)
except:
logging.error("Failed to load plugin from file %s", item)
logging.error(traceback.format_exc())
raise Exception("Failed to load plugin from file %s" % item)
logging.error("Failed to load plugin from file %s", item)
logging.error(traceback.format_exc())
raise Exception("Failed to load plugin from file %s" % item)
def checkPlugin(plugin):

View File

@ -21,7 +21,7 @@ class Controller(object):
MESSAGES = []
CONF = {}
__single = None # the one, true Singleton ... for god's sake why ??? :)
__single = None # the one, true Singleton ... for god's sake why ??? :)
def __new__(self, *args, **kwargs):
"""

View File

@ -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,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
ignore = E123,E125,H803,E128,F403,F821,E127,F811,F841,E501,W601,E131,E126,E303,E122,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