Improve Python code generation according to the PEP-8 conventions
I have used zserio==2.3.0 to generate Python sources. It seems it's not fully compatible with the PEP-8 style. A few remarks:
-
PEP 8: E302 expected 2 blank lines, found 1 (between importing modules and class definition)
-
Naming like bitsizeof (instead of bit_sizeof) or bitposition (bit_position)
-
The method may be 'static' ( we do not use staticmethod decorator !!!)
-
Unused parameters also can be found like:
def bitsizeof(self, _bitposition: int = 0) -> int: return 8 -
PEP 8: E714 test for object identity should be 'is not': This is a kind of anti-pattern in python
return not self._request_num_sent_ is NoneThe best practice is to use something like:
return self._request_num_sent_ is not None
All of the issues can be found by running pycodestyle * or pycodestyle --statistics -qq *.
Thanks a lot for reporting this.
Actually, we use only pylint and mypy. We should add pycodestyle to CI as well to be able to catch all such problems as you wrote. Good idea.