Pyflakes fixes to the calculators and engine module

Pyflakes fixes. One of the issues in the `engine` module is an actual
bug.