From 2fad54233dde0640d52e4111b11a628ba8a0ce27 Mon Sep 17 00:00:00 2001 From: Fengqian Gao Date: Mon, 10 Mar 2014 10:03:08 +0800 Subject: [PATCH] Use six.moves.urllib.parse instead of urlparse To keep Python 3.x compatibility, use six.moves.urllib.parse to replace urlparse. tools/lintstack is changed to pass pylint test. Partial-Bug: #1279611 Change-Id: I0ceaaccbf6c67b45609b4f2f5639c362b32d10ad --- cinder/api/common.py | 2 +- cinder/image/glance.py | 2 +- cinder/tests/integrated/api/client.py | 3 ++- cinder/tests/test_migrations.py | 2 +- cinder/volume/drivers/coraid.py | 2 +- cinder/volume/drivers/netapp/eseries/client.py | 3 ++- cinder/volume/drivers/netapp/nfs.py | 3 ++- cinder/volume/drivers/nexenta/utils.py | 3 ++- cinder/volume/drivers/scality.py | 2 +- cinder/volume/drivers/vmware/read_write_util.py | 3 ++- tools/lintstack.py | 4 +++- 11 files changed, 18 insertions(+), 11 deletions(-) diff --git a/cinder/api/common.py b/cinder/api/common.py index 9ad0847f6..52802295b 100644 --- a/cinder/api/common.py +++ b/cinder/api/common.py @@ -16,9 +16,9 @@ import os import re -import urlparse from oslo.config import cfg +import six.moves.urllib.parse as urlparse import webob from cinder.api.openstack import wsgi diff --git a/cinder/image/glance.py b/cinder/image/glance.py index aca124387..8fe60a7c3 100644 --- a/cinder/image/glance.py +++ b/cinder/image/glance.py @@ -25,10 +25,10 @@ import random import shutil import sys import time -import urlparse import glanceclient.exc from oslo.config import cfg +import six.moves.urllib.parse as urlparse from cinder import exception from cinder.openstack.common import jsonutils diff --git a/cinder/tests/integrated/api/client.py b/cinder/tests/integrated/api/client.py index 84e878e49..b6787c06e 100644 --- a/cinder/tests/integrated/api/client.py +++ b/cinder/tests/integrated/api/client.py @@ -14,7 +14,8 @@ import netaddr import requests -import urlparse + +import six.moves.urllib.parse as urlparse from cinder.openstack.common import jsonutils from cinder.openstack.common import log as logging diff --git a/cinder/tests/test_migrations.py b/cinder/tests/test_migrations.py index e930ee98c..bba727a17 100644 --- a/cinder/tests/test_migrations.py +++ b/cinder/tests/test_migrations.py @@ -26,10 +26,10 @@ if possible. import ConfigParser import os import subprocess -import urlparse import uuid from migrate.versioning import repository +import six.moves.urllib.parse as urlparse import sqlalchemy import testtools diff --git a/cinder/volume/drivers/coraid.py b/cinder/volume/drivers/coraid.py index be162f945..2aafbb6ff 100644 --- a/cinder/volume/drivers/coraid.py +++ b/cinder/volume/drivers/coraid.py @@ -25,9 +25,9 @@ import cookielib import math import urllib import urllib2 -import urlparse from oslo.config import cfg +import six.moves.urllib.parse as urlparse from cinder import exception from cinder.openstack.common import jsonutils diff --git a/cinder/volume/drivers/netapp/eseries/client.py b/cinder/volume/drivers/netapp/eseries/client.py index 8f4178069..d92af339f 100644 --- a/cinder/volume/drivers/netapp/eseries/client.py +++ b/cinder/volume/drivers/netapp/eseries/client.py @@ -18,7 +18,8 @@ Client classes for web services. import json import requests -import urlparse + +import six.moves.urllib.parse as urlparse from cinder import exception from cinder.openstack.common import log as logging diff --git a/cinder/volume/drivers/netapp/nfs.py b/cinder/volume/drivers/netapp/nfs.py index f0601ae0a..1e5fa3fe1 100644 --- a/cinder/volume/drivers/netapp/nfs.py +++ b/cinder/volume/drivers/netapp/nfs.py @@ -21,9 +21,10 @@ import os import re from threading import Timer import time -import urlparse import uuid +import six.moves.urllib.parse as urlparse + from cinder import exception from cinder.image import image_utils from cinder.openstack.common import excutils diff --git a/cinder/volume/drivers/nexenta/utils.py b/cinder/volume/drivers/nexenta/utils.py index fc032ec1f..42ebe1bee 100644 --- a/cinder/volume/drivers/nexenta/utils.py +++ b/cinder/volume/drivers/nexenta/utils.py @@ -22,7 +22,8 @@ """ import re -import urlparse + +import six.moves.urllib.parse as urlparse from cinder import units diff --git a/cinder/volume/drivers/scality.py b/cinder/volume/drivers/scality.py index 559bfabd4..4343654f7 100644 --- a/cinder/volume/drivers/scality.py +++ b/cinder/volume/drivers/scality.py @@ -20,9 +20,9 @@ Scality SOFS Volume Driver. import errno import os import urllib2 -import urlparse from oslo.config import cfg +import six.moves.urllib.parse as urlparse from cinder import exception from cinder.image import image_utils diff --git a/cinder/volume/drivers/vmware/read_write_util.py b/cinder/volume/drivers/vmware/read_write_util.py index 37263c0dd..f8bb87f41 100644 --- a/cinder/volume/drivers/vmware/read_write_util.py +++ b/cinder/volume/drivers/vmware/read_write_util.py @@ -23,7 +23,8 @@ import httplib import netaddr import urllib import urllib2 -import urlparse + +import six.moves.urllib.parse as urlparse from cinder.openstack.common import log as logging from cinder.volume.drivers.vmware import error_util diff --git a/tools/lintstack.py b/tools/lintstack.py index b4d252c9d..1a79ef3b4 100755 --- a/tools/lintstack.py +++ b/tools/lintstack.py @@ -30,7 +30,9 @@ from six.moves import cStringIO as StringIO ignore_codes = ["E1103"] # Note(maoy): the error message is the pattern of E0202. It should be ignored # for cinder.tests modules -ignore_messages = ["An attribute affected in cinder.tests"] +#Note(fengqian): the second error message is the pattern of [E0611]. +#It should be ignored because use six module to keep py3.X compatibility. +ignore_messages = ["An attribute affected in cinder.tests", "No name 'urllib' in module '_MovedItems'"] # Note(maoy): we ignore all errors in openstack.common because it should be # checked elsewhere. We also ignore cinder.tests for now due to high false # positive rate. -- 2.45.2