Seperate out parsing from calc.py
calc.py: -Create a method called `parse_algebra`. It takes a string of math and returns with a `pyparsing.ParseResults` object representing it. -`evaluator` takes this tree and applies the old "parse actions" to it to get the same number as it used to. -Change a few things in the parse actions (i.e. rename them to eval actions) -Add `atom_parse_action` -Add `find_vars_funcs` to aggregate used functions and vars in the tree -Change strategy of `check_variables` to instead take the set difference of `find_vars_funcs` with the allowed ones -Create `add_defaults` to take user defined lists of vars and funcs and return a combined list -Change `x.setResultsName(...)` to `x(...)` for brevity In test_calc.py: -Fix a bad test (which expected something to pass that shouldn't) -Fix indentation
Showing
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to comment