comparison column_maker.py @ 2:292c605c2dc7 draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/column_maker commit de7140295cce07e1bc1697e51dab4271c8d7a8a6
author devteam
date Fri, 18 Dec 2015 18:52:53 -0500
parents 4dadd821722f
children 3335c0d583d8
comparison
equal deleted inserted replaced
1:d3f10c90fc96 2:292c605c2dc7
45 } 45 }
46 for key, value in mapped_str.items(): 46 for key, value in mapped_str.items():
47 expr = expr.replace( key, value ) 47 expr = expr.replace( key, value )
48 48
49 operators = 'is|not|or|and' 49 operators = 'is|not|or|and'
50 builtin_and_math_functions = 'abs|all|any|bin|chr|cmp|complex|divmod|float|hex|int|len|long|max|min|oct|ord|pow|range|reversed|round|sorted|str|sum|type|unichr|unicode|log|exp|sqrt|ceil|floor' 50 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'
51 string_and_list_methods = [ name for name in dir('') + dir([]) if not name.startswith('_') ] 51 string_and_list_methods = [ name for name in dir('') + dir([]) if not name.startswith('_') ]
52 whitelist = "^([c0-9\+\-\*\/\(\)\.\'\"><=,:! ]|%s|%s|%s)*$" % (operators, builtin_and_math_functions, '|'.join(string_and_list_methods)) 52 whitelist = "^([c0-9\+\-\*\/\(\)\.\'\"><=,:! ]|%s|%s|%s)*$" % (operators, builtin_and_math_functions, '|'.join(string_and_list_methods))
53 if not re.compile(whitelist).match(expr): 53 if not re.compile(whitelist).match(expr):
54 stop_err("Invalid expression") 54 stop_err("Invalid expression")
55 55