~ubuntu-branches/ubuntu/utopic/python-ceilometerclient/utopic

« back to all changes in this revision

Viewing changes to ceilometerclient/openstack/common/py3kcompat/urlutils.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, James Page, Chuck Short
  • Date: 2014-01-21 09:53:01 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140121095301-cwxsrtdgddkzprjx
Tags: 1.0.8-0ubuntu1
[ James Page ]
* d/control: Add missing BD on python-babel. 

[ Chuck Short ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Copyright 2013 Canonical Ltd.
 
3
# All Rights Reserved.
 
4
#
 
5
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
6
#    not use this file except in compliance with the License. You may obtain
 
7
#    a copy of the License at
 
8
#
 
9
#         http://www.apache.org/licenses/LICENSE-2.0
 
10
#
 
11
#    Unless required by applicable law or agreed to in writing, software
 
12
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
13
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
14
#    License for the specific language governing permissions and limitations
 
15
#    under the License.
 
16
#
 
17
 
 
18
"""
 
19
Python2/Python3 compatibility layer for OpenStack
 
20
"""
 
21
 
 
22
import six
 
23
 
 
24
if six.PY3:
 
25
    # python3
 
26
    import urllib.error
 
27
    import urllib.parse
 
28
    import urllib.request
 
29
 
 
30
    urlencode = urllib.parse.urlencode
 
31
    urljoin = urllib.parse.urljoin
 
32
    quote = urllib.parse.quote
 
33
    parse_qsl = urllib.parse.parse_qsl
 
34
    unquote = urllib.parse.unquote
 
35
    urlparse = urllib.parse.urlparse
 
36
    urlsplit = urllib.parse.urlsplit
 
37
    urlunsplit = urllib.parse.urlunsplit
 
38
    SplitResult = urllib.parse.SplitResult
 
39
 
 
40
    urlopen = urllib.request.urlopen
 
41
    URLError = urllib.error.URLError
 
42
    pathname2url = urllib.request.pathname2url
 
43
else:
 
44
    # python2
 
45
    import urllib
 
46
    import urllib2
 
47
    import urlparse
 
48
 
 
49
    urlencode = urllib.urlencode
 
50
    quote = urllib.quote
 
51
    unquote = urllib.unquote
 
52
 
 
53
    parse = urlparse
 
54
    parse_qsl = parse.parse_qsl
 
55
    urljoin = parse.urljoin
 
56
    urlparse = parse.urlparse
 
57
    urlsplit = parse.urlsplit
 
58
    urlunsplit = parse.urlunsplit
 
59
    SplitResult = parse.SplitResult
 
60
 
 
61
    urlopen = urllib2.urlopen
 
62
    URLError = urllib2.URLError
 
63
    pathname2url = urllib.pathname2url