| 1 |
import inspect |
| 2 |
|
| 3 |
import urllib.parse as urlparse # noqa |
| 4 |
from urllib.parse import quote, unquote_plus # noqa |
| 5 |
from urllib.request import urlopen, URLError # noqa |
| 6 |
from html import escape # noqa |
| 7 |
izip = zip |
| 8 |
|
| 9 |
|
| 10 |
def is_bound_method(ob): |
| 11 |
return inspect.ismethod(ob) and ob.__self__ is not None |
| 12 |
|
| 13 |
|
| 14 |
def getargspec(func): |
| 15 |
import sys |
| 16 |
if sys.version_info < (3, 5): |
| 17 |
return inspect.getargspec(func) |
| 18 |
|
| 19 |
from collections import namedtuple |
| 20 |
ArgSpec = namedtuple('ArgSpec', 'args varargs keywords defaults') |
| 21 |
args, varargs, keywords, defaults = inspect.getfullargspec(func)[:4] |
| 22 |
return ArgSpec(args=args, varargs=varargs, keywords=keywords, |
| 23 |
defaults=defaults) |