summaryrefslogtreecommitdiff
path: root/pecan/compat/__init__.py
blob: 93883f4086df73fa68c7d6ff1757123f5426b285 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import inspect

import six

if six.PY3:
    import urllib.parse as urlparse
    from urllib.parse import quote, unquote_plus
    from urllib.request import urlopen, URLError
    from html import escape
else:
    import urlparse  # noqa
    from urllib import quote, unquote_plus  # noqa
    from urllib2 import urlopen, URLError  # noqa
    from cgi import escape  # noqa


def is_bound_method(ob):
    return inspect.ismethod(ob) and six.get_method_self(ob) is not None