Skip to content

Commit 718c833

Browse files
Merge pull request #1173 from camporter/fix_pylint_2.4_issues
Fix issues introduced with pylint 2.4.0
2 parents 29759b4 + f782312 commit 718c833

File tree

10 files changed

+15
-19
lines changed

10 files changed

+15
-19
lines changed

SoftLayer/CLI/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import os
1010
import sys
1111
import time
12+
import traceback
1213
import types
1314

1415
import click
@@ -196,7 +197,6 @@ def main(reraise_exceptions=False, **kwargs):
196197
if reraise_exceptions:
197198
raise
198199

199-
import traceback
200200
print("An unexpected error has occured:")
201201
print(str(traceback.format_exc()))
202202
print("Feel free to report this error as it is likely a bug:")

SoftLayer/CLI/deprecated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ def main():
1111
"""Main function for the deprecated 'sl' command."""
1212
print("ERROR: Use the 'slcli' command instead.", file=sys.stderr)
1313
print("> slcli %s" % ' '.join(sys.argv[1:]), file=sys.stderr)
14-
exit(-1)
14+
sys.exit(-1)

SoftLayer/CLI/firewall/edit.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,9 @@ def cli(env, identifier):
154154
try:
155155
rules = parse_rules(edited_rules)
156156
if firewall_type == 'vlan':
157-
rules = mgr.edit_dedicated_fwl_rules(firewall_id,
158-
rules)
157+
mgr.edit_dedicated_fwl_rules(firewall_id, rules)
159158
else:
160-
rules = mgr.edit_standard_fwl_rules(firewall_id,
161-
rules)
159+
mgr.edit_standard_fwl_rules(firewall_id, rules)
162160
break
163161
except (SoftLayer.SoftLayerError, ValueError) as error:
164162
env.out("Unexpected error({%s})" % (error))
@@ -169,10 +167,8 @@ def cli(env, identifier):
169167
if formatting.confirm("Would you like to submit the "
170168
"rules. Continue?"):
171169
continue
172-
else:
173-
raise exceptions.CLIAbort('Aborted.')
174-
else:
175170
raise exceptions.CLIAbort('Aborted.')
176-
env.fout('Firewall updated!')
171+
raise exceptions.CLIAbort('Aborted.')
172+
env.fout('Firewall updated!')
177173
else:
178174
raise exceptions.CLIAbort('Aborted.')

SoftLayer/CLI/loadbal/pools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def l7pool_add(env, identifier, **args):
177177
'protocol': args.get('protocol')
178178
}
179179

180-
pool_members = [member for member in args.get('server')]
180+
pool_members = list(args.get('server'))
181181

182182
pool_health = {
183183
'interval': args.get('healthinterval'),

SoftLayer/CLI/user/create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def cli(env, username, email, password, from_user, template, api_key):
9191
def generate_password():
9292
"""Returns a 23 character random string, with 3 special characters at the end"""
9393
if sys.version_info > (3, 6):
94-
import secrets # pylint: disable=import-error
94+
import secrets # pylint: disable=import-error,import-outside-toplevel
9595
alphabet = string.ascii_letters + string.digits
9696
password = ''.join(secrets.choice(alphabet) for i in range(20))
9797
special = ''.join(secrets.choice(string.punctuation) for i in range(3))

SoftLayer/CLI/virt/create.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ def _parse_create_args(client, args):
130130

131131
if args.get('public_security_group'):
132132
pub_groups = args.get('public_security_group')
133-
data['public_security_groups'] = [group for group in pub_groups]
133+
data['public_security_groups'] = list(pub_groups)
134134

135135
if args.get('private_security_group'):
136136
priv_groups = args.get('private_security_group')
137-
data['private_security_groups'] = [group for group in priv_groups]
137+
data['private_security_groups'] = list(priv_groups)
138138

139139
if args.get('tag', False):
140140
data['tags'] = ','.join(args['tag'])

SoftLayer/managers/firewall.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ def edit_standard_fwl_rules(self, firewall_id, rules):
282282
"""Edit the rules for standard firewall.
283283
284284
:param integer firewall_id: the instance ID of the standard firewall
285-
:param dict rules: the rules to be pushed on the firewall
285+
:param list rules: the rules to be pushed on the firewall as defined by
286+
SoftLayer_Network_Firewall_Update_Request_Rule
286287
"""
287288

288289
rule_svc = self.client['Network_Firewall_Update_Request']

SoftLayer/managers/hardware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def reload(self, hardware_id, post_uri=None, ssh_keys=None):
281281
config['customProvisionScriptUri'] = post_uri
282282

283283
if ssh_keys:
284-
config['sshKeyIds'] = [key_id for key_id in ssh_keys]
284+
config['sshKeyIds'] = list(ssh_keys)
285285

286286
return self.hardware.reloadOperatingSystem('FORCE', config,
287287
id=hardware_id)

SoftLayer/managers/user.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ def permissions_from_user(self, user_id, from_user_id):
132132
# If permission does not exist for from_user_id add it to the list to be removed
133133
if _keyname_search(from_permissions, permission['keyName']):
134134
continue
135-
else:
136-
remove_permissions.append({'keyName': permission['keyName']})
135+
remove_permissions.append({'keyName': permission['keyName']})
137136

138137
self.remove_permissions(user_id, remove_permissions)
139138
return True

SoftLayer/managers/vs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def reload_instance(self, instance_id,
303303
config['customProvisionScriptUri'] = post_uri
304304

305305
if ssh_keys:
306-
config['sshKeyIds'] = [key_id for key_id in ssh_keys]
306+
config['sshKeyIds'] = list(ssh_keys)
307307

308308
if image_id:
309309
config['imageTemplateId'] = image_id

0 commit comments

Comments
 (0)