Skip to content

Commit 87637ad

Browse files
fixed some anaylsis complaints
1 parent 91c3b8e commit 87637ad

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

SoftLayer/fixtures/SoftLayer_Location.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
"longName": "San Jose 1",
1010
"name": "sjc01"
1111
}]
12-
getDatacenters = [{'id': 1854895, 'name': 'dal13', 'regions': [{'keyname': 'DALLAS13'}]}]
12+
getDatacenters = [{'id': 1854895, 'name': 'dal13', 'regions': [{'keyname': 'DALLAS13'}]}]

SoftLayer/managers/ordering.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,12 +484,11 @@ def get_location_id(self, location):
484484

485485
mask = "mask[id,name,regions[keyname]]"
486486
if match(r'[a-zA-Z]{3}[0-9]{2}', location) is not None:
487-
search = {'name' : {'operation': location}}
487+
search = {'name': {'operation': location}}
488488
else:
489-
search = {'regions' : {'keyname' : {'operation': location}}}
489+
search = {'regions': {'keyname': {'operation': location}}}
490490
datacenter = self.client.call('SoftLayer_Location', 'getDatacenters', mask=mask, filter=search)
491491
# [{'id': 1854895, 'name': 'dal13', 'regions': [{'keyname': 'DALLAS13'}]}]
492492
if len(datacenter) != 1:
493493
raise exceptions.SoftLayerError("Unable to find location: %s" % location)
494494
return datacenter[0]['id']
495-

tests/managers/ordering_tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,12 +383,11 @@ def test_get_location_id_short(self):
383383

384384
def test_get_location_id_keyname(self):
385385
locations = self.set_mock('SoftLayer_Location', 'getDatacenters')
386-
locations.return_value =[{'id': 1854895, 'name': 'dal13', 'regions': [{'keyname': 'DALLAS13'}]}]
386+
locations.return_value = [{'id': 1854895, 'name': 'dal13', 'regions': [{'keyname': 'DALLAS13'}]}]
387387
dc_id = self.ordering.get_location_id('DALLAS13')
388388
self.assertEqual(1854895, dc_id)
389389

390390
def test_get_location_id_exception(self):
391391
locations = self.set_mock('SoftLayer_Location', 'getDatacenters')
392392
locations.return_value = []
393393
self.assertRaises(exceptions.SoftLayerError, self.ordering.get_location_id, "BURMUDA")
394-

0 commit comments

Comments
 (0)