flake8: cleanup lots of lint warnings

Mostly whitespace adjustments, some unused import removal, and no
intentional functionality changes.  Having a cleaner lint allows
easier detection of future errors, as well as providing the benefits
of a consistent style.
don't use mutable types for default parameter values

Mutable kwarg defaults can produce all kinds of unexpected behaviors,
this commit replaces them with immutable values.
connection: comprehensions for performance