Code quality in clang

- dedup code
- flake8 for files that still used `# flake: noqa`
- pylint -E for things related to clang (and others that I could fix, see issue #334 for the rest)