Small cleanup in test_code_quality.py

Always use raw strings for regular expressions. Pre-compile a regular
expression.
Use any() instead of filter() in test_code_quality.py

In Python 3, filter returns an iterator, so "if filter(...)" won't work (every
filter will have a bool value of True).

This fixes the code quality tests to work in Python 3 again.
Merge pull request #2483 from asmeurer/code_quality

Fix the code quality tests in Python 3