From 7a945e37212ea44a4ce8feb31363a9d3a3568565 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Tue, 22 Sep 2015 15:49:21 +0200 Subject: [PATCH] Work around utter disregard of semver --- vdirsyncer/utils/__init__.py | 5 ++--- vdirsyncer/utils/compat.py | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/vdirsyncer/utils/__init__.py b/vdirsyncer/utils/__init__.py index 93d1a19..bd2eace 100644 --- a/vdirsyncer/utils/__init__.py +++ b/vdirsyncer/utils/__init__.py @@ -4,7 +4,7 @@ import os import sys import uuid -from .compat import iteritems, to_unicode +from .compat import getargspec_ish, iteritems, to_unicode from .. import exceptions @@ -84,8 +84,7 @@ def get_etag_from_fileobject(f): def get_class_init_specs(cls, stop_at=object): if cls is stop_at: return () - import inspect - spec = inspect.getargspec(cls.__init__) + spec = getargspec_ish(cls.__init__) supercls = next(getattr(x.__init__, '__objclass__', x) for x in cls.__mro__[1:]) return (spec,) + get_class_init_specs(supercls, stop_at=stop_at) diff --git a/vdirsyncer/utils/compat.py b/vdirsyncer/utils/compat.py index 0a4d1d6..1e499e0 100644 --- a/vdirsyncer/utils/compat.py +++ b/vdirsyncer/utils/compat.py @@ -34,6 +34,7 @@ def _wrap_native(f, encoding='utf-8'): if PY2: # pragma: no cover import urlparse import urllib as _urllib + from inspect import getargspec as getargspec_ish # noqa # Horrible hack to make urllib play nice with u'...' urls from requests urlquote = _wrap_native(_urllib.quote) @@ -46,6 +47,8 @@ if PY2: # pragma: no cover else: # pragma: no cover import urllib.parse as urlparse + from inspect import getfullargspec as getargspec_ish # noqa + urlquote = urlparse.quote urlunquote = urlparse.unquote text_type = str