comparison column_maker.py @ 4:6e8d94597139 draft

"planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/column_maker commit 0cb87d8f454f205af021d653d7f7d5a7c14c7718"
author devteam
date Wed, 15 Jul 2020 10:38:50 -0400
parents be25c075ed54
children 9cd341095afd
comparison
equal deleted inserted replaced
3:be25c075ed54 4:6e8d94597139
44 } 44 }
45 for key, value in mapped_str.items(): 45 for key, value in mapped_str.items():
46 expr = expr.replace(key, value) 46 expr = expr.replace(key, value)
47 47
48 operators = 'is|not|or|and' 48 operators = 'is|not|or|and'
49 builtin_and_math_functions = 'abs|all|any|bin|chr|cmp|complex|divmod|float|bool|hex|int|len|long|max|min|oct|ord|pow|range|reversed|round|sorted|str|sum|type|unichr|unicode|log|exp|sqrt|ceil|floor' 49 builtin_and_math_functions = 'abs|all|any|bin|chr|cmp|complex|divmod|float|bool|hex|int|len|long|max|min|oct|ord|pow|range|reversed|round|sorted|str|sum|type|unichr|unicode|log|log10|exp|sqrt|ceil|floor'
50 string_and_list_methods = [name for name in dir('') + dir([]) if not name.startswith('_')] 50 string_and_list_methods = [name for name in dir('') + dir([]) if not name.startswith('_')]
51 whitelist = r"^([c0-9\+\-\*\/\(\)\.\'\"><=,:! ]|%s|%s|%s)*$" % (operators, builtin_and_math_functions, '|'.join(string_and_list_methods)) 51 whitelist = r"^([c0-9\+\-\*\/\(\)\.\'\"><=,:! ]|%s|%s|%s)*$" % (operators, builtin_and_math_functions, '|'.join(string_and_list_methods))
52 if not re.compile(whitelist).match(expr): 52 if not re.compile(whitelist).match(expr):
53 exit("Invalid expression") 53 exit("Invalid expression")
54 if avoid_scientific_notation == "yes": 54 if avoid_scientific_notation == "yes":
82 from math import ( 82 from math import (
83 ceil, 83 ceil,
84 exp, 84 exp,
85 floor, 85 floor,
86 log, 86 log,
87 log10,
87 sqrt 88 sqrt
88 ) 89 )
89 from numpy import format_float_positional 90 from numpy import format_float_positional
90 91
91 fh = open(inp_file) 92 fh = open(inp_file)