diff --git a/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/rest_api.py b/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/rest_api.py index 611553d7..64551b45 100755 --- a/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/rest_api.py +++ b/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/rest_api.py @@ -5,14 +5,14 @@ # import json import re +from six.moves import BaseHTTPServer from six.moves import http_client as httplib +from six.moves import socketserver as SocketServer from six.moves import urllib + import socket import struct -import BaseHTTPServer -import SocketServer - from nfv_common import debug from nfv_common import selobj from nfv_common import timers diff --git a/nfv/nfv-vim/nfv_vim/webserver/_webserver.py b/nfv/nfv-vim/nfv_vim/webserver/_webserver.py index 44133cd8..01964756 100755 --- a/nfv/nfv-vim/nfv_vim/webserver/_webserver.py +++ b/nfv/nfv-vim/nfv_vim/webserver/_webserver.py @@ -6,14 +6,12 @@ import datetime import json import re +from six.moves import BaseHTTPServer from six.moves import http_client as httplib +from six.moves import socketserver import socket import threading -from BaseHTTPServer import BaseHTTPRequestHandler -from BaseHTTPServer import HTTPServer -from SocketServer import ThreadingMixIn - from nfv_common import debug from nfv_plugins.nfvi_plugins import config from nfv_plugins.nfvi_plugins.openstack import fm @@ -38,10 +36,10 @@ def _bare_address_string(self): return "%s" % host -BaseHTTPRequestHandler.address_string = _bare_address_string +BaseHTTPServer.BaseHTTPRequestHandler.address_string = _bare_address_string -class HTTPRequestHandler(BaseHTTPRequestHandler): +class HTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): """ HTTP Request Handler """ @@ -569,7 +567,7 @@ class HTTPRequestHandler(BaseHTTPRequestHandler): self.wfile.write(f.read()) -class ThreadedHTTPServer(ThreadingMixIn, HTTPServer): +class ThreadedHTTPServer(socketserver.ThreadingMixIn, BaseHTTPServer.HTTPServer): """ Threaded HTTP Server """ @@ -577,7 +575,7 @@ class ThreadedHTTPServer(ThreadingMixIn, HTTPServer): def shutdown(self): self.socket.close() - HTTPServer.shutdown(self) + BaseHTTPServer.HTTPServer.shutdown(self) class SimpleHttpServer(object): diff --git a/nfv/pylint.rc b/nfv/pylint.rc index d07e8d54..881e9ce3 100755 --- a/nfv/pylint.rc +++ b/nfv/pylint.rc @@ -26,6 +26,7 @@ load-plugins= # can either give multiple identifier separated by comma (,) or put this option # multiple time (only on the command line, not in the configuration file where # it should appear only once). +# W0107: Unnecessary pass statement (unnecessary-pass) # W0120 useless-else-on-loop # W0125 using-constant-test # W0212 protected-access var starting with _ used outside class or descendant @@ -42,9 +43,12 @@ load-plugins= # W0621 redefined-outer-name # W0622 redefined-builtin # W0703 broad except warning +# W0706: The except handler raises immediately (try-except-raise) # W1401 anomalous-backslash-in-string +# W1505: Using deprecated method getargspec() (deprecated-method) disable=C, R, W0120, W0125, W0212, W0221, W0223, W0231, W0235, - W0401, W0404, W0511, W0603, W0612, W0613, W0621, W0622, W0703, W1401 + W0401, W0404, W0511, W0603, W0612, W0613, W0621, W0622, W0703, W1401, + W0107, W0706, W1505 [REPORTS] @@ -98,7 +102,13 @@ ignore-mixin-members=yes # List of classes names for which member attributes should not be checked # (useful for classes with attributes dynamically set). # The following VIM objects are ignored: ObjectData, GuestService, Network, SwUpdate -ignored-classes=SQLObject,sqlalchemy,scoped_session,_socketobject,ObjectData,GuestService,Network,SwUpdate +# The following Openstack plugin object is ignored: OpenStackRestAPIException +ignored-classes=SQLObject,sqlalchemy,scoped_session,_socketobject,ObjectData,GuestService, + Network,SwUpdate,OpenStackRestAPIException + +# For compatibility of python2 and python 3, we import six.moves module, and +# the following py3 modules are ignored: http.client, urllib.request +ignored-modules=http.client,urllib.request # List of members which are set dynamically and missed by pylint inference # system, and so shouldn't trigger E0201 when accessed. Python regular diff --git a/nfv/tox.ini b/nfv/tox.ini index 07f9aa7c..0d76b63c 100755 --- a/nfv/tox.ini +++ b/nfv/tox.ini @@ -97,7 +97,6 @@ deps = {[nfv]deps} mock testtools pylint -basepython = python2.7 commands = pylint {[nfv]nfv_client_src_dir} \ {[nfv]nfv_common_src_dir} \ {[nfv]nfv_plugins_src_dir} \ diff --git a/nova-api-proxy/nova-api-proxy/nova_api_proxy/apps/proxy.py b/nova-api-proxy/nova-api-proxy/nova_api_proxy/apps/proxy.py index 80e8b97b..3793bff7 100644 --- a/nova-api-proxy/nova-api-proxy/nova_api_proxy/apps/proxy.py +++ b/nova-api-proxy/nova-api-proxy/nova_api_proxy/apps/proxy.py @@ -12,9 +12,9 @@ # SPDX-License-Identifier: Apache-2.0 # -import httplib from paste.proxy import parse_headers from paste.proxy import TransparentProxy +from six.moves import http_client as httplib import urllib from oslo_log import log as logging