~ubuntu-branches/debian/stretch/waagent/stretch

« back to all changes in this revision

Viewing changes to azurelinuxagent/common/future.py

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2016-08-24 16:48:22 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20160824164822-vdf8m5xy5gycm1cz
Tags: 2.1.6-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import sys
 
2
 
 
3
"""
 
4
Add alies for python2 and python3 libs and fucntions.
 
5
"""
 
6
 
 
7
if sys.version_info[0]== 3:
 
8
    import http.client as httpclient
 
9
    from urllib.parse import urlparse
 
10
 
 
11
    """Rename Python3 str to ustr"""
 
12
    ustr = str
 
13
 
 
14
    bytebuffer = memoryview
 
15
 
 
16
    read_input = input
 
17
 
 
18
elif sys.version_info[0] == 2:
 
19
    import httplib as httpclient
 
20
    from urlparse import urlparse
 
21
 
 
22
    """Rename Python2 unicode to ustr"""
 
23
    ustr = unicode
 
24
 
 
25
    bytebuffer = buffer
 
26
 
 
27
    read_input = raw_input
 
28
 
 
29
else:
 
30
    raise ImportError("Unknown python version:{0}".format(sys.version_info))
 
31