flake8 and regexp cleanups