Merge pull request #10154 from wm75/unary-plus-minus-filters

Allow unary plus and minus in filtering
This commit is contained in:
Dannon
2020-09-03 08:42:07 -04:00
committed by GitHub
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -12,7 +12,8 @@ AST_NODE_TYPE_WHITELIST = [
'Expr', 'Load', 'Str', 'Num', 'BoolOp', 'Compare', 'And', 'Eq', 'NotEq',
'Or', 'GtE', 'LtE', 'Lt', 'Gt', 'BinOp', 'Add', 'Div', 'Sub', 'Mult', 'Mod',
'Pow', 'LShift', 'GShift', 'BitAnd', 'BitOr', 'BitXor', 'UnaryOp', 'Invert',
'Not', 'NotIn', 'In', 'Is', 'IsNot', 'List', 'Index', 'Subscript',
'Not', 'UAdd', 'USub', 'NotIn', 'In', 'Is', 'IsNot', 'List', 'Index',
'Subscript',
# Further checks
'Name', 'Call', 'Attribute',
]
@@ -73,6 +74,8 @@ def check_expression(text):
True
>>> check_expression("c3=='chr1' and c5>5")
True
>>> check_expression("c3=='chr1' and c5>-5 and c5<+5") # Unary +/-
True
>>> check_expression("c3=='chr1' and d5>5") # Invalid d5 reference
False
>>> check_expression("c3=='chr1' and c5>5 or exec")
+1 -1
View File
@@ -1,4 +1,4 @@
<tool id="Filter1" name="Filter" version="1.1.0">
<tool id="Filter1" name="Filter" version="1.1.1">
<description>data on any column using simple expressions</description>
<edam_operations>
<edam_operation>operation_0335</edam_operation>