From bb77bfdab3595286291886983b127b889ccda2d5 Mon Sep 17 00:00:00 2001 From: ABHISHEK-SINHA10 Date: Wed, 15 Jan 2025 16:46:29 +0530 Subject: [PATCH] At 9.37 --- .pylintrc | 16 +++++++- PyPowerStore/client.py | 10 ++--- .../tests/unit_tests/data/common_data.py | 2 +- .../tests/unit_tests/data/file_system_data.py | 2 +- PyPowerStore/tests/unit_tests/mock_client.py | 21 +--------- PyPowerStore/tests/unit_tests/myrequests.py | 1 + PyPowerStore/utils/constants.py | 2 +- pylint_issue.log | 41 ------------------- 8 files changed, 26 insertions(+), 69 deletions(-) delete mode 100644 pylint_issue.log diff --git a/.pylintrc b/.pylintrc index e57e986..b3955ed 100644 --- a/.pylintrc +++ b/.pylintrc @@ -7,4 +7,18 @@ disable= inconsistent-return-statements, arguments-differ, too-many-arguments, - too-many-positional-arguments \ No newline at end of file + too-many-positional-arguments, + too-few-public-methods, + broad-exception-raised, + invalid-name, + assignment-from-no-return, + global-statement, + fixme, + assignment-from-none, + too-many-instance-attributes, + too-many-lines, + redefined-builtin, + super-with-arguments, + too-many-public-methods, + no-member, + too-many-return-statements \ No newline at end of file diff --git a/PyPowerStore/client.py b/PyPowerStore/client.py index 0e2ec5d..c0544a2 100644 --- a/PyPowerStore/client.py +++ b/PyPowerStore/client.py @@ -428,20 +428,20 @@ def request(self, http_method, url, payload=None, querystring=None, all_pages=No raise PowerStoreException(PowerStoreException.VALUE_ERROR, error_msg) except SSLError as exception: LOG.error(str(exception)) - raise PowerStoreException(PowerStoreException.SSL_ERROR, str(exception)) + raise PowerStoreException(PowerStoreException.SSL_ERROR, str(exception)) from exception except ConnectionError as exception: LOG.error(str(exception)) raise PowerStoreException( - PowerStoreException.CONNECTION_ERROR, str(exception) + PowerStoreException.CONNECTION_ERROR, str(exception) from exception ) except TooManyRedirects as exception: LOG.error(str(exception)) raise PowerStoreException( - PowerStoreException.TOO_MANY_REDIRECTS_ERROR, str(exception) + PowerStoreException.TOO_MANY_REDIRECTS_ERROR, str(exception) from exception ) except Timeout as exception: LOG.error(str(exception)) - raise PowerStoreException(PowerStoreException.TIMEOUT_ERROR, str(exception)) + raise PowerStoreException(PowerStoreException.TIMEOUT_ERROR, str(exception)) from exception except socket.error as exception: LOG.error(str(exception)) - raise PowerStoreException(PowerStoreException.SOCKET_ERR, str(exception)) + raise PowerStoreException(PowerStoreException.SOCKET_ERR, str(exception)) from exception diff --git a/PyPowerStore/tests/unit_tests/data/common_data.py b/PyPowerStore/tests/unit_tests/data/common_data.py index bdf02f8..82bfce4 100644 --- a/PyPowerStore/tests/unit_tests/data/common_data.py +++ b/PyPowerStore/tests/unit_tests/data/common_data.py @@ -722,7 +722,7 @@ class CommonData: "messages": [ { "arguments": [ - "[File system delete rejected due " "to existing snap(s).]" + "[File system delete rejected due to existing snap(s).]" ], "code": "0xE08010080003", "message_l10n": "Deletion of File System failed " diff --git a/PyPowerStore/tests/unit_tests/data/file_system_data.py b/PyPowerStore/tests/unit_tests/data/file_system_data.py index db530dd..dd2482a 100644 --- a/PyPowerStore/tests/unit_tests/data/file_system_data.py +++ b/PyPowerStore/tests/unit_tests/data/file_system_data.py @@ -78,7 +78,7 @@ class FileSystemData: "messages": [ { "arguments": [ - "[File system delete rejected due " "to existing snap(s).]" + "[File system delete rejected due to existing snap(s).]" ], "code": "0xE08010080003", "message_l10n": "Deletion of File System failed " diff --git a/PyPowerStore/tests/unit_tests/mock_client.py b/PyPowerStore/tests/unit_tests/mock_client.py index 9e6cd5e..555d959 100644 --- a/PyPowerStore/tests/unit_tests/mock_client.py +++ b/PyPowerStore/tests/unit_tests/mock_client.py @@ -1,7 +1,7 @@ import base64 import json -import PyPowerStore.tests.unit_tests.myrequests as myrequests +from PyPowerStore.tests.unit_tests import myrequests from PyPowerStore.utils import constants # from myrequests.exceptions import SSLError @@ -232,23 +232,6 @@ def request(self, http_method, url, payload=None, querystring=None, all_pages=No str(ex), http_method, url, payload, querystring ) ) - raise PowerStoreException(PowerStoreException.VALUE_ERROR, error_msg) + raise PowerStoreException(PowerStoreException.VALUE_ERROR, error_msg) from ex except Exception: raise - """ - except socket.error as exception: - raise PowerStoreException(PowerStoreException.SOCKET_ERR, - str(exception)) - except SSLError as exception: - raise PowerStoreException(PowerStoreException.SSL_ERROR, - str(exception)) - except ConnectionError as exception: - raise PowerStoreException(PowerStoreException.CONNECTION_ERROR, - str(exception)) - except TooManyRedirects as exception: - raise PowerStoreException( - PowerStoreException.TOO_MANY_REDIRECTS_ERROR, str(exception)) - except Timeout as exception: - raise PowerStoreException(PowerStoreException.TIMEOUT_ERROR, - str(exception)) - """ diff --git a/PyPowerStore/tests/unit_tests/myrequests.py b/PyPowerStore/tests/unit_tests/myrequests.py index a04a40c..20c7d13 100644 --- a/PyPowerStore/tests/unit_tests/myrequests.py +++ b/PyPowerStore/tests/unit_tests/myrequests.py @@ -151,6 +151,7 @@ def json(self): def get_entity_class(url): + klass = '' url_split = url.split("/") if ENTITY_CLASS_MAPPING.get(url_split[-1]): # generic request .i.e. '/' diff --git a/PyPowerStore/utils/constants.py b/PyPowerStore/utils/constants.py index 6da9a42..68b48b9 100644 --- a/PyPowerStore/utils/constants.py +++ b/PyPowerStore/utils/constants.py @@ -679,7 +679,7 @@ RESTORE_FILESYSTEM_URL = "https://{0}/api/rest/file_system/{1}/restore" MODIFY_FILESYSTEM_URL = GET_FILESYSTEM_DETAILS_URL -CREATE_FILESYSTEM_SNAPSHOT_URL = "https://{0}/api/rest/file_system/{1}/" "snapshot" +CREATE_FILESYSTEM_SNAPSHOT_URL = "https://{0}/api/rest/file_system/{1}/snapshot" GET_SNAPSHOTS_FILESYSTEM_URL = GET_FILE_SYSTEM_LIST_URL # Network endpoints diff --git a/pylint_issue.log b/pylint_issue.log deleted file mode 100644 index 519757b..0000000 --- a/pylint_issue.log +++ /dev/null @@ -1,41 +0,0 @@ -C0116: Missing function or method docstring (missing-function-docstring) 612 skip -C0209: Formatting a regular string which could be an f-string (consider-using-f-string) 358 Change -W1201: Use lazy % formatting in logging functions (logging-not-lazy) 301 Change -C0114: Missing module docstring (missing-module-docstring) 135 skip -C0115: Missing class docstring (missing-class-docstring) 133 skip -R0801: Similar lines in 2 files (duplicate-code) 93 skip -R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements) 58 Change -W0221: Number of parameters was method (arguments-differ) 51 -R0913: Too many arguments (9/5) (too-many-arguments) 34 -R0917: Too many positional arguments (9/5) (too-many-positional-arguments) 34 -C0301: Line too long 36 Change -R0903: Too few public methods (1/2) (too-few-public-methods) 29 -W0719: Raising too general exception: Exception (broad-exception-raised) 29 -C0103: Constant name (invalid-name) 15 -E1111: Assigning result of a function call, where the function has no return (assignment-from-no-return) 12 -W0603: Using the global statement (global-statement) 11 -W0511: TODO: kept LOG as global for now will improve it to avoid overriding (fixme) 11 -E1128: Assigning result of a function call, where the function returns None (assignment-from-none) 2 -R0902: Too many instance attributes (9/7) (too-many-instance-attributes) 3 -C0302: Too many lines in module (too-many-lines) 3 -E0701: Bad except clauses order (bad-except-order) 4 -W0622: Redefining built-in 'id' (redefined-builtin) 3 -W1203: Use lazy % formatting in logging functions (logging-fstring-interpolation) 1 -W1202: Use lazy % formatting in logging functions (logging-format-interpolation) 1 -E0401: Unable to import 'pytest' (import-error) 2 -R1725: Consider using Python 3 style super() without arguments (super-with-arguments) 1 -R0904: Too many public methods (22/20) (too-many-public-methods) 5 -E1101: Instance of 'CommonData' has no 'software_details_1' member (no-member) 2 -R0911: Too many return statements (too-many-return-statements) 7 -W1404: Implicit string concatenation found in list (implicit-str-concat) 3 -R0205: (useless-object-inheritance) 5 -R0402: Use 'from PyPowerStore.tests.unit_tests import myrequests' instead (consider-using-from-import) 1 -W0707: Consider explicitly re-raising using (raise-missing-from) 7 -R0912: Too many branches (21/12) (too-many-branches) 2 -R1702: Too many nested blocks (6/5) (too-many-nested-blocks) 2 -R1735: Consider using '{"delete_snaps": delete_snaps}' instead of a call to 'dict'. (use-dict-literal) 1 -R1725: Consider using Python 3 style super() without arguments (super-with-arguments) 1 -W0613: Unused argument 'enable_log' (unused-argument) 1 -W0706: The except handler raises immediately (try-except-raise) 1 -W0105: String statement has no effect (pointless-string-statement) 1 -E0606: Possibly using variable 'klass' before assignment (possibly-used-before-assignment) 1