File: _compat.py

package info (click to toggle)
python-phabricator 0.7.0-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 192 kB
  • sloc: python: 458; makefile: 6
file content (36 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (3)
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
import sys

PY3 = sys.version_info[0] >= 3

try:
    from collections.abc import MutableMapping
except ImportError:
    from collections import MutableMapping

try:
    import httplib
except ImportError:
    import http.client as httplib

try:
    import urlparse
except ImportError:
    import urllib.parse as urlparse

try:
    from urllib import urlencode
except ImportError:
    from urllib.parse import urlencode

if PY3:
    str_type = str
    string_types = str,

    def iteritems(d, **kw):
        return iter(d.items(**kw))
else:
    str_type = unicode
    string_types = basestring,

    def iteritems(d, **kw):
        return d.iteritems(**kw)