Do not use locals() for string formatting

Fix all occurrences of H501 of Hacking 0.7.x so that
the check can be enabled later for gating.

Change-Id: Ib193e4923349fd7d8e6015989642c3fbc4ae345e
Merge "Do not use locals() for string formatting"