Skip to content

Commit

Permalink
ProTo: Fixing UniCode support, removing all type checks explicitly to…
Browse files Browse the repository at this point in the history
…wards 'str'.
  • Loading branch information
sveinugu committed Dec 6, 2016
1 parent 4d9f705 commit c7e2f16
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/proto/OptionsBoxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ def __init__(self, text, rows=1, readonly=False):

@classmethod
def isTypeOf(cls, opts):
if isinstance(opts, str) or isinstance(opts, unicode):
if isinstance(opts, basestring):
return True
if isinstance(opts, tuple):
if len(opts) in [2, 3] and (isinstance(opts[0], str) or isinstance(opts[0], unicode)):
if len(opts) in [2, 3] and (isinstance(opts[0], basestring)):
return True
return False

Expand Down
2 changes: 1 addition & 1 deletion lib/proto/RSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
numpy2ri.activate()

def replaceNone(obj):
if isinstance(obj, str):
if isinstance(obj, basestring):
return obj

if isinstance(obj, collections.Iterable):
Expand Down
12 changes: 6 additions & 6 deletions lib/proto/generictool.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _getIdxList(self, inputList):
idxList = range(len(self.inputIds))
else:
for i in inputList:
if isinstance(i, str):
if isinstance(i, basestring):
try:
idx = self.inputIds.index(i)
except ValueError:
Expand All @@ -156,7 +156,7 @@ def _getIdxList(self, inputList):
return idxList

def _getIdxForBoxId(self, i):
if isinstance(i, str):
if isinstance(i, basestring):
try:
idx = self.inputIds.index(i)
except ValueError:
Expand Down Expand Up @@ -285,7 +285,7 @@ def action(self):
values[k] = bool(self.params.get(id + '|' + k , False) if val else v)
val = values

elif isinstance(opts, str) or isinstance(opts, unicode):
elif isinstance(opts, basestring):
if opts == '__genome__':
self.inputTypes += ['__genome__']
try:
Expand Down Expand Up @@ -347,7 +347,7 @@ def action(self):
val = opts[1]
#elif val:
# val = unquote(val)
elif len(opts) in [2, 3] and (isinstance(opts[0], str) or isinstance(opts[0], unicode)):
elif len(opts) in [2, 3] and (isinstance(opts[0], basestring)):
if len(opts) == 2:
opts = opts + (False,)
if isinstance(opts[1], int):
Expand Down Expand Up @@ -500,8 +500,8 @@ def execute(self):
ChoiceTuple = namedtuple('ChoiceTuple', self.inputIds)
choices = ChoiceTuple._make(self.inputValues)

#batchargs = '|'.join([';'.join(c.itervalues()) if not isinstance(c, str) else c for c in choices])
#batchargs = '|'.join([repr(c.items()) if not isinstance(c, str) else c for c in choices])
#batchargs = '|'.join([';'.join(c.itervalues()) if not isinstance(c, basestring) else c for c in choices])
#batchargs = '|'.join([repr(c.items()) if not isinstance(c, basestring) else c for c in choices])

#print choices
if outputFormat == 'html':
Expand Down

0 comments on commit c7e2f16

Please sign in to comment.