Skip to content

Commit

Permalink
Fix Lint Issue - dict
Browse files Browse the repository at this point in the history
  • Loading branch information
RayLiu7 committed Jan 14, 2025
1 parent 4fa546c commit 35a3da8
Show file tree
Hide file tree
Showing 22 changed files with 390 additions and 440 deletions.
14 changes: 7 additions & 7 deletions PyPowerFlex/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def send_mdm_cluster_post_request(self, url, params=None, **url_params):
tuple: A tuple containing the response and the JSON content of the response.
"""
if params is None:
params = dict()
params = {}
response = None
version = self.login()
request_url = self.base_url + url.format(**url_params)
Expand Down Expand Up @@ -478,7 +478,7 @@ def get(self, entity_id=None, filter_fields=None, fields=None):
PowerFlexFailQuerying: If the entity fails to be queried.
"""
url = self.base_entity_list_or_create_url
url_params = dict(entity=self.entity)
url_params = {'entity': self.entity}

if entity_id:
url = self.base_entity_url
Expand Down Expand Up @@ -516,11 +516,11 @@ def get_related(self, entity_id, related, filter_fields=None,
Raises:
PowerFlexClientException: If the related entities fail to be queried.
"""
url_params = dict(
entity=self.entity,
entity_id=entity_id,
related=related
)
url_params = {
"entity": self.entity,
"entity_id": entity_id,
"related": related
}

r, response = self.send_get_request(self.base_relationship_url,
**url_params)
Expand Down
14 changes: 7 additions & 7 deletions PyPowerFlex/objects/acceleration_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ def create(self,
if media_type == MediaType.ssd and not isRfcache:
msg = 'isRfcache must be set for media_type SSD.'
raise exceptions.InvalidInput(msg)
params = dict(
mediaType=media_type,
protectionDomainId=protection_domain_id,
name=name,
isRfcache=isRfcache
)
params = {
'mediaType': media_type,
'protectionDomainId': protection_domain_id,
'name': name,
'isRfcache': isRfcache
}

return self._create_entity(params)

Expand All @@ -83,7 +83,7 @@ def query_selected_statistics(self, properties, ids=None):

action = "querySelectedStatistics"

params = dict(properties=properties)
params = {'properties': properties}

if ids:
params["ids"] = ids
Expand Down
18 changes: 9 additions & 9 deletions PyPowerFlex/objects/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ def get(
:param sort: (Optional) The field to sort the results by.
:return: A list of dictionary containing the retrieved Deployments.
"""
params = dict(
filter=filters,
full=full,
sort=sort,
offset=offset,
limit=limit,
includeDevices=include_devices,
includeTemplate=include_template
)
params = {
'filter': filters,
'full': full,
'sort': sort,
'offset': offset,
'limit': limit,
'includeDevices': include_devices,
'includeTemplate': include_template
}
r, response = self.send_get_request(
utils.build_uri_with_params(
self.deployment_url, **params))
Expand Down
38 changes: 18 additions & 20 deletions PyPowerFlex/objects/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ def create(self,
'set.'
raise exceptions.InvalidInput(msg)

params = dict(
deviceCurrentPathname=current_pathname,
sdsId=sds_id,
accelerationPoolId=acceleration_pool_id,
externalAccelerationType=external_acceleration_type,
forceDeviceTakeover=force,
mediaType=media_type,
name=name,
storagePoolId=storage_pool_id
)
params = {
"deviceCurrentPathname": current_pathname,
"sdsId": sds_id,
"accelerationPoolId": acceleration_pool_id,
"externalAccelerationType": external_acceleration_type,
"forceDeviceTakeover": force,
"mediaType": media_type,
"name": name,
"storagePoolId": storage_pool_id
}

return self._create_entity(params)

Expand All @@ -102,9 +102,9 @@ def delete(self, device_id, force=None):
:rtype: None
"""

params = dict(
forceRemove=force
)
params = {
"forceRemove": force
}

return self._delete_entity(device_id, params)

Expand All @@ -118,9 +118,9 @@ def rename(self, device_id, name):

action = 'setDeviceName'

params = dict(
newName=name
)
params = {
"newName": name
}

return self._rename_entity(action, device_id, params)

Expand All @@ -137,9 +137,7 @@ def set_media_type(self,

action = 'setMediaType'

params = dict(
mediaType=media_type
)
params = {"mediaType": media_type}

r, response = self.send_post_request(self.base_action_url,
action=action,
Expand All @@ -166,7 +164,7 @@ def query_selected_statistics(self, properties, ids=None):

action = "querySelectedStatistics"

params = dict(properties=properties)
params = {'properties': properties}

if ids:
params["ids"] = ids
Expand Down
16 changes: 8 additions & 8 deletions PyPowerFlex/objects/fault_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ def create(self, protection_domain_id, name=None):
:rtype: dict
"""

params = dict(
protectionDomainId=protection_domain_id,
name=name
)
params = {
"protectionDomainId": protection_domain_id,
"name": name
}

return self._create_entity(params)

Expand Down Expand Up @@ -101,9 +101,9 @@ def rename(self, fault_set_id, name):

action = 'setFaultSetName'

params = dict(
newName=name
)
params = {
"newName": name
}

return self._rename_entity(action, fault_set_id, params)

Expand All @@ -117,7 +117,7 @@ def query_selected_statistics(self, properties, ids=None):

action = "querySelectedStatistics"

params = dict(properties=properties)
params = {'properties': properties}

if ids:
params["ids"] = ids
Expand Down
18 changes: 9 additions & 9 deletions PyPowerFlex/objects/firmware_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ def get(self, filters=None, limit=None, offset=None, sort=None,
:param components: Whether to include components in the response.
:return: A list of dictionary containing the retrieved firmware repository.
"""
params = dict(
filter=filters,
sort=sort,
offset=offset,
limit=limit,
related=related,
bundles=bundles,
components=components
)
params = {
'filter': filters,
'sort': sort,
'offset': offset,
'limit': limit,
'related': related,
'bundles': bundles,
'components': components
}
r, response = self.send_get_request(
utils.build_uri_with_params(
self.firmware_repository_url, **params))
Expand Down
20 changes: 8 additions & 12 deletions PyPowerFlex/objects/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ def create(self,
:rtype: dict
"""

params = dict(
nqn=nqn,
name=name,
maxNumPaths=max_num_paths,
maxNumSysPorts=max_num_sys_ports
)
params = {
"nqn": nqn,
"name": name,
"maxNumPaths": max_num_paths,
"maxNumSysPorts": max_num_sys_ports
}

return self._create_entity(params)

Expand All @@ -66,9 +66,7 @@ def modify_max_num_paths(self, host_id, max_num_paths):

action = 'modifyMaxNumPaths'

params = dict(
newMaxNumPaths=max_num_paths
)
params = {"newMaxNumPaths": max_num_paths}

return self._perform_entity_operation_based_on_action(
action=action, entity_id=host_id, params=params, add_entity=False)
Expand All @@ -86,9 +84,7 @@ def modify_max_num_sys_ports(self, host_id, max_num_sys_ports):

action = 'modifyMaxNumSysPorts'

params = dict(
newMaxNumSysPorts=max_num_sys_ports
)
params = {"newMaxNumSysPorts": max_num_sys_ports}

return self._perform_entity_operation_based_on_action(
action=action, entity_id=host_id, params=params, add_entity=False)
12 changes: 6 additions & 6 deletions PyPowerFlex/objects/managed_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ def get(self, filters=None, limit=None, offset=None, sort=None):
:param sort: (Optional) The field to sort the results by.
:return: A list of dictionary containing the retrieved devices from inventory.
"""
params = dict(
filter=filters,
limit=limit,
offset=offset,
sort=sort
)
params = {
"filter": filters,
"limit": limit,
"offset": offset,
"sort": sort
}
r, response = self.send_get_request(
utils.build_uri_with_params(
self.managed_device_url, **params))
Expand Down
44 changes: 20 additions & 24 deletions PyPowerFlex/objects/protection_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def activate(self, protection_domain_id, force=False):

action = 'activateProtectionDomain'

params = dict(
forceActivate=force
)
params = {
"forceActivate": force
}

r, response = self.send_post_request(self.base_action_url,
action=action,
Expand All @@ -76,9 +76,7 @@ def create(self, name):
:rtype: dict
"""

params = dict(
name=name
)
params = {"name": name}

return self._create_entity(params)

Expand Down Expand Up @@ -132,9 +130,9 @@ def inactivate(self, protection_domain_id, force=False):

action = 'inactivateProtectionDomain'

params = dict(
forceShutdown=force
)
params = {
"forceShutdown": force
}

r, response = self.send_post_request(self.base_action_url,
action=action,
Expand All @@ -161,9 +159,7 @@ def rename(self, protection_domain_id, name):

action = 'setProtectionDomainName'

params = dict(
name=name
)
params = {"name": name}

return self._rename_entity(action, protection_domain_id, params)

Expand All @@ -183,12 +179,12 @@ def network_limits(self, protection_domain_id, rebuild_limit=None,

action = "setSdsNetworkLimits"

params = dict(
rebuildLimitInKbps=rebuild_limit,
rebalanceLimitInKbps=rebalance_limit,
vtreeMigrationLimitInKbps=vtree_migration_limit,
overallLimitInKbps=overall_limit
)
params = {
"rebuildLimitInKbps": rebuild_limit,
"rebalanceLimitInKbps": rebalance_limit,
"vtreeMigrationLimitInKbps": vtree_migration_limit,
"overallLimitInKbps": overall_limit
}
r, response = self.send_post_request(self.base_action_url,
action=action,
entity=self.entity,
Expand Down Expand Up @@ -246,11 +242,11 @@ def rfcache_parameters(self, protection_domain_id, page_size=None,

action = "setRfcacheParameters"

params = dict(
pageSizeKb=page_size,
maxIOSizeKb=max_io_limit,
rfcacheOperationMode=pass_through_mode
)
params = {
"pageSizeKb": page_size,
"maxIOSizeKb": max_io_limit,
"rfcacheOperationMode": pass_through_mode
}

r, response = self.send_post_request(self.base_action_url,
action=action,
Expand Down Expand Up @@ -279,7 +275,7 @@ def query_selected_statistics(self, properties, ids=None):

action = "querySelectedStatistics"

params = dict(properties=properties)
params = {'properties': properties}

if ids:
params["ids"] = ids
Expand Down
Loading

0 comments on commit 35a3da8

Please sign in to comment.