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

Function _assign

numexpr3/ne3compiler.py:898–914  ·  view source on GitHub ↗

AST function handler for an intermediate assignment in a statement block. The convention is that intermediate targets are named targets if they do not exist in the calling namespace and secondary outputs if they have been pre-allocated.

(self: NumExpr, node: ast.AST)

Source from the content-addressed store, hash-verified

896# Note: these use 'self', which must be a NumExpr object
897# ('self' is not a reserved keyword in Python)
898def _assign(self: NumExpr, node: ast.AST) -> NumReg:
899 '''
900 AST function handler for an intermediate assignment in a statement block.
901 The convention is that intermediate targets are named targets if they do not
902 exist in the calling namespace and secondary outputs if they have been
903 pre-allocated.
904 '''
905 # print( '$ast.Assign' )
906 # node.targets is a list; It must have a len=1 for NumExpr3 (i.e. no multiple returns)
907 # node.value is likely a BinOp, Call, Comparison, or BoolOp
908 if len(node.targets) != 1:
909 raise ValueError('NumExpr3 supports only singleton returns in assignments.')
910
911 valueReg = _ASTAssembler[type(node.value)](self, node.value)
912 # Not populating self.assignTarget here, it's only needed for id'ing the
913 # output.
914 return _mutate(self, node.targets[0], valueReg)
915
916def _assign_last(self: NumExpr, node: ast.AST) -> NumReg:
917 '''

Callers

nothing calls this directly

Calls 1

_mutateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…