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.
factor_list: divide out content before factoring
Merge pull request #2484 from katjasophie/factor_frac_field

factor_list: fix factorization of polynomials over polynomial rings or fraction fields
Merge pull request #2483 from asmeurer/code_quality

Fix the code quality tests in Python 3