Skip to content

Commit ef96801

Browse files
style and tox fixes
1 parent dab368e commit ef96801

File tree

8 files changed

+17
-38
lines changed

8 files changed

+17
-38
lines changed

SoftLayer/fixtures/SoftLayer_Location_Datacenter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
"longName": "Dallas 9",
1010
"name": "dal09"
1111
}
12-
]
12+
]

SoftLayer/managers/block.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
66
:license: MIT, see LICENSE for more details.
77
"""
8-
from SoftLayer import exceptions
9-
from SoftLayer.managers import storage_utils
108
from SoftLayer.managers.storage import StorageManager
11-
9+
from SoftLayer.managers import storage_utils
1210
from SoftLayer import utils
1311

1412
# pylint: disable=too-many-public-methods
@@ -81,7 +79,6 @@ def get_block_volume_details(self, volume_id, **kwargs):
8179
"""
8280
return self.get_volume_details(volume_id, **kwargs)
8381

84-
8582
def get_block_volume_access_list(self, volume_id, **kwargs):
8683
"""Returns a list of authorized hosts for a specified volume.
8784
@@ -100,7 +97,6 @@ def get_block_volume_snapshot_list(self, volume_id, **kwargs):
10097
"""
10198
return self.get_volume_snapshot_list(volume_id, **kwargs)
10299

103-
104100
def assign_subnets_to_acl(self, access_id, subnet_ids):
105101
"""Assigns subnet records to ACL for the access host.
106102

SoftLayer/managers/file.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
66
:license: MIT, see LICENSE for more details.
77
"""
8-
from SoftLayer import exceptions
9-
from SoftLayer.managers import storage_utils
108
from SoftLayer.managers.storage import StorageManager
9+
from SoftLayer.managers import storage_utils
1110
from SoftLayer import utils
1211

1312
# pylint: disable=too-many-public-methods
@@ -125,7 +124,6 @@ def get_file_volume_snapshot_list(self, volume_id, **kwargs):
125124
"""
126125
return self.get_volume_snapshot_list(volume_id, **kwargs)
127126

128-
129127
def order_file_volume(self, storage_type, location, size,
130128
iops=None, tier_level=None, snapshot_size=None,
131129
service_offering='storage_as_a_service',
@@ -159,5 +157,3 @@ def cancel_file_volume(self, volume_id, reason='No longer needed', immediate=Fal
159157
:param boolean immediate: Cancel immediately or on anniversary date
160158
"""
161159
return self.cancel_volume(volume_id, reason, immediate)
162-
163-

