Merge pull request #9970 from s0undt3ch/hotfix/unnecessary-parens

Fix unnecessary parens for if, not, return
This commit is contained in:
Thomas S Hatch 2014-01-27 09:05:15 -08:00
commit 7b635a50f7
9 changed files with 11 additions and 11 deletions

View file

@ -721,7 +721,7 @@ class LocalFuncs(object):
try:
name = self.loadauth.load_name(load)
if not ((name in self.opts['external_auth'][load['eauth']]) | ('*' in self.opts['external_auth'][load['eauth']])):
if not (name in self.opts['external_auth'][load['eauth']]) | ('*' in self.opts['external_auth'][load['eauth']]):
msg = ('Authentication failure of type "eauth" occurred for '
'user {0}.').format(load.get('username', 'UNKNOWN'))
log.warning(msg)

View file

@ -2133,7 +2133,7 @@ class ClearFuncs(object):
try:
name = self.loadauth.load_name(clear_load)
if not ((name in self.opts['external_auth'][clear_load['eauth']]) | ('*' in self.opts['external_auth'][clear_load['eauth']])):
if not (name in self.opts['external_auth'][clear_load['eauth']]) | ('*' in self.opts['external_auth'][clear_load['eauth']]):
msg = ('Authentication failure of type "eauth" occurred for '
'user {0}.').format(clear_load.get('username', 'UNKNOWN'))
log.warning(msg)

View file

@ -396,7 +396,7 @@ def exists(name):
salt '*' lxc.exists name
'''
l = list_()
return name in (l['running'] + l['stopped'] + l['frozen'])
return name in l['running'] + l['stopped'] + l['frozen']
def state(name):

View file

@ -501,7 +501,7 @@ def _check_symlink_ownership(path, user, group):
Check if the symlink ownership matches the specified user and group
'''
cur_user, cur_group = _get_symlink_ownership(path)
return ((cur_user == user) and (cur_group == group))
return (cur_user == user) and (cur_group == group)
def _set_symlink_ownership(path, uid, gid):

View file

@ -192,7 +192,7 @@ def present(name,
and group_attr['inherits privileges'] != inherit
):
update['inherit'] = inherit
if (login is not None and group_attr['can login'] != login):
if login is not None and group_attr['can login'] != login:
update['login'] = login
if (
createroles is not None
@ -206,7 +206,7 @@ def present(name,
update['replication'] = replication
if superuser is not None and group_attr['superuser'] != superuser:
update['superuser'] = superuser
if (password is not None and group_attr['password'] != password):
if password is not None and group_attr['password'] != password:
update['password'] = True
if mode == 'create' or (mode == 'update' and update):
cret = __salt__['postgres.group_{0}'.format(mode)](

View file

@ -192,7 +192,7 @@ def present(name,
and user_attr['inherits privileges'] != inherit
):
update['inherit'] = inherit
if (login is not None and user_attr['can login'] != login):
if login is not None and user_attr['can login'] != login:
update['login'] = login
if (
createroles is not None
@ -206,7 +206,7 @@ def present(name,
update['replication'] = replication
if superuser is not None and user_attr['superuser'] != superuser:
update['superuser'] = superuser
if (password is not None and user_attr['password'] != password):
if password is not None and user_attr['password'] != password:
update['password'] = True
if mode == 'create' or (mode == 'update' and update):
cret = __salt__['postgres.user_{0}'.format(mode)](

View file

@ -419,7 +419,7 @@ def absent(name, purge=False, force=False):
[g['name'] for g in __salt__['group.getent'](refresh=True)])
if ret['result']:
ret['changes'] = {}
for g in (beforegroups - aftergroups):
for g in beforegroups - aftergroups:
ret['changes']['{0} group'.format(g)] = 'removed'
ret['changes'][name] = 'removed'
ret['comment'] = 'Removed user {0}'.format(name)

View file

@ -1171,7 +1171,7 @@ def is_linux():
# This is a hack. If a proxy minion is started by other
# means, e.g. a custom script that creates the minion objects
# then this will fail.
if ('salt-proxy-minion' in main.__file__):
if 'salt-proxy-minion' in main.__file__:
return False
else:
return sys.platform.startswith('linux')

View file

@ -46,7 +46,7 @@ def isportopen(host, port):
salt '*' network.isportopen 127.0.0.1 22
'''
if not (1 <= int(port) <= 65535):
if not 1 <= int(port) <= 65535:
return False
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)