Skip to content

Commit

Permalink
Merge pull request #247 from pylast/use-named-version-attributes
Browse files Browse the repository at this point in the history
Simplify version checking
  • Loading branch information
hugovk committed Feb 8, 2018
2 parents b02b830 + 8e478e7 commit adea26e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pylast/__init__.py
Expand Up @@ -39,17 +39,16 @@
__email__ = 'amr.hassan@gmail.com'


if sys.version_info[0] == 3:
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

elif sys.version_info[0] == 2:
import htmlentitydefs
from httplib import HTTPSConnection
from urllib import quote_plus as url_quote_plus

STATUS_INVALID_SERVICE = 2
STATUS_INVALID_METHOD = 3
Expand Down Expand Up @@ -2608,7 +2607,7 @@ def _string(string):
if isinstance(string, str):
return string
casted = six.text_type(string)
if sys.version_info[0] == 2:
if sys.version_info.major == 2:
casted = casted.encode("utf-8")
return casted

Expand Down

0 comments on commit adea26e

Please sign in to comment.