[lint] run mypy on contrib
Summary:
In most cases, the errors are fixed by simply adding a typehint. In one case, initializing a variable with 0. (float) instead of 0 (int) is necessary. In another case, I had to check that a variable really is a list before accessing one of its value by index.
In the case of raise UnicodeDecodeError, mypy found an actual bug.
>>> raise UnicodeDecodeError Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: function takes exactly 5 arguments (0 given)
Rather than figuring out what the 5 arguments should be, it is simpler (and cleaner) to raise and catch a custom error for that particular case.
I skipped contrib/macdeploy, because this module has some hairy errors. It can always be linted in a separate diff in the future.
Depends on D13637
Test Plan: arc lint --everything
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D13638