Skip to content

Commit

Permalink
use six to check string types
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasheinrich committed Nov 21, 2017
1 parent 1a9e82b commit 67a893d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packtivity/handlers/publisher_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import logging
import jq
import os
from six import string_types


import packtivity.utils as utils

Expand All @@ -26,7 +28,7 @@ def interpolated_pub_handler(publisher,parameters,state):
forinterp.update(workdir = state.readwrite[0])
result = copy.deepcopy(publisher['publish'])
for path,value in utils.leaf_iterator(publisher['publish']):
if not type(value) in [str, unicode]: continue
if not isinstance(value, string_types): continue
resultval = value.format(**forinterp)
globexpr = resultval
if publisher['relative_paths'] and os.path.commonprefix([state.readwrite[0],globexpr]) == '':
Expand Down Expand Up @@ -55,7 +57,7 @@ def fromparjq_pub(publisher,parameters,state):
result = jq.jq(publisher['script']).transform(inputjson)
assert type(result)==dict
for path,value in utils.leaf_iterator(result):
if not type(value) in [str, unicode]: continue
if not isinstance(value, string_types): continue
if not state: break
if state.readwrite:
globdir = state.readwrite[0]
Expand Down

0 comments on commit 67a893d

Please sign in to comment.