Merge pull request #257 from mmajewsk/master

Update util.py - fix ensure_tuple instance check
This commit is contained in:
Friedrich Lindenberg
2018-06-25 09:36:53 +02:00
committed by GitHub
+2 -2
View File
@@ -1,6 +1,6 @@
import six import six
from hashlib import sha1 from hashlib import sha1
from collections import OrderedDict, Sequence from collections import OrderedDict, Iterable
from six.moves.urllib.parse import urlparse from six.moves.urllib.parse import urlparse
QUERY_STEP = 1000 QUERY_STEP = 1000
@@ -99,7 +99,7 @@ def ensure_tuple(obj):
"""Try and make the given argument into a tuple.""" """Try and make the given argument into a tuple."""
if obj is None: if obj is None:
return tuple() return tuple()
if isinstance(obj, Sequence) and not isinstance(obj, six.string_types): if isinstance(obj, Iterable) and not isinstance(obj, six.string_types):
return tuple(obj) return tuple(obj)
return obj, return obj,