python3: fixed urlparse import

This commit is contained in:
RhodeCode Admin 2023-03-06 23:02:03 +01:00
parent c03eb06e26
commit f7091556fd
14 changed files with 34 additions and 34 deletions

View file

@ -18,7 +18,7 @@
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
import urlparse
import urllib.parse
import mock
import pytest
@ -147,7 +147,7 @@ class TestLoginController(object):
h.route_path('repo_summary', repo_name=HG_REPO, _query=kwargs),
status=302)
response_query = urlparse.parse_qsl(response.location)
response_query = urllib.parse.urlparse.parse_qsl(response.location)
assert 'branch=stable' in response_query[0][1]
def test_login_form_with_get_args(self):

View file

@ -24,7 +24,7 @@ import datetime
import formencode
import formencode.htmlfill
import logging
import urlparse
import urllib.parse
import requests
from pyramid.httpexceptions import HTTPFound
@ -90,7 +90,7 @@ def store_user_in_session(session, username, remember=False):
def get_came_from(request):
came_from = safe_str(request.GET.get('came_from', ''))
parsed = urlparse.urlparse(came_from)
parsed = urllib.parse.urlparse.urlparse(came_from)
allowed_schemes = ['http', 'https']
default_came_from = h.route_path('home')
if parsed.scheme and parsed.scheme not in allowed_schemes:

View file

@ -25,7 +25,7 @@ import logging
import signal
import tempfile
from subprocess import Popen, PIPE
import urlparse
import urllib.parse
from .base import VcsServer
@ -202,7 +202,7 @@ class SubversionTunnelWrapper(object):
if not first_response:
return self.fail("Repository name cannot be extracted")
url_parts = urlparse.urlparse(first_response['url'])
url_parts = urllib.parse.urlparse.urlparse(first_response['url'])
self.server.repo_name = self._match_repo_name(url_parts.path.strip('/'))

View file

@ -27,7 +27,7 @@ import re
import os
import lxml
import logging
import urlparse
import urllib.parse
import bleach
from mako.lookup import TemplateLookup
@ -142,7 +142,7 @@ def relative_path(path, request_path, is_repo_file=None):
# skip data, anchor, invalid links
return path
is_absolute = bool(urlparse.urlparse(path).netloc)
is_absolute = bool(urllib.parse.urlparse.urlparse(path).netloc)
if is_absolute:
return path

View file

@ -25,7 +25,7 @@ It's implemented with basic auth function
import os
import re
import logging
import urlparse
import urllib.parse
import rhodecode
from rhodecode.lib import utils
@ -123,7 +123,7 @@ class SimpleGit(simplevcs.SimpleVCS):
path = environ['PATH_INFO']
if path.endswith('/info/refs'):
query = urlparse.parse_qs(environ['QUERY_STRING'])
query = urllib.parse.urlparse.parse_qs(environ['QUERY_STRING'])
service_cmd = query.get('service', [''])[0]
return self._ACTION_MAPPING.get(service_cmd, 'pull')

View file

@ -24,7 +24,7 @@ SimpleHG middleware for handling mercurial protocol request
"""
import logging
import urlparse
import urllib.parse
import urllib.request, urllib.parse, urllib.error
from rhodecode.lib import utils
@ -135,7 +135,7 @@ class SimpleHg(simplevcs.SimpleVCS):
:param environ:
"""
default = 'push'
query = urlparse.parse_qs(environ['QUERY_STRING'],
query = urllib.parse.urlparse.parse_qs(environ['QUERY_STRING'],
keep_blank_values=True)
if 'cmd' in query:

View file

@ -21,7 +21,7 @@
import base64
import logging
import urllib.request, urllib.parse, urllib.error
import urlparse
import urllib.parse
import requests
from pyramid.httpexceptions import HTTPNotAcceptable
@ -123,7 +123,7 @@ class SimpleSvnApp(object):
def _get_url(self, svn_http_server, path):
svn_http_server_url = (svn_http_server or '').rstrip('/')
url_path = urlparse.urljoin(svn_http_server_url + '/', (path or '').lstrip('/'))
url_path = urllib.parse.urlparse.urljoin(svn_http_server_url + '/', (path or '').lstrip('/'))
url_path = urllib.parse.quote(url_path, safe="/:=~+!$,;'")
return url_path

View file

@ -24,7 +24,7 @@ Implementation of the scm_app interface using raw HTTP communication.
import base64
import logging
import urlparse
import urllib.parse
import wsgiref.util
import msgpack
@ -111,7 +111,7 @@ class VcsHttpProxy(object):
# Preserve the query string
url = self._url
url = urlparse.urljoin(url, self._repo_name)
url = urllib.parse.urlparse.urljoin(url, self._repo_name)
if environ.get('QUERY_STRING'):
url += '?' + environ['QUERY_STRING']

View file

@ -22,7 +22,7 @@ import gzip
import shutil
import logging
import tempfile
import urlparse
import urllib.parse
from webob.exc import HTTPNotFound
@ -61,7 +61,7 @@ def is_hg(environ):
http_accept = environ.get('HTTP_ACCEPT')
if http_accept and http_accept.startswith('application/mercurial'):
query = urlparse.parse_qs(environ['QUERY_STRING'])
query = urllib.parse.urlparse.parse_qs(environ['QUERY_STRING'])
if 'cmd' in query:
is_hg_path = True

View file

@ -27,7 +27,7 @@ import logging
import threading
import time
import urllib.request, urllib.error, urllib.parse
import urlparse
import urllib.parse
import uuid
import traceback
@ -132,7 +132,7 @@ def _streaming_remote_call(url, payload, exceptions_map, session, chunk_size):
class ServiceConnection(object):
def __init__(self, server_and_port, backend_endpoint, session_factory):
self.url = urlparse.urljoin('http://%s' % server_and_port, backend_endpoint)
self.url = urllib.parse.urlparse.urljoin('http://%s' % server_and_port, backend_endpoint)
self._session_factory = session_factory
def __getattr__(self, name):
@ -154,8 +154,8 @@ class ServiceConnection(object):
class RemoteVCSMaker(object):
def __init__(self, server_and_port, backend_endpoint, backend_type, session_factory):
self.url = urlparse.urljoin('http://%s' % server_and_port, backend_endpoint)
self.stream_url = urlparse.urljoin('http://%s' % server_and_port, backend_endpoint+'/stream')
self.url = urllib.parse.urlparse.urljoin('http://%s' % server_and_port, backend_endpoint)
self.stream_url = urllib.parse.urlparse.urljoin('http://%s' % server_and_port, backend_endpoint+'/stream')
self._session_factory = session_factory
self.backend_type = backend_type
@ -356,7 +356,7 @@ class VcsHttpProxy(object):
retries = Retry(total=5, connect=None, read=None, redirect=None)
adapter = requests.adapters.HTTPAdapter(max_retries=retries)
self.base_url = urlparse.urljoin('http://%s' % server_and_port, backend_endpoint)
self.base_url = urllib.parse.urlparse.urljoin('http://%s' % server_and_port, backend_endpoint)
self.session = requests.Session()
self.session.mount('http://', adapter)

View file

@ -21,7 +21,7 @@
import logging
import deform.widget
from deform.widget import null, OptGroup, string_types
from deform.widget import null, OptGroup
log = logging.getLogger(__name__)
@ -34,7 +34,7 @@ def _normalize_choices(values):
result.append(OptGroup(item.label, *normalized_options))
else:
value, description, help_block = item
if not isinstance(value, string_types):
if not isinstance(value, str):
value = str(value)
result.append((value, description, help_block))
return result

View file

@ -19,7 +19,7 @@
# and proprietary license terms, please see https://rhodecode.com/licenses/
import pytest
import urlparse
import urllib.parse
import mock
import simplejson as json
@ -30,7 +30,7 @@ import rhodecode.lib.middleware.simplegit as simplegit
def get_environ(url, request_method):
"""Construct a minimum WSGI environ based on the URL."""
parsed_url = urlparse.urlparse(url)
parsed_url = urllib.parse.urlparse.urlparse(url)
environ = {
'PATH_INFO': parsed_url.path,
'QUERY_STRING': parsed_url.query,

View file

@ -18,7 +18,7 @@
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
import urlparse
import urllib.parse
import mock
import pytest
@ -31,7 +31,7 @@ import rhodecode.lib.middleware.simplehg as simplehg
def get_environ(url):
"""Construct a minimum WSGI environ based on the URL."""
parsed_url = urlparse.urlparse(url)
parsed_url = urllib.parse.urlparse.urlparse(url)
environ = {
'PATH_INFO': parsed_url.path,
'QUERY_STRING': parsed_url.query,

View file

@ -27,11 +27,11 @@ import tempfile
import urllib.request, urllib.error, urllib.parse
from lxml.html import fromstring, tostring
from lxml.cssselect import CSSSelector
from urlparse import urlparse, parse_qsl
import urllib.parse.urlparse
from urllib.parse import unquote_plus
import webob
from webtest.app import TestResponse, TestApp, string_types
from webtest.app import TestResponse, TestApp
from webtest.compat import print_stderr
import pytest
@ -67,7 +67,7 @@ class CustomTestResponse(TestResponse):
if 'no' in kw:
no = kw['no']
del kw['no']
if isinstance(no, string_types):
if isinstance(no, str):
no = [no]
else:
no = []
@ -316,8 +316,8 @@ class _Url(object):
"""
def __init__(self, url):
parts = urlparse(url)
_query = frozenset(parse_qsl(parts.query))
parts = urllib.parse.urlparse(url)
_query = frozenset(urllib.parse.parse_qsl(parts.query))
_path = unquote_plus(parts.path)
parts = parts._replace(query=_query, path=_path)
self.parts = parts