Skip to content

Commit

Permalink
Use number library to identify numeric values
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Feb 6, 2017
1 parent 6acbafe commit 09f9396
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/galaxy/tools/parameters/basic.py
Expand Up @@ -2,6 +2,7 @@
Basic tool parameters.
"""
import logging
import numbers
import os
import os.path
import re
Expand Down Expand Up @@ -130,6 +131,8 @@ def to_json( self, value, app, use_security ):

def to_python( self, value, app ):
"""Convert a value created with to_json back to an object representation"""
if isinstance( value, numbers.Number ):
return unicodify( value )
return value

def value_to_basic( self, value, app, use_security=False ):
Expand Down Expand Up @@ -870,14 +873,6 @@ def to_param_dict_string( self, value, other_values={} ):
def to_json( self, value, app, use_security ):
return value

def to_python( self, value, app ):
try:
float( value )
return str( value )
except:
pass
return value

def get_initial_value( self, trans, other_values ):
options = list( self.get_options( trans, other_values ) )
if len(options) == 0 and trans.workflow_building_mode:
Expand Down

0 comments on commit 09f9396

Please sign in to comment.