update to warnings

making the syntax more concise throughout with import from and making all str formatting new-style rather than the mix of new and old-style str formatting.
The `%r` means repr formatting - the equivalent in the new style syntax is `{!r}`.