Skip to content

Add flake8 linting.

Administrator requested to merge github/fork/tp-la/flake8 into main

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 on ZKAPAuthorizerStorageServer. It looks like that was needed because the interfaces for it were defined by implementer_only which explicitly ignored interfaces defined by parent classes. Looking at the history, I assume the use of implementer_only was to avoid implementing RIStorageServer via proxyForInterface. 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 use partial 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.

Merge request reports