SoftLayer/managers/storage.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ def deauthorize_host_to_volume(self, volume_id, hardware_ids=None, virtual_guest
139139
:return: Returns an array of SoftLayer_Network_Storage_Allowed_Host objects
140140
which have access to the given File volume
141141
"""
142-
host_templates = storage_utils.populate_host_templates(hardware_ids, virtual_guest_ids,
143-
ip_address_ids, subnet_ids)
142+
host_templates = storage_utils.populate_host_templates(hardware_ids, virtual_guest_ids,
143+
ip_address_ids, subnet_ids)
144144

145145
return self.client.call('Network_Storage', 'removeAccessFromHostList', host_templates, id=volume_id)
146146

@@ -182,8 +182,8 @@ def order_replicant_volume(self, volume_id, snapshot_schedule, location, tier=No
182182
storage_class = storage_utils.block_or_file(block_volume['storageType']['keyName'])
183183

184184
order = storage_utils.prepare_replicant_order_object(
185-
self, snapshot_schedule, location, tier, block_volume, storage_class
186-
)
185+
self, snapshot_schedule, location, tier, block_volume, storage_class
186+
)
187187

188188
if storage_class == 'block':
189189
if os_type is None:
@@ -219,7 +219,6 @@ def order_duplicate_volume(self, origin_volume_id, origin_snapshot_id=None,
219219
origin_volume = self.get_volume_details(origin_volume_id, mask=block_mask)
220220
storage_class = storage_utils.block_or_file(origin_volume['storageType']['keyName'])
221221

222-
223222
order = storage_utils.prepare_duplicate_order_object(
224223
self, origin_volume, duplicate_iops, duplicate_tier_level,
225224
duplicate_size, duplicate_snapshot_size, storage_class, hourly_billing_flag
@@ -238,7 +237,6 @@ def order_duplicate_volume(self, origin_volume_id, origin_snapshot_id=None,
238237

239238
return self.client.call('Product_Order', 'placeOrder', order)
240239

241-
242240
def order_modified_volume(self, volume_id, new_size=None, new_iops=None, new_tier_level=None):
243241
"""Places an order for modifying an existing block volume.
244242
@@ -268,7 +266,6 @@ def order_modified_volume(self, volume_id, new_size=None, new_iops=None, new_tie
268266

269267
return self.client.call('Product_Order', 'placeOrder', order)
270268

271-
272269
def delete_snapshot(self, snapshot_id):
273270
"""Deletes the specified snapshot object.
274271
@@ -297,7 +294,7 @@ def order_snapshot_space(self, volume_id, capacity, tier, upgrade, **kwargs):
297294
object_mask = 'id,billingItem[location,hourlyFlag],'\
298295
'storageType[keyName],storageTierLevel,provisionedIops,'\
299296
'staasVersion,hasEncryptionAtRest'
300-
volume = self.get_volume_details(volume_id, mask=object_mask, **kwargs)
297+
volume = self.get_volume_details(volume_id, mask=object_mask, **kwargs)
301298

302299
order = storage_utils.prepare_snapshot_order_object(self, volume, capacity, tier, upgrade)
303300

SoftLayer/managers/storage_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,7 @@ def prepare_modify_order_object(manager, volume, new_iops, new_tier, new_size):
985985

986986
return modify_order
987987

988+
988989
def block_or_file(storage_type_keyname):
989990
"""returns either 'block' or 'file'
990991
@@ -993,6 +994,7 @@ def block_or_file(storage_type_keyname):
993994
"""
994995
return 'block' if 'BLOCK_STORAGE' in storage_type_keyname else 'file'
995996

997+
996998
def _has_category(categories, category_code):
997999
return any(
9981000
True
@@ -1022,4 +1024,3 @@ def _find_price_id(prices, category, restriction_type=None, restriction_value=No
10221024
continue
10231025

10241026
return {'id': price['id']}
1025-

tests/managers/block_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
import SoftLayer
1010
from SoftLayer import exceptions
1111
from SoftLayer.fixtures import SoftLayer_Account
12-
from SoftLayer.fixtures import SoftLayer_Product_Package
13-
from SoftLayer.fixtures import SoftLayer_Product_Order
1412
from SoftLayer.fixtures import SoftLayer_Network_Storage
1513
from SoftLayer.fixtures import SoftLayer_Network_Storage_Allowed_Host
14+
from SoftLayer.fixtures import SoftLayer_Product_Order
15+
from SoftLayer.fixtures import SoftLayer_Product_Package
1616
from SoftLayer import testing
1717

1818

tests/managers/file_tests.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
import SoftLayer
1010
from SoftLayer import exceptions
1111
from SoftLayer.fixtures import SoftLayer_Account
12-
from SoftLayer.fixtures import SoftLayer_Product_Package
13-
from SoftLayer.fixtures import SoftLayer_Product_Order
1412
from SoftLayer.fixtures import SoftLayer_Network_Storage
15-
from SoftLayer.fixtures import SoftLayer_Network_Storage_Allowed_Host
13+
from SoftLayer.fixtures import SoftLayer_Product_Order
14+
from SoftLayer.fixtures import SoftLayer_Product_Package
1615
from SoftLayer import testing
1716

1817

tests/managers/storage_utils_tests.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,20 @@ def set_up(self):
2323
# Tests for populate_host_templates()
2424
# ---------------------------------------------------------------------
2525
def test_populate_host_templates_no_ids_given(self):
26-
host_templates = []
27-
28-
storage_utils.populate_host_templates(host_templates)
29-
26+
host_templates = storage_utils.populate_host_templates()
3027
self.assertEqual([], host_templates)
3128

3229
def test_populate_host_templates_empty_arrays_given(self):
33-
host_templates = []
34-
35-
storage_utils.populate_host_templates(
36-
host_templates,
30+
host_templates = storage_utils.populate_host_templates(
3731
hardware_ids=[],
3832
virtual_guest_ids=[],
3933
ip_address_ids=[],
4034
subnet_ids=[]
4135
)
42-
4336
self.assertEqual([], host_templates)
4437

4538
def test_populate_host_templates(self):
46-
host_templates = []
47-
48-
storage_utils.populate_host_templates(
49-
host_templates,
39+
host_templates = storage_utils.populate_host_templates(
5040
hardware_ids=[1111],
5141
virtual_guest_ids=[2222],
5242
ip_address_ids=[3333],

0 commit comments

Comments
 (0)