Minor refactoring.

No change in functionality.  Mostly just fixing things pylint
complained about.