File: _compat.py

package info (click to toggle)
python-phabricator 0.9.1-0.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 188 kB
  • sloc: python: 453; makefile: 7; sh: 3
file content (26 lines) | stat: -rw-r--r-- 495 bytes parent folder | download
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
import sys

PY3 = sys.version_info[0] >= 3

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

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)