summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2020-05-26 11:31:16 +1200
committerAndrew Bartlett <abartlet@samba.org>2020-06-13 05:25:31 +0000
commit5c06ab83381c5e652626d66b95c3b67ce309b249 (patch)
treea84fb60e71802657b8db3636222d431347ea631d /python
parent4aba00b554f88a8efd2e08ccdfbc259543ffdd98 (diff)
downloadsamba-5c06ab83381c5e652626d66b95c3b67ce309b249.tar.gz
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 <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/compat.py6
-rw-r--r--python/samba/provision/__init__.py2
2 files changed, 1 insertions, 7 deletions
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