示例#1
0
 def newfunc(exprnode, indexedcols):
     result = getidxcmp(exprnode, indexedcols)
     if result[0] is not None:
         try:
             typeCompileAst(expressionToAST(exprnode))
         except NotImplementedError, nie:
             # Try to make this Numexpr error less cryptic.
             raise _unsupported_operation_error(nie)
示例#2
0
 def newfunc(exprnode, indexedcols):
     result = getidxcmp(exprnode, indexedcols)
     if result[0] is not None:
         try:
             typeCompileAst(expressionToAST(exprnode))
         except NotImplementedError, nie:
             # Try to make this Numexpr error less cryptic.
             raise _unsupported_operation_error(nie)
示例#3
0
    def get_equation_variables(self, equation: str) -> Tuple[str, list]:
        """
        Converts an un-formatted equation to a more useable form,
        used to format values to variable places

        :return: Returns a tuple with the equation and the list of variables
        """

        # Find all variables from the equation given
        variables = list(map(
            lambda x: x.value,
            nec.typeCompileAst(
                nec.expressionToAST(
                    nec.stringToExpression(equation, {}, {})
                )
            ).allOf('variable')
        ))

        return variables