From 5c06ab83381c5e652626d66b95c3b67ce309b249 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Tue, 26 May 2020 11:31:16 +1200 Subject: python: do not always import urllib Only provision.py wants a function from urllib, but we were importing it in samba.compat, which is imported by samba, mening that every python script importing anything from samba took 40ms longer to start up. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- python/samba/compat.py | 6 ------ python/samba/provision/__init__.py | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) (limited to 'python') diff --git a/python/samba/compat.py b/python/samba/compat.py index d7603d3964e..603cb08fe52 100644 --- a/python/samba/compat.py +++ b/python/samba/compat.py @@ -69,9 +69,6 @@ if PY3: return (x > y) - (x < y) # compat functions - from urllib.parse import quote as urllib_quote - from urllib.parse import urljoin as urllib_join - from urllib.request import urlopen as urllib_urlopen from functools import cmp_to_key as cmp_to_key_fn import socketserver as SocketServer @@ -149,9 +146,6 @@ else: else: from functools import cmp_to_key as cmp_to_key_fn # compat functions - from urllib import quote as urllib_quote - from urllib import urlopen as urllib_urlopen - from urlparse import urljoin as urllib_join import SocketServer as SocketServer # compat types diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py index fe58569e5e5..3f176e00ba4 100644 --- a/python/samba/provision/__init__.py +++ b/python/samba/provision/__init__.py @@ -26,7 +26,7 @@ __docformat__ = "restructuredText" -from samba.compat import urllib_quote +from urllib.parse import quote as urllib_quote from samba.compat import string_types from samba.compat import binary_type from base64 import b64encode -- cgit v1.2.1