Enable additional pylint rules and resolve issues found. (#47221)

* Resolve unneeded-not.
* Resolve global-at-module-level.
* Resolve useless-import-alias.
* Resolve bad-whitespace.
* Resolve global-variable-not-assigned.
* Resolve logging-not-lazy.
* Resolve comparison-with-itself.
This commit is contained in:
Matt Clay
2018-10-18 13:38:08 -07:00
committed by GitHub
parent 77d32b8f57
commit 37b013aca3
29 changed files with 42 additions and 53 deletions

View File

@@ -209,7 +209,7 @@ def do_grant(kms, keyarn, role_arn, granttypes, mode='grant', dry_run=True, clea
ret['new_policy'] = policy
if dry_run:
# true if changes > 0
ret['changed'] = (not len(changes_needed) == 0)
ret['changed'] = len(changes_needed) > 0
return ret

View File

@@ -363,7 +363,7 @@ def main():
# The server could be in a changeing or error state.
# Wait for one of the allowed states before doing anything.
# If an allowed state can't be reached, this module fails.
if not server.info['state'] in ALLOWED_STATES:
if server.info['state'] not in ALLOWED_STATES:
server.wait_for_state(ALLOWED_STATES)
current_state = server.info['state']

View File

@@ -316,7 +316,6 @@ RHEV_UNAVAILABLE = 2
RHEV_TYPE_OPTS = ['server', 'desktop', 'host']
STATE_OPTS = ['ping', 'present', 'absent', 'up', 'down', 'restart', 'cd', 'info']
global msg, changed, failed
msg = []
changed = False
failed = False

View File

@@ -228,7 +228,7 @@ try:
# Import PubNub BLOCKS client.
from pubnub_blocks_client import User, Account, Owner, Application, Keyset
from pubnub_blocks_client import Block, EventHandler
import pubnub_blocks_client.exceptions as exceptions
from pubnub_blocks_client import exceptions
HAS_PUBNUB_BLOCKS_CLIENT = True
except ImportError:
HAS_PUBNUB_BLOCKS_CLIENT = False

View File

@@ -376,7 +376,7 @@ def absent_strategy(compute_api, wished_server):
return changed, {"status": "Server %s would be made absent." % target_server["id"]}
# A server MUST be stopped to be deleted.
while not fetch_state(compute_api=compute_api, server=target_server) == "stopped":
while fetch_state(compute_api=compute_api, server=target_server) != "stopped":
wait_to_complete_state_transition(compute_api=compute_api, server=target_server)
response = stop_server(compute_api=compute_api, server=target_server)