Skip to content

Commit fbc023d

Browse files
authored
Enable Lint and Fix Issues (dell#30)
1 parent d590af9 commit fbc023d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3221
-1248
lines changed

.github/workflows/pylint.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Run Lint Check via Pylint
2+
3+
on: [push]
4+
5+
jobs:
6+
lint:
7+
name: lint
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
python-version: ['3.9', '3.10', '3.11', '3.12']
13+
14+
steps:
15+
- name: Checkout the source code
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Install dependencies
24+
run: python -m pip install --upgrade pip && pip install pylint
25+
26+
- name: Install requirements
27+
run: |
28+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29+
30+
- name: Analyzing the code with pylint
31+
run: pylint $(git ls-files '*.py')

PyPowerFlex/__init__.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
# License for the specific language governing permissions and limitations
1414
# under the License.
1515

16+
"""This module is used for the initialization of PowerFlex Client."""
17+
18+
# pylint: disable=invalid-name,too-many-arguments,too-many-positional-arguments
19+
1620
from packaging import version
1721

1822
from PyPowerFlex import configuration
@@ -28,6 +32,12 @@
2832

2933

3034
class PowerFlexClient:
35+
"""
36+
Client class for interacting with PowerFlex API.
37+
38+
This class initializes the client with the provided configuration and provides
39+
access to the various storage entities available in the PowerFlex system.
40+
"""
3141
__slots__ = (
3242
'__is_initialized',
3343
'configuration',
@@ -76,12 +86,18 @@ def __init__(self,
7686
def __getattr__(self, item):
7787
if not self.__is_initialized and item in self.__slots__:
7888
raise exceptions.ClientNotInitialized
79-
return super(PowerFlexClient, self).__getattribute__(item)
89+
return super().__getattribute__(item)
8090

8191
def __add_storage_entity(self, attr_name, entity_class):
8292
setattr(self, attr_name, entity_class(self.token, self.configuration))
8393

8494
def initialize(self):
95+
"""
96+
Initializes the client.
97+
98+
Raises:
99+
PowerFlexClientException: If the PowerFlex API version is lower than 3.0.
100+
"""
85101
self.configuration.validate()
86102
self.__add_storage_entity('device', objects.Device)
87103
self.__add_storage_entity('fault_set', objects.FaultSet)
@@ -97,12 +113,16 @@ def initialize(self):
97113
self.__add_storage_entity('system', objects.System)
98114
self.__add_storage_entity('volume', objects.Volume)
99115
self.__add_storage_entity('utility', objects.PowerFlexUtility)
100-
self.__add_storage_entity('replication_consistency_group', objects.ReplicationConsistencyGroup)
116+
self.__add_storage_entity(
117+
'replication_consistency_group',
118+
objects.ReplicationConsistencyGroup)
101119
self.__add_storage_entity('replication_pair', objects.ReplicationPair)
102120
self.__add_storage_entity('service_template', objects.ServiceTemplate)
103121
self.__add_storage_entity('managed_device', objects.ManagedDevice)
104122
self.__add_storage_entity('deployment', objects.Deployment)
105-
self.__add_storage_entity('firmware_repository', objects.FirmwareRepository)
123+
self.__add_storage_entity(
124+
'firmware_repository',
125+
objects.FirmwareRepository)
106126
self.__add_storage_entity('host', objects.Host)
107127
utils.init_logger(self.configuration.log_level)
108128
if version.parse(self.system.api_version()) < version.Version('3.0'):

0 commit comments

Comments
 (0)