From d864464026daed817094de40bd9ee18ee4f93049 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laur=C3=A9line=20Gu=C3=A9rin?= <zebuline@entrouvert.com>
Date: Fri, 9 Jul 2021 16:55:28 +0200
Subject: [PATCH 14/23] misc: fix no-name-in-module pylint error (#55505)

---
 chrono/urls_utils.py             |  4 ++--
 chrono/utils/requests_wrapper.py | 12 ++++++------
 chrono/utils/signature.py        |  8 ++++----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/chrono/urls_utils.py b/chrono/urls_utils.py
index 02aba8f..7f268cc 100644
--- a/chrono/urls_utils.py
+++ b/chrono/urls_utils.py
@@ -19,9 +19,9 @@
 import django
 
 if django.VERSION < (2, 0, 0):
-    from django.urls.resolvers import RegexURLPattern as URLPattern
+    from django.urls.resolvers import RegexURLPattern as URLPattern  # pylint: disable=no-name-in-module
 else:
-    from django.urls.resolvers import URLPattern
+    from django.urls.resolvers import URLPattern  # pylint: disable=no-name-in-module
 
 
 class DecoratedURLPattern(URLPattern):
diff --git a/chrono/utils/requests_wrapper.py b/chrono/utils/requests_wrapper.py
index 4b95d31..747819a 100644
--- a/chrono/utils/requests_wrapper.py
+++ b/chrono/utils/requests_wrapper.py
@@ -16,13 +16,13 @@
 
 import hashlib
 import logging
+from urllib import parse
 
 from django.conf import settings
 from django.core.cache import cache
 from django.utils.encoding import smart_bytes
 from django.utils.http import urlencode
 from django.utils.six import BytesIO
-from django.utils.six.moves.urllib import parse as urlparse
 from requests import Response
 from requests import Session as RequestsSession
 from requests.auth import AuthBase
@@ -60,11 +60,11 @@ class Requests(RequestsSession):
 
         if remote_service == 'auto':
             remote_service = None
-            scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
+            scheme, netloc, path, params, query, fragment = parse.urlparse(url)
             for services in settings.KNOWN_SERVICES.values():
                 for service in services.values():
                     remote_url = service.get('url')
-                    remote_scheme, remote_netloc = urlparse.urlparse(remote_url)[:2]
+                    remote_scheme, remote_netloc = parse.urlparse(remote_url)[:2]
                     if remote_scheme == scheme and remote_netloc == netloc:
                         remote_service = service
                         break
@@ -74,7 +74,7 @@ class Requests(RequestsSession):
             if remote_service:
                 # only keeps the path (URI) in url parameter, scheme and netloc are
                 # in remote_service
-                url = urlparse.urlunparse(('', '', path, params, query, fragment))
+                url = parse.urlunparse(('', '', path, params, query, fragment))
             else:
                 logging.warning('service not found in settings.KNOWN_SERVICES for %s', url)
 
@@ -102,7 +102,7 @@ class Requests(RequestsSession):
             query_params['orig'] = remote_service.get('orig')
 
             remote_service_base_url = remote_service.get('url')
-            scheme, netloc, dummy, params, old_query, fragment = urlparse.urlparse(remote_service_base_url)
+            scheme, netloc, dummy, params, old_query, fragment = parse.urlparse(remote_service_base_url)
 
             query = urlencode(query_params)
             if '?' in url:
@@ -111,7 +111,7 @@ class Requests(RequestsSession):
             else:
                 path = url
 
-            url = urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
+            url = parse.urlunparse((scheme, netloc, path, params, query, fragment))
 
         if method == 'GET' and cache_duration:
             # handle cache
diff --git a/chrono/utils/signature.py b/chrono/utils/signature.py
index 03b929d..8089d51 100644
--- a/chrono/utils/signature.py
+++ b/chrono/utils/signature.py
@@ -19,19 +19,19 @@ import datetime
 import hashlib
 import hmac
 import random
+from urllib import parse
 
 from django.conf import settings
 from django.utils.encoding import smart_bytes
 from django.utils.http import quote, urlencode
-from django.utils.six.moves.urllib import parse as urlparse
 
 # Simple signature scheme for query strings
 
 
 def sign_url(url, key, algo='sha256', timestamp=None, nonce=None):
-    parsed = urlparse.urlparse(url)
+    parsed = parse.urlparse(url)
     new_query = sign_query(parsed.query, key, algo, timestamp, nonce)
-    return urlparse.urlunparse(parsed[:4] + (new_query,) + parsed[5:])
+    return parse.urlunparse(parsed[:4] + (new_query,) + parsed[5:])
 
 
 def sign_query(query, key, algo='sha256', timestamp=None, nonce=None):
@@ -71,7 +71,7 @@ def check_request_signature(django_request, keys=[]):
 
 
 def check_query(query, keys, known_nonce=None, timedelta=30):
-    parsed = urlparse.parse_qs(query)
+    parsed = parse.parse_qs(query)
     if not ('signature' in parsed and 'algo' in parsed and 'timestamp' in parsed and 'nonce' in parsed):
         return False
     unsigned_query, signature_content = query.split('&signature=', 1)
-- 
2.30.2

