Skip to content

Commit

Permalink
Merge pull request #272 from HewlettPackard/pep8_pylint_fixes
Browse files Browse the repository at this point in the history
Pylint and Pep8 linting
  • Loading branch information
akshith-gunasheelan authored Oct 4, 2023
2 parents 80ebbfc + b3404f6 commit 0e6ec31
Show file tree
Hide file tree
Showing 27 changed files with 17 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/.ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
sanity:
strategy:
matrix:
python_version: ["3.6", "3.7"]
python_version: ["3.7", "3.8"]
ansible_version: ["stable-2.9", "stable-2.10", "stable-2.11"]
runs-on: ubuntu-20.04
steps:
Expand Down Expand Up @@ -56,8 +56,8 @@ jobs:
fail-fast: true
matrix:
python_version:
- 3.6
- 3.7
- 3.8
ansible:
- stable-2.9
- stable-2.10
Expand Down
1 change: 0 additions & 1 deletion plugins/module_utils/oneview.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
from ansible.module_utils import six
from ansible.module_utils._text import to_native
except ImportError:
import ansible.module_utils.six
to_native = str

from ansible.module_utils.basic import AnsibleModule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
type: dict
'''

from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModule, OneViewModuleException, \
from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModule, \
OneViewModuleValueError, OneViewModuleResourceNotFound


Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/oneview_appliance_device_snmp_v3_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
'''

from ansible_collections.hpe.oneview.plugins.module_utils.oneview import (
OneViewModule, OneViewModuleException,
OneViewModuleValueError, OneViewModuleResourceNotFound
OneViewModule,
OneViewModuleValueError
)


Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/oneview_connection_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
type: dict
'''

from ansible_collections.hpe.oneview.plugins.module_utils.oneview import (OneViewModule, OneViewModuleValueError,
OneViewModuleResourceNotFound, compare)
from ansible_collections.hpe.oneview.plugins.module_utils.oneview import (OneViewModule,
OneViewModuleResourceNotFound)


class ConnectionTemplateModule(OneViewModule):
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/oneview_san_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@
from ansible_collections.hpe.oneview.plugins.module_utils.oneview import (OneViewModule, OneViewModuleResourceNotFound,
OneViewModuleValueError, compare)
from operator import itemgetter
import itertools
import copy


Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/oneview_sas_logical_interconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
'''

import time
from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModule, OneViewModuleResourceNotFound, OneViewModuleValueError, compare
from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModule, OneViewModuleResourceNotFound, OneViewModuleValueError


class SasLogicalInterconnectModule(OneViewModule):
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/oneview_sas_logical_interconnect_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
type: dict
'''

from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModule, OneViewModuleResourceNotFound, compare_lig, LIGMerger
from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModule, OneViewModuleResourceNotFound


class SasLogicalInterconnectGroupModule(OneViewModule):
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/oneview_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
type: dict
'''

from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModule, OneViewModuleResourceNotFound, compare, dict_merge
from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModule, compare, dict_merge


class ScopeModule(OneViewModule):
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/oneview_storage_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
'''
from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModule, OneViewModuleValueError, compare, dict_merge
from copy import deepcopy
import collections
__metaclass__ = type


Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/oneview_uplink_set_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
returned: Always, but can be null.
type: dict
'''
from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModule, OneViewModuleResourceNotFound
from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModule


class UplinkSetFactsModule(OneViewModule):
Expand Down
15 changes: 4 additions & 11 deletions tests/unit/test_oneview.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@
OneViewModule,
OneViewClient,
OneViewModuleException,
OneViewModuleValueError,
OneViewModuleResourceNotFound,
SPKeys,
ServerProfileMerger,
ServerProfileReplaceNamesByUris,
LIGMerger,
sort_by_uplink_set_location,
_sort_by_keys,
_str_sorted,
merge_list_by_key,
dict_merge,
transform_list_to_dict,
Expand Down Expand Up @@ -128,8 +125,6 @@ def test_should_call_ov_exception_with_a_data(self):

error = {'message': 'Failure with data'}

OneViewModuleException(error)

def test_should_call_exit_json_properly(self):

self.mock_ansible_module.params = self.PARAMS_FOR_PRESENT
Expand Down Expand Up @@ -293,7 +288,7 @@ def test_should_not_handle_value_error_exception(self):
base_mod.execute_module = mock_run
base_mod.run()
except ValueError as e:
assert(e.args[0] == MSG_GENERIC_ERROR)
assert (e.args[0] == MSG_GENERIC_ERROR)
else:
self.fail('Expected ValueError was not raised')

Expand All @@ -308,7 +303,7 @@ def test_should_not_handle_exception(self):
base_mod.execute_module = mock_run
base_mod.run()
except Exception as e:
assert(e.args[0] == MSG_GENERIC_ERROR)
assert (e.args[0] == MSG_GENERIC_ERROR)
else:
self.fail('Expected Exception was not raised')

Expand Down Expand Up @@ -758,8 +753,6 @@ def test_should_call_ov_exception_with_a_data(self):

error = {'message': 'Failure with data'}

OneViewModuleException(error)

def test_should_call_exit_json_properly(self):

self.mock_ansible_module.params = self.PARAMS_FOR_PRESENT
Expand Down Expand Up @@ -923,7 +916,7 @@ def test_should_not_handle_value_error_exception(self):
base_mod.execute_module = mock_run
base_mod.run()
except ValueError as e:
assert(e.args[0] == MSG_GENERIC_ERROR)
assert (e.args[0] == MSG_GENERIC_ERROR)
else:
self.fail('Expected ValueError was not raised')

Expand All @@ -938,7 +931,7 @@ def test_should_not_handle_exception(self):
base_mod.execute_module = mock_run
base_mod.run()
except Exception as e:
assert(e.args[0] == MSG_GENERIC_ERROR)
assert (e.args[0] == MSG_GENERIC_ERROR)
else:
self.fail('Expected Exception was not raised')

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_oneview_appliance_device_snmp_v3_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import pytest

from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import ApplianceDeviceSnmpV3UsersModule, OneViewModuleException
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import ApplianceDeviceSnmpV3UsersModule

ERROR_MSG = 'Fake message error'

Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_oneview_appliance_network_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import mock
import pytest

from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_oneview_appliance_proxy_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import mock
import pytest

from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_oneview_drive_enclosure.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import mock
import pytest
import yaml

from copy import deepcopy
from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_oneview_id_pools_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import mock
import pytest

from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import IdPoolsFactsModule, OneViewModuleValueError
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import IdPoolsFactsModule

DEFAULT_ID_POOLS = dict(uri='/rest/id-pools/')

Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_oneview_interconnect_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
__metaclass__ = type

import pytest
import yaml

from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseFactsTest
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import InterconnectFactsModule
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_oneview_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
__metaclass__ = type

import pytest
import mock

from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import LabelModule
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_oneview_san_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import mock
import pytest
import yaml

from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import SanManagerModule
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_oneview_sas_interconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import mock
import pytest

from copy import deepcopy
from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import SasInterconnectModule

Expand Down
2 changes: 0 additions & 2 deletions tests/unit/test_oneview_sas_logical_interconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@

import mock
import pytest
import yaml

from copy import deepcopy
from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import SasLogicalInterconnectModule

Expand Down
3 changes: 0 additions & 3 deletions tests/unit/test_oneview_sas_logical_interconnect_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import mock
import pytest
import yaml

from copy import deepcopy
from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import SasLogicalInterconnectGroupModule

Expand Down
2 changes: 0 additions & 2 deletions tests/unit/test_oneview_sas_logical_jbod.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@

import mock
import pytest
import yaml

from copy import deepcopy
from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import SasLogicalJbodModule

Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_oneview_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
__metaclass__ = type

import copy
import mock
import pytest

from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_oneview_server_hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseTest
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import ServerHardwareModule
from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModuleValueError

FAKE_MSG_ERROR = 'Fake message error'

Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_oneview_storage_system_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
__metaclass__ = type

import pytest
import mock

from ansible_collections.hpe.oneview.tests.unit.utils.hpe_test_utils import OneViewBaseFactsTest
from ansible_collections.hpe.oneview.tests.unit.utils.oneview_module_loader import StorageSystemFactsModule
Expand Down

0 comments on commit 0e6ec31

Please sign in to comment.