Skip to content

Commit 4e18d5e

Browse files
authored
[py2] fix str check in parse_datasource (#106)
Checking for `str` type in python2.* doesn't work because in many cases string will be unicode. This PR makes use of the `six` lib to make the call py2/3 compatible
1 parent 0b3ae1b commit 4e18d5e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pydruid/query.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ def parse_datasource(datasource, query_type):
214214
:raise ValueError: if input is not string or list of strings
215215
"""
216216
if not (
217-
isinstance(datasource, str) or
218-
(isinstance(datasource, list) and all([isinstance(x, str) for x in datasource]))
217+
isinstance(datasource, six.string_types) or
218+
(isinstance(datasource, list) and all([isinstance(x, six.string_types) for x in datasource]))
219219
):
220220
raise ValueError('Datasource definition not valid. Must be string or list of strings')
221-
if isinstance(datasource, str):
221+
if isinstance(datasource, six.string_types):
222222
return datasource
223223
else:
224224
return {'type': 'union', 'dataSources': datasource}

0 commit comments

Comments
 (0)