MAINT: add pyflakes to Travis-CI

Static code checking can be useful in some cases, esp. catching missing imports and so on. Of the Python static checkers, pyflakes seems to do the least amount of opinion-based style checking, and seems the best for this purpose.

This PR adds pyflakes run to the automated test suite. I filter out most "assigned but unused" failures, as those shouldn't result to Travis failures.

I also fix some issues it finds. Mainly harmless, although some of them were actual bugs.