You've already forked httpie-cli
mirror of
https://github.com/httpie/cli.git
synced 2025-08-10 22:42:05 +02:00
Python 2.7 support removal WIP
This commit is contained in:
@@ -1,39 +1,4 @@
|
||||
"""
|
||||
Python 2.7, and 3.x compatibility.
|
||||
|
||||
"""
|
||||
import sys
|
||||
|
||||
|
||||
is_py2 = sys.version_info[0] == 2
|
||||
is_py27 = sys.version_info[:2] == (2, 7)
|
||||
is_py3 = sys.version_info[0] == 3
|
||||
is_pypy = 'pypy' in sys.version.lower()
|
||||
is_windows = 'win32' in str(sys.platform).lower()
|
||||
|
||||
|
||||
if is_py2:
|
||||
# noinspection PyShadowingBuiltins
|
||||
bytes = str
|
||||
# noinspection PyUnresolvedReferences,PyShadowingBuiltins
|
||||
str = unicode
|
||||
elif is_py3:
|
||||
# noinspection PyShadowingBuiltins
|
||||
str = str
|
||||
# noinspection PyShadowingBuiltins
|
||||
bytes = bytes
|
||||
|
||||
|
||||
try: # pragma: no cover
|
||||
# noinspection PyUnresolvedReferences,PyCompatibility
|
||||
from urllib.parse import urlsplit
|
||||
except ImportError: # pragma: no cover
|
||||
# noinspection PyUnresolvedReferences,PyCompatibility
|
||||
from urlparse import urlsplit
|
||||
|
||||
try: # pragma: no cover
|
||||
# noinspection PyCompatibility
|
||||
from urllib.request import urlopen
|
||||
except ImportError: # pragma: no cover
|
||||
# noinspection PyCompatibility,PyUnresolvedReferences
|
||||
from urllib2 import urlopen
|
||||
|
Reference in New Issue
Block a user