diff --git a/pylint.rc b/pylint.rc index 620a9214..65004e13 100755 --- a/pylint.rc +++ b/pylint.rc @@ -131,11 +131,6 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652, # W1201 logging-not-lazy # W1401 anomalous-backslash-in-string # W1618: no-absolute-import -# W1619: old-division -# W1641: eq-without-hash -# W1645: exception-message-attribute -# W1649: deprecated-string-function -# W1653: next-method-defined # # The following are errors which should be fixed # @@ -151,13 +146,11 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652, # not-callable (E1102) # too-many-function-args (E1121) # unsubscriptable-object (E1136) -# print-statement (E1601) disable=C, R, W0102, W0107, W0110, W0120, W0201, W0212, W0221, W0223, W0231, W0235, W0402, W0403, W0511, W0603, W0611, W0612, W0613, W0621, W0622, W0702, W0703, W1113, W1201, W1401, - W1618, W1619, W1641, W1645, W1649, W1653, - E0202, E0203, E0602, E0604, E0611, E0702, E0711, E1003, E1101, E1102, E1121, E1136, - E1601 + W1618, + E0202, E0203, E0602, E0604, E0611, E0702, E0711, E1003, E1101, E1102, E1121, E1136 diff --git a/service-mgmt-api/sm-api/sm_api/api/api.py b/service-mgmt-api/sm-api/sm_api/api/api.py index a7d785b9..5d014bbf 100644 --- a/service-mgmt-api/sm-api/sm_api/api/api.py +++ b/service-mgmt-api/sm-api/sm_api/api/api.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: Apache-2.0 # +from __future__ import print_function + import os import sys import argparse diff --git a/service-mgmt-api/sm-api/sm_api/common/exception.py b/service-mgmt-api/sm-api/sm_api/common/exception.py index d76d0825..388b75e1 100644 --- a/service-mgmt-api/sm-api/sm_api/common/exception.py +++ b/service-mgmt-api/sm-api/sm_api/common/exception.py @@ -140,7 +140,7 @@ class SmApiException(Exception): if not message: try: - message = self.message % kwargs + message = self.message % kwargs # pylint: disable=W1645 except Exception as e: # kwargs doesn't match a variable in the message @@ -153,7 +153,7 @@ class SmApiException(Exception): raise e else: # at least get the core message out if something happened - message = self.message + message = self.message # pylint: disable=W1645 super(SmApiException, self).__init__(message) diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/models.py b/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/models.py index d07cff7b..2d87a9a3 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/models.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/models.py @@ -73,7 +73,7 @@ class ModelBase(object): self._i = iter(columns) return self - def next(self): + def next(self): # pylint: disable=next-method-defined n = next(self._i) return n, getattr(self, n) diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/log.py b/service-mgmt-api/sm-api/sm_api/openstack/common/log.py index da8897b7..ed5a6ff9 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/log.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/log.py @@ -345,7 +345,7 @@ class LogConfigError(Exception): self.err_msg = err_msg def __str__(self): - return self.message % dict(log_config=self.log_config, + return self.message % dict(log_config=self.log_config, # pylint: disable=W1645 err_msg=self.err_msg) @@ -560,4 +560,4 @@ class DeprecatedConfig(Exception): message = _("Fatal call to deprecated config: %(msg)s") def __init__(self, msg): - super(Exception, self).__init__(self.message % dict(msg=msg)) + super(Exception, self).__init__(self.message % dict(msg=msg)) # pylint: disable=W1645 diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rootwrap/wrapper.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rootwrap/wrapper.py index eee5a822..29069d7f 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rootwrap/wrapper.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rootwrap/wrapper.py @@ -23,7 +23,6 @@ from six.moves import configparser import logging import logging.handlers import os -import string from sm_api.openstack.common.rootwrap import filters @@ -116,7 +115,7 @@ def load_filters(filters_path): filterconfig = configparser.RawConfigParser() filterconfig.read(os.path.join(filterdir, filterfile)) for (name, value) in filterconfig.items("Filters"): - filterdefinition = [string.strip(s) for s in value.split(',')] + filterdefinition = [str.strip(s) for s in value.split(',')] newfilter = build_filter(*filterdefinition) if newfilter is None: continue diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/common.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/common.py index 214fc7a4..873c61d9 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/common.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/common.py @@ -83,7 +83,7 @@ class RPCException(Exception): if not message: try: - message = self.message % kwargs + message = self.message % kwargs # pylint: disable=W1645 except Exception: # kwargs doesn't match a variable in the message @@ -92,7 +92,7 @@ class RPCException(Exception): for name, value in kwargs.items(): LOG.error("%s: %s" % (name, value)) # at least get the core message out if something happened - message = self.message + message = self.message # pylint: disable=W1645 super(RPCException, self).__init__(message) diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/timeutils.py b/service-mgmt-api/sm-api/sm_api/openstack/common/timeutils.py index 1462c7a7..16804e38 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/timeutils.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/timeutils.py @@ -174,7 +174,7 @@ def delta_seconds(before, after): return delta.total_seconds() except AttributeError: return ((delta.days * 24 * 3600) + delta.seconds + - float(delta.microseconds) / (10 ** 6)) + float(delta.microseconds) / (10 ** 6)) # pylint: disable=old-division def is_soon(dt, window): diff --git a/service-mgmt-client/sm-client/sm_client/common/base.py b/service-mgmt-client/sm-client/sm_client/common/base.py index 18d3b2bf..0f282eca 100644 --- a/service-mgmt-client/sm-client/sm_client/common/base.py +++ b/service-mgmt-client/sm-client/sm_client/common/base.py @@ -137,6 +137,9 @@ class Resource(object): return self.id == other.id return self._info == other._info + def __hash__(self): + return hash(self.manager, self._info, self._loaded) + def is_loaded(self): return self._loaded diff --git a/service-mgmt-client/sm-client/sm_client/common/http.py b/service-mgmt-client/sm-client/sm_client/common/http.py index 88e4b531..93e0c2c8 100644 --- a/service-mgmt-client/sm-client/sm_client/common/http.py +++ b/service-mgmt-client/sm-client/sm_client/common/http.py @@ -289,7 +289,7 @@ class ResponseBodyIterator(object): while True: yield next(self) - def next(self): + def next(self): # pylint: disable=next-method-defined chunk = self.resp.read(CHUNKSIZE) if chunk: return chunk diff --git a/service-mgmt-client/sm-client/sm_client/v1/smc_service_node_shell.py b/service-mgmt-client/sm-client/sm_client/v1/smc_service_node_shell.py index 8b603d6c..775e33bc 100644 --- a/service-mgmt-client/sm-client/sm_client/v1/smc_service_node_shell.py +++ b/service-mgmt-client/sm-client/sm_client/v1/smc_service_node_shell.py @@ -6,6 +6,7 @@ # SPDX-License-Identifier: Apache-2.0 # # +from __future__ import print_function from sm_client import exc from sm_client.common import utils diff --git a/service-mgmt-client/sm-client/sm_client/v1/smc_service_shell.py b/service-mgmt-client/sm-client/sm_client/v1/smc_service_shell.py index ce36f89d..a737f802 100644 --- a/service-mgmt-client/sm-client/sm_client/v1/smc_service_shell.py +++ b/service-mgmt-client/sm-client/sm_client/v1/smc_service_shell.py @@ -6,6 +6,8 @@ # SPDX-License-Identifier: Apache-2.0 # # +from __future__ import print_function + import socket from sm_client.common import utils diff --git a/service-mgmt-client/sm-client/sm_client/v1/smc_servicegroup_shell.py b/service-mgmt-client/sm-client/sm_client/v1/smc_servicegroup_shell.py index 511e280d..eec7cc4b 100644 --- a/service-mgmt-client/sm-client/sm_client/v1/smc_servicegroup_shell.py +++ b/service-mgmt-client/sm-client/sm_client/v1/smc_servicegroup_shell.py @@ -6,6 +6,7 @@ # SPDX-License-Identifier: Apache-2.0 # # +from __future__ import print_function from sm_client.common import utils from sm_client import exc diff --git a/service-mgmt-tools/sm-tools/sm_tools/sm_action.py b/service-mgmt-tools/sm-tools/sm_tools/sm_action.py index b64dc24a..852589e5 100644 --- a/service-mgmt-tools/sm-tools/sm_tools/sm_action.py +++ b/service-mgmt-tools/sm-tools/sm_tools/sm_action.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: Apache-2.0 # +from __future__ import print_function + import os import sys import argparse diff --git a/service-mgmt-tools/sm-tools/sm_tools/sm_api_msg_utils.py b/service-mgmt-tools/sm-tools/sm_tools/sm_api_msg_utils.py index 21d1d7a2..ebd3962a 100644 --- a/service-mgmt-tools/sm-tools/sm_tools/sm_api_msg_utils.py +++ b/service-mgmt-tools/sm-tools/sm_tools/sm_api_msg_utils.py @@ -4,6 +4,8 @@ # SPDX-License-Identifier: Apache-2.0 # +from __future__ import print_function + import time import socket diff --git a/service-mgmt-tools/sm-tools/sm_tools/sm_configure.py b/service-mgmt-tools/sm-tools/sm_tools/sm_configure.py index 5f35cc50..e491e40f 100644 --- a/service-mgmt-tools/sm-tools/sm_tools/sm_configure.py +++ b/service-mgmt-tools/sm-tools/sm_tools/sm_configure.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: Apache-2.0 # +from __future__ import print_function import sys import argparse import sqlite3 diff --git a/service-mgmt-tools/sm-tools/sm_tools/sm_dump.py b/service-mgmt-tools/sm-tools/sm_tools/sm_dump.py index 52e91e62..36ac2a01 100755 --- a/service-mgmt-tools/sm-tools/sm_tools/sm_dump.py +++ b/service-mgmt-tools/sm-tools/sm_tools/sm_dump.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: Apache-2.0 # +from __future__ import print_function + import os import sys import argparse diff --git a/service-mgmt-tools/sm-tools/sm_tools/sm_provision.py b/service-mgmt-tools/sm-tools/sm_tools/sm_provision.py index cecbe316..0abb0ba7 100755 --- a/service-mgmt-tools/sm-tools/sm_tools/sm_provision.py +++ b/service-mgmt-tools/sm-tools/sm_tools/sm_provision.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: Apache-2.0 # +from __future__ import print_function + import os import sys import argparse diff --git a/service-mgmt-tools/sm-tools/sm_tools/sm_query.py b/service-mgmt-tools/sm-tools/sm_tools/sm_query.py index 827d4e7e..d8b7d152 100644 --- a/service-mgmt-tools/sm-tools/sm_tools/sm_query.py +++ b/service-mgmt-tools/sm-tools/sm_tools/sm_query.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: Apache-2.0 # +from __future__ import print_function + import os import sys import argparse