misc: remove usage of "six" module (#64409)
This commit is contained in:
parent
b15faef46b
commit
b84dab5df1
|
@ -17,10 +17,10 @@
|
|||
# borrowed from https://pypi.python.org/pypi/suds_requests
|
||||
# and https://docs.oracle.com/cd/E50245_01/E50253/html/vmprg-soap-example-authentication-python.html
|
||||
|
||||
from io import BytesIO
|
||||
import requests
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.six import BytesIO
|
||||
from suds.transport.http import HttpAuthenticated
|
||||
from suds.transport import Reply
|
||||
from suds.client import Client
|
||||
|
|
|
@ -19,12 +19,11 @@ from datetime import datetime
|
|||
import logging
|
||||
import re
|
||||
import requests
|
||||
import urllib.parse
|
||||
|
||||
from django.views.generic import DetailView as GenericDetailView
|
||||
from django.utils import six
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.six.moves.urllib import parse as urlparse
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
from passerelle.compat import json_loads
|
||||
|
@ -96,11 +95,11 @@ class ResourceView(DetailView):
|
|||
|
||||
# get formdef schema from wcs API
|
||||
url = formdata['url']
|
||||
p = urlparse.urlsplit(url)
|
||||
p = urllib.parse.urlsplit(url)
|
||||
scheme, netloc, path, query, fragment = \
|
||||
p.scheme, p.netloc, p.path, p.query, p.fragment
|
||||
schema_path = path.rsplit('/', 2)[0] + '/schema'
|
||||
schema_url = urlparse.urlunsplit((scheme, netloc, schema_path, query, fragment))
|
||||
schema_url = urllib.parse.urlunsplit((scheme, netloc, schema_path, query, fragment))
|
||||
schema = requests.get(schema_url).json()
|
||||
|
||||
# storeAttachmentResource attachments: list, build from formdata file fields
|
||||
|
@ -204,7 +203,7 @@ class ResourceView(DetailView):
|
|||
data.type = 'date'
|
||||
value = datetime.strptime(value[:19], '%Y-%m-%dT%H:%M:%S')
|
||||
value = value.strftime('%d-%m-%Y %H:%M:%S')
|
||||
elif isinstance(value, six.string_types):
|
||||
elif isinstance(value, str):
|
||||
data.type = 'string'
|
||||
elif isinstance(value, int):
|
||||
data.type = 'integer'
|
||||
|
@ -233,7 +232,7 @@ class ResourceView(DetailView):
|
|||
data.type = 'date'
|
||||
value = datetime.strptime(value[:19], '%Y-%m-%dT%H:%M:%S')
|
||||
value = value.strftime('%d-%m-%Y %H:%M:%S')
|
||||
elif isinstance(value, six.string_types):
|
||||
elif isinstance(value, str):
|
||||
data.type = 'string'
|
||||
elif isinstance(value, int):
|
||||
data.type = 'int'
|
||||
|
@ -393,11 +392,11 @@ class AttachmentView(DetailView):
|
|||
|
||||
# get formdef schema from wcs API
|
||||
url = formdata['url']
|
||||
p = urlparse.urlsplit(url)
|
||||
p = urllib.parse.urlsplit(url)
|
||||
scheme, netloc, path, query, fragment = \
|
||||
p.scheme, p.netloc, p.path, p.query, p.fragment
|
||||
schema_path = path.rsplit('/', 2)[0] + '/schema'
|
||||
schema_url = urlparse.urlunsplit((scheme, netloc, schema_path, query, fragment))
|
||||
schema_url = urllib.parse.urlunsplit((scheme, netloc, schema_path, query, fragment))
|
||||
schema = requests.get(schema_url).json()
|
||||
|
||||
regexp_filename_search_pattern_in_label, filename_result_pattern = self.prepare_regexp_filename_replacement(extras)
|
||||
|
@ -494,11 +493,11 @@ class DebugView(DetailView):
|
|||
|
||||
# get formdef schema from wcs API
|
||||
url = formdata['url']
|
||||
p = urlparse.urlsplit(url)
|
||||
p = urllib.parse.urlsplit(url)
|
||||
scheme, netloc, path, query, fragment = \
|
||||
p.scheme, p.netloc, p.path, p.query, p.fragment
|
||||
schema_path = path.rsplit('/', 2)[0] + '/schema'
|
||||
schema_url = urlparse.urlunsplit((scheme, netloc, schema_path, query, fragment))
|
||||
schema_url = urllib.parse.urlunsplit((scheme, netloc, schema_path, query, fragment))
|
||||
schema = requests.get(schema_url).json()
|
||||
|
||||
# storeAttachmentResource attachments: list, build from formdata file fields
|
||||
|
@ -608,7 +607,7 @@ class DebugView(DetailView):
|
|||
data.type = 'date'
|
||||
value = datetime.strptime(value[:19], '%Y-%m-%dT%H:%M:%S')
|
||||
value = value.strftime('%d-%m-%Y %H:%M:%S')
|
||||
elif isinstance(value, six.string_types):
|
||||
elif isinstance(value, str):
|
||||
data.type = 'string'
|
||||
elif isinstance(value, int):
|
||||
data.type = 'integer'
|
||||
|
@ -637,7 +636,7 @@ class DebugView(DetailView):
|
|||
data.type = 'date'
|
||||
value = datetime.strptime(value[:19], '%Y-%m-%dT%H:%M:%S')
|
||||
value = value.strftime('%d-%m-%Y %H:%M:%S')
|
||||
elif isinstance(value, six.string_types):
|
||||
elif isinstance(value, str):
|
||||
data.type = 'string'
|
||||
elif isinstance(value, int):
|
||||
data.type = 'int'
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
# borrowed from https://pypi.python.org/pypi/suds_requests
|
||||
# and https://docs.oracle.com/cd/E50245_01/E50253/html/vmprg-soap-example-authentication-python.html
|
||||
|
||||
from io import BytesIO
|
||||
import requests
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.six import BytesIO
|
||||
from suds.transport.http import HttpAuthenticated
|
||||
from suds.transport import Reply
|
||||
from suds.client import Client
|
||||
|
|
|
@ -5,14 +5,10 @@ import django_webtest
|
|||
|
||||
from django.core.files import File
|
||||
from django.core.cache import cache
|
||||
from django.utils import six
|
||||
from io import BytesIO
|
||||
|
||||
from utils import make_resource
|
||||
|
||||
if six.PY2:
|
||||
collect_ignore = ['wcs/']
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def media(settings, tmpdir):
|
||||
|
|
|
@ -2,10 +2,10 @@ import json
|
|||
|
||||
import mock
|
||||
import httmock
|
||||
import urllib.parse
|
||||
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.urls import reverse
|
||||
from django.utils.six.moves.urllib import parse as urlparse
|
||||
|
||||
from passerelle.base.models import ApiUser, AccessRight
|
||||
from passerelle.compat import json_loads
|
||||
|
@ -35,7 +35,7 @@ class FakedResponse(mock.Mock):
|
|||
def mock_url(url=None, response='', status_code=200, headers=None):
|
||||
urlmatch_kwargs = {}
|
||||
if url:
|
||||
parsed = urlparse.urlparse(url)
|
||||
parsed = urllib.parse.urlparse(url)
|
||||
if parsed.netloc:
|
||||
urlmatch_kwargs['netloc'] = parsed.netloc
|
||||
if parsed.path:
|
||||
|
|
Loading…
Reference in New Issue