1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

python/samba: Add some compatability PY2/PY3 functions

I hope these changes are a short term interim solution for the
absence of the 'six' module/library. I also hope that soon this
module can be removed and be replaced by usage of six.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
Noel Power 2018-04-13 11:19:10 +01:00 committed by Noel Power
parent ba5f00deb7
commit d2ee36e350

View File

@ -22,8 +22,20 @@ import sys
PY3 = sys.version_info[0] == 3
if PY3:
# compat functions
from urllib.parse import quote as urllib_quote
from urllib.request import urlopen as urllib_urlopen
# compat types
integer_types = int,
string_types = str
text_type = str
else:
# compat functions
from urllib import quote as urllib_quote
from urllib import urlopen as urllib_urlopen
# compat types
integer_types = (int, long)
string_types = basestring
text_type = unicode