Skip to content

Commit

Permalink
Fix Lint Issue - Final
Browse files Browse the repository at this point in the history
  • Loading branch information
RayLiu7 committed Jan 16, 2025
1 parent 231eb1d commit 4959792
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,16 @@ jobs:
- name: Install dependencies
run: python -m pip install --upgrade pip && pip install pylint

- name: Install requirements
run: |
pip install testtools
pip install requests
pip install pytest
pip install pytest-coverage
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Analyzing the code with pylint
run: pylint $(git ls-files '*.py')
run: pylint --disable=R0801,R0903,R0904,R0913,R0917 $(git ls-files '*.py')
# Disabled error types:
# R0801 duplicate-code, R0903 too-few-public-methods, R0904 too-many-public-methods
# R0913 too-many-arguments, R0917 too-many-positional-arguments
7 changes: 4 additions & 3 deletions PyPowerFlex/objects/storage_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ def set_cap_alert_thresholds(
params=params)
if r.status_code != requests.codes.ok:
msg = (
f'Failed to set the capacity alert thresholds for PowerFlex {self.entity}'
f'Failed to set the capacity alert thresholds for PowerFlex {self.entity}'
f'with id {storage_pool_id}. Error: {response}')
LOG.error(msg)
raise exceptions.PowerFlexClientException(msg)
Expand Down Expand Up @@ -595,8 +595,9 @@ def set_protected_maintenance_mode_io_priority_policy(
params=params)
if r.status_code != requests.codes.ok:
msg = (
f'Failed to set the protected maintenance mode IO priority policy for PowerFlex {self.entity} '
f'with id {storage_pool_id}. Error: {response}')
f'Failed to set the protected maintenance mode IO priority policy for '
f'PowerFlex {self.entity} with id {storage_pool_id}. Error: {response}'
)
LOG.error(msg)
raise exceptions.PowerFlexClientException(msg)

Expand Down
14 changes: 11 additions & 3 deletions PyPowerFlex/objects/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ def get_statistics_for_all_volumes(self, ids=None, properties=None):
action = 'querySelectedStatistics'

params = {
'properties': VolumeConstants.DEFAULT_STATISTICS_PROPERTIES if properties is None else properties}
'properties': (
VolumeConstants.DEFAULT_STATISTICS_PROPERTIES
if properties is None
else properties
)
}
if ids is None:
params['allIds'] = ""
else:
Expand Down Expand Up @@ -110,8 +115,11 @@ def get_statistics_for_all_snapshot_policies(

action = 'querySelectedStatistics'

params = {
'properties': SnapshotPolicyConstants.DEFAULT_STATISTICS_PROPERTIES if properties is None else properties}
params = {}
if properties is None:
params['properties'] = SnapshotPolicyConstants.DEFAULT_STATISTICS_PROPERTIES
else:
params['properties'] = properties
if ids is None:
params['allIds'] = ""
else:
Expand Down

0 comments on commit 4959792

Please sign in to comment.