PEP 8 cleanup. (#20789)

* PEP 8 E703 cleanup.
* PEP 8 E701 cleanup.
* PEP 8 E711 cleanup.
* PEP 8 W191 and E101 cleanup.
This commit is contained in:
Matt Clay 2017-01-28 00:12:11 -08:00 committed by GitHub
commit d0d1158c5e
72 changed files with 184 additions and 174 deletions

View file

@ -103,7 +103,8 @@ except ImportError:
HAS_LAYMAN_API = False
class ModuleError(Exception): pass
class ModuleError(Exception):
pass
def init_layman(config=None):
@ -201,7 +202,8 @@ def uninstall_overlay(module, name):
module.exit_json(changed=True, msg=mymsg)
layman.delete_repos(name)
if layman.get_errors(): raise ModuleError(layman.get_errors())
if layman.get_errors():
raise ModuleError(layman.get_errors())
return True

View file

@ -161,9 +161,9 @@ def get_package_state(names, pkg_spec, module):
# find multiple packages with that name.
pkg_spec[name]['installed_names'] = [installed_name for installed_name in stdout.splitlines()]
module.debug("get_package_state(): installed_names = %s" % pkg_spec[name]['installed_names'])
pkg_spec[name]['installed_state'] = True;
pkg_spec[name]['installed_state'] = True
else:
pkg_spec[name]['installed_state'] = False;
pkg_spec[name]['installed_state'] = False
# Function used to make sure a package is present.
def package_present(names, pkg_spec, module):

View file

@ -111,7 +111,7 @@ def modify_publisher(module, params):
if name in existing:
for option in ['origin', 'mirror', 'sticky', 'enabled']:
if params[option] != None:
if params[option] is not None:
if params[option] != existing[name][option]:
return set_publisher(module, params)
else:
@ -124,21 +124,21 @@ def set_publisher(module, params):
name = params['name']
args = []
if params['origin'] != None:
if params['origin'] is not None:
args.append('--remove-origin=*')
args.extend(['--add-origin=' + u for u in params['origin']])
if params['mirror'] != None:
if params['mirror'] is not None:
args.append('--remove-mirror=*')
args.extend(['--add-mirror=' + u for u in params['mirror']])
if params['sticky'] != None and params['sticky']:
if params['sticky'] is not None and params['sticky']:
args.append('--sticky')
elif params['sticky'] != None:
elif params['sticky'] is not None:
args.append('--non-sticky')
if params['enabled'] != None and params['enabled']:
if params['enabled'] is not None and params['enabled']:
args.append('--enable')
elif params['enabled'] != None:
elif params['enabled'] is not None:
args.append('--disable')
rc, out, err = module.run_command(

View file

@ -140,7 +140,7 @@ def main():
changed = False
msg = "No changed"
rc = 0
if ( state == 'present' or state == 'latest' ) and depot == None:
if ( state == 'present' or state == 'latest' ) and depot is None:
output = "depot parameter is mandatory in present or latest task"
module.fail_json(name=name, msg=output, rc=rc)