Add flake8 linting.
Created by: tomprince
Here are the issues that were reported by flake8, along with some comments on how I addressed them where appropriate.
-
E402 module level import not at top of file This was cause by some code calling
registerAdapter
onZKAPAuthorizerStorageServer
. It looks like that was needed because the interfaces for it were defined byimplementer_only
which explicitly ignored interfaces defined by parent classes. Looking at the history, I assume the use ofimplementer_only
was to avoid implementingRIStorageServer
viaproxyForInterface
. Given that the later is no longer used,implementer_only
is no longer necessary.Reading some documentation, I think an alternative to needing to having the
registerAdapter
would have been to use-@implementer_only(RIPrivacyPassAuthorizedStorageServer, IReferenceable, IRemotelyCallable) +@implementer_only(RIPrivacyPassAuthorizedStorageServer, implementedBy(Referenceable))
-
E722 do not use bare 'except' These were replaced by
except Exception:
-
E302 expected 2 blank lines, found 1
-
E501 line too long These are the changes I'm least sure of. I did a variety of things for this
- Most places, there were reasonable ways to wrap the code, which I did.
- There was one place where black didn't like wrapping a line with a
lambda
with a bunch of parameters. Here I changed the order of agruments, and converted the lambda to usepartial
instead. - There were three places where there wasn't a good place to wrap, which I annotated with
# noqa: E501
-
E731 do not assign a lambda expression, use a def
- I disabled this error in
*/tests/*.py
.
- I disabled this error in