comparison column_maker.py @ 2:464b9305180e draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/column_maker commit f6e96ffa420035051ea4632596dfd171074aa66d
author devteam
date Thu, 25 Oct 2018 17:31:42 -0400
parents 08a01b2ce4cd
children be25c075ed54
comparison
equal deleted inserted replaced
1:626658afe4cb 2:464b9305180e
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