Flakehell: fix remaining two issues and add it as a pre-commit hook
Created by: PhilipVinc
One issue was a circular import in the new lattice code (of which we were aware)
The other was due to the fact that the new output format can no longer be appended to an existing file (in principle it can, but it would require some work).
While i had not thought about this when i proposed the new format, I still think that appending to an existing file is not a so-much-usedf feature, and it's still possible to concatenate the output of two runs by using the same logger object, which mitigates the issue.
The PR also makes it so flakehell is run when running pre-commit hook (I know @femtobit really wants this!) It's still not hooked up to CI yet.