MCPcopy Create free account
hub / github.com/pydata/numexpr / _compare

Function _compare

numexpr3/ne3compiler.py:1339–1358  ·  view source on GitHub ↗

The equivalent AST factory for :code:`ast.Compare` nodes to :code:`_binop`. :code:`ast.Compare` node fields are :code:`(left,ops,comparators)`. Only one right-hand comparison is allowed, use brackets to break up multiple comparisons. NumExpr3 does not handle comparisons :cod

(self: NumExpr, node: ast.AST)

Source from the content-addressed store, hash-verified

1337 return outputRegister
1338
1339def _compare(self: NumExpr, node: ast.AST) -> None:
1340 '''
1341 The equivalent AST factory for :code:`ast.Compare` nodes to :code:`_binop`.
1342
1343 :code:`ast.Compare` node fields are :code:`(left,ops,comparators)`. Only one
1344 right-hand comparison is allowed, use brackets to break up multiple
1345 comparisons.
1346
1347 NumExpr3 does not handle comparisons :code:`[Is, IsNot, In, NotIn]`.
1348 '''
1349 # info( 'ast.Compare: left: {}, ops:{}, comparators:{}'.format(node.left, node.ops, node.comparators) )
1350 # 'Awkward... this ast.Compare node is,' said Yoga disparagingly.
1351
1352 if len(node.ops) > 1:
1353 raise NotImplementedError(
1354 'NumExpr3 only supports binary comparisons (between two elements); try inserting brackets' )
1355 # Force the node into something the _binop machinery can handle
1356 node.right = node.comparators[0]
1357 node.op = node.ops[0]
1358 return _binop(self, node)
1359
1360def _boolop(self: NumExpr, node: ast.AST) -> NumReg:
1361 '''

Callers

nothing calls this directly

Calls 1

_binopFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…