Пример #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