Remove dependent module py3kcompat
Module py3kcompat was removed from oslo-incubator, we can use six directly. Change-Id: Ib75c8963b9429d67a3c09cd0b4815379693e250a Closes-Bug: #1280033
This commit is contained in:
parent
82fd114017
commit
94d91e6e06
@ -14,9 +14,9 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from stackalytics.openstack.common import log as logging
|
from stackalytics.openstack.common import log as logging
|
||||||
from stackalytics.openstack.common.py3kcompat import urlutils
|
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -68,7 +68,7 @@ def get_parameter(kwargs, singular_name, plural_name=None, use_default=True):
|
|||||||
if (not p) and plural_name:
|
if (not p) and plural_name:
|
||||||
p = flask.request.args.get(plural_name)
|
p = flask.request.args.get(plural_name)
|
||||||
if p:
|
if p:
|
||||||
return urlutils.unquote_plus(p).split(',')
|
return parse.unquote_plus(p).split(',')
|
||||||
elif use_default:
|
elif use_default:
|
||||||
default = get_default(singular_name)
|
default = get_default(singular_name)
|
||||||
return [default] if default else []
|
return [default] if default else []
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
module=importutils
|
module=importutils
|
||||||
module=jsonutils
|
module=jsonutils
|
||||||
module=log
|
module=log
|
||||||
module=py3kcompat
|
|
||||||
module=timeutils
|
module=timeutils
|
||||||
|
|
||||||
# The base module to hold the copy of oslo-incubator
|
# The base module to hold the copy of oslo-incubator
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright 2013 Canonical Ltd.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
Python2/Python3 compatibility layer for OpenStack
|
|
||||||
"""
|
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
if six.PY3:
|
|
||||||
# python3
|
|
||||||
import urllib.error
|
|
||||||
import urllib.parse
|
|
||||||
import urllib.request
|
|
||||||
|
|
||||||
urlencode = urllib.parse.urlencode
|
|
||||||
urljoin = urllib.parse.urljoin
|
|
||||||
quote = urllib.parse.quote
|
|
||||||
quote_plus = urllib.parse.quote_plus
|
|
||||||
parse_qsl = urllib.parse.parse_qsl
|
|
||||||
unquote = urllib.parse.unquote
|
|
||||||
unquote_plus = urllib.parse.unquote_plus
|
|
||||||
urlparse = urllib.parse.urlparse
|
|
||||||
urlsplit = urllib.parse.urlsplit
|
|
||||||
urlunsplit = urllib.parse.urlunsplit
|
|
||||||
SplitResult = urllib.parse.SplitResult
|
|
||||||
|
|
||||||
urlopen = urllib.request.urlopen
|
|
||||||
URLError = urllib.error.URLError
|
|
||||||
pathname2url = urllib.request.pathname2url
|
|
||||||
else:
|
|
||||||
# python2
|
|
||||||
import urllib
|
|
||||||
import urllib2
|
|
||||||
import urlparse
|
|
||||||
|
|
||||||
urlencode = urllib.urlencode
|
|
||||||
quote = urllib.quote
|
|
||||||
quote_plus = urllib.quote_plus
|
|
||||||
unquote = urllib.unquote
|
|
||||||
unquote_plus = urllib.unquote_plus
|
|
||||||
|
|
||||||
parse = urlparse
|
|
||||||
parse_qsl = parse.parse_qsl
|
|
||||||
urljoin = parse.urljoin
|
|
||||||
urlparse = parse.urlparse
|
|
||||||
urlsplit = parse.urlsplit
|
|
||||||
urlunsplit = parse.urlunsplit
|
|
||||||
SplitResult = parse.SplitResult
|
|
||||||
|
|
||||||
urlopen = urllib2.urlopen
|
|
||||||
URLError = urllib2.URLError
|
|
||||||
pathname2url = urllib.pathname2url
|
|
@ -15,8 +15,9 @@
|
|||||||
|
|
||||||
import httplib
|
import httplib
|
||||||
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from stackalytics.openstack.common import log as logging
|
from stackalytics.openstack.common import log as logging
|
||||||
from stackalytics.openstack.common.py3kcompat import urlutils
|
|
||||||
from stackalytics.processor import utils
|
from stackalytics.processor import utils
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ def lp_profile_by_email(email):
|
|||||||
|
|
||||||
def lp_module_exists(module):
|
def lp_module_exists(module):
|
||||||
uri = LP_URI_DEVEL % module
|
uri = LP_URI_DEVEL % module
|
||||||
parsed_uri = urlutils.urlparse(uri)
|
parsed_uri = parse.urlparse(uri)
|
||||||
conn = httplib.HTTPConnection(parsed_uri.netloc)
|
conn = httplib.HTTPConnection(parsed_uri.netloc)
|
||||||
conn.request('GET', parsed_uri.path)
|
conn.request('GET', parsed_uri.path)
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
|
@ -18,10 +18,10 @@ import collections
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
import psutil
|
import psutil
|
||||||
import six
|
import six
|
||||||
|
from six.moves.urllib import parse
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from stackalytics.openstack.common import log as logging
|
from stackalytics.openstack.common import log as logging
|
||||||
from stackalytics.openstack.common.py3kcompat import urlutils
|
|
||||||
from stackalytics.processor import config
|
from stackalytics.processor import config
|
||||||
from stackalytics.processor import default_data_processor
|
from stackalytics.processor import default_data_processor
|
||||||
from stackalytics.processor import lp
|
from stackalytics.processor import lp
|
||||||
@ -103,7 +103,7 @@ def process_repo(repo, runtime_storage_inst, record_processor_inst):
|
|||||||
for branch in branches:
|
for branch in branches:
|
||||||
LOG.debug('Processing repo %s, branch %s', uri, branch)
|
LOG.debug('Processing repo %s, branch %s', uri, branch)
|
||||||
|
|
||||||
vcs_key = 'vcs:' + str(urlutils.quote_plus(uri) + ':' + branch)
|
vcs_key = 'vcs:' + str(parse.quote_plus(uri) + ':' + branch)
|
||||||
last_id = runtime_storage_inst.get_by_key(vcs_key)
|
last_id = runtime_storage_inst.get_by_key(vcs_key)
|
||||||
|
|
||||||
commit_iterator = vcs_inst.log(branch, last_id)
|
commit_iterator = vcs_inst.log(branch, last_id)
|
||||||
@ -118,7 +118,7 @@ def process_repo(repo, runtime_storage_inst, record_processor_inst):
|
|||||||
|
|
||||||
LOG.debug('Processing reviews for repo %s, branch %s', uri, branch)
|
LOG.debug('Processing reviews for repo %s, branch %s', uri, branch)
|
||||||
|
|
||||||
rcs_key = 'rcs:' + str(urlutils.quote_plus(uri) + ':' + branch)
|
rcs_key = 'rcs:' + str(parse.quote_plus(uri) + ':' + branch)
|
||||||
last_id = runtime_storage_inst.get_by_key(rcs_key)
|
last_id = runtime_storage_inst.get_by_key(rcs_key)
|
||||||
|
|
||||||
review_iterator = rcs_inst.log(branch, last_id)
|
review_iterator = rcs_inst.log(branch, last_id)
|
||||||
|
@ -20,9 +20,9 @@ import re
|
|||||||
import StringIO
|
import StringIO
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from stackalytics.openstack.common import log as logging
|
from stackalytics.openstack.common import log as logging
|
||||||
from stackalytics.openstack.common.py3kcompat import urlutils
|
|
||||||
from stackalytics.processor import utils
|
from stackalytics.processor import utils
|
||||||
|
|
||||||
|
|
||||||
@ -59,12 +59,12 @@ def _get_mail_archive_links(uri):
|
|||||||
content = utils.read_uri(uri)
|
content = utils.read_uri(uri)
|
||||||
links = set(re.findall(r'\shref\s*=\s*[\'"]([^\'"]*\.txt\.gz)', content,
|
links = set(re.findall(r'\shref\s*=\s*[\'"]([^\'"]*\.txt\.gz)', content,
|
||||||
flags=re.IGNORECASE))
|
flags=re.IGNORECASE))
|
||||||
return [urlutils.urljoin(uri, link) for link in links]
|
return [parse.urljoin(uri, link) for link in links]
|
||||||
|
|
||||||
|
|
||||||
def _link_content_changed(link, runtime_storage_inst):
|
def _link_content_changed(link, runtime_storage_inst):
|
||||||
LOG.debug('Check changes for mail archive located at uri: %s', link)
|
LOG.debug('Check changes for mail archive located at uri: %s', link)
|
||||||
parsed_uri = urlutils.urlparse(link)
|
parsed_uri = parse.urlparse(link)
|
||||||
conn = httplib.HTTPConnection(parsed_uri.netloc)
|
conn = httplib.HTTPConnection(parsed_uri.netloc)
|
||||||
conn.request('HEAD', parsed_uri.path)
|
conn.request('HEAD', parsed_uri.path)
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
|
@ -21,9 +21,10 @@ import time
|
|||||||
|
|
||||||
import iso8601
|
import iso8601
|
||||||
import six
|
import six
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
from six.moves.urllib import request
|
||||||
|
|
||||||
from stackalytics.openstack.common import log as logging
|
from stackalytics.openstack.common import log as logging
|
||||||
from stackalytics.openstack.common.py3kcompat import urlutils
|
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -68,7 +69,7 @@ def check_email_validity(email):
|
|||||||
|
|
||||||
def read_uri(uri):
|
def read_uri(uri):
|
||||||
try:
|
try:
|
||||||
fd = urlutils.urlopen(uri)
|
fd = request.urlopen(uri)
|
||||||
raw = fd.read()
|
raw = fd.read()
|
||||||
fd.close()
|
fd.close()
|
||||||
return raw
|
return raw
|
||||||
@ -169,4 +170,4 @@ def add_index(sequence, start=1, item_filter=lambda x: True):
|
|||||||
|
|
||||||
|
|
||||||
def safe_encode(s):
|
def safe_encode(s):
|
||||||
return urlutils.quote_plus(s.encode('utf-8'))
|
return parse.quote_plus(s.encode('utf-8'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user