From 8e478e79ea3e45e40299f9ac6be5cc26d4a23aaa Mon Sep 17 00:00:00 2001 From: Hugo Date: Tue, 6 Feb 2018 17:47:39 +0200 Subject: [PATCH] Treat Py2 (not Py3) as the special case https://astrofrog.github.io/blog/2016/01/12/stop-writing-python-4-incompatible-code/ --- pylast/__init__.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pylast/__init__.py b/pylast/__init__.py index 38dc47c..a1ee98f 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -39,17 +39,16 @@ __license__ = "apache2" __email__ = 'amr.hassan@gmail.com' -if sys.version_info.major == 3: - import html.entities as htmlentitydefs - from http.client import HTTPSConnection - from urllib.parse import quote_plus as url_quote_plus - - unichr = chr - -elif sys.version_info.major == 2: +if sys.version_info.major == 2: import htmlentitydefs from httplib import HTTPSConnection from urllib import quote_plus as url_quote_plus +else: + import html.entities as htmlentitydefs + from http.client import HTTPSConnection + from urllib.parse import quote_plus as url_quote_plus + unichr = chr + STATUS_INVALID_SERVICE = 2 STATUS_INVALID_METHOD = 3