Skip to content

Apply black and flake8 + add to ci

Wout De Nolf requested to merge black_flake8 into main

Common flake8 warnings

  • type(var) == int is replaced isinstance(var, int) and equivalent occurences
  • Bare excepts except: are replaced by except Exception: because they capture SystemExit or CTRL-C (BaseException) and sometimes absorb it
  • Multi-lime imports are split. For example import os, sys, unittest
  • Variable is assigned but never used. For example unused = myfunc(...) becomes _ = myfunc(...) or remove the call in case there are no side effects and it is not intended as a validation.
  • Module level import not at top of file.
  • Module imported but unused.
  • not a in b becomes a not in b
  • A function def run(beamline, **kwargs): which does not use kwargs can be defined as def run(beamline, **_):
  • unicode is str but when used in combination with str (which used to be bytes) you need to take care of str and bytes
Edited by Wout De Nolf

Merge request reports