File: compat.py

package info (click to toggle)
azure-uamqp-python 1.6.11-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,584 kB
  • sloc: ansic: 184,383; cpp: 7,738; python: 7,733; cs: 5,767; sh: 983; xml: 298; makefile: 34
file content (46 lines) | stat: -rw-r--r-- 1,180 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------

# pylint: disable=no-name-in-module,unused-import,redefined-builtin,import-error,undefined-variable,ungrouped-imports

import sys

from uamqp import errors

PY2 = (2, 7) <= sys.version_info < (3, 0)
PY3 = (3, 4) <= sys.version_info < (4, 0)


if PY3:
    import queue
    from urllib.parse import urlparse, unquote_plus, quote_plus

    TimeoutException = TimeoutError

    builtin_str = str
    str = str
    bytes = bytes
    basestring = (str, bytes,)
    numeric_types = (int, float,)
    integer_types = (int,)

    long = int

elif PY2:
    import Queue as queue
    from urlparse import urlparse
    from urllib import unquote_plus, quote_plus

    TimeoutException = errors.ClientTimeout

    builtin_str = str
    bytes = str
    str = unicode
    basestring = basestring
    numeric_types = (int, long, float,)
    integer_types = (int, long,)

    long = long