Fix various warnings from running updated pyflakes on the entire codebase