-
- Downloads
Python clean, mostly pep8
https://www.python.org/dev/peps/pep-0008/ A few hints: + About Spaces: - always after a comma - never after [, (, { - never before ], ), } - always around -, +, *, **, %, ==, >=, <= - always around = for an assignation - never around = for a default value of an argument - never at the end of a line + One statement by line: - nothing after : unless inside [] - no ; + No useless (), like in a simple if or assert + Indentation uses four spaces + Blanklines: - 2 before class or function declaration - 1 before class method declaration - never more than 2 + Line length: - We said 79. This is far from beeign respected. Maybe 119 is more reasonable + Align: - at the begining of a line continuation - not multiple spaces before = to align multiple assignements Of course, in our case, it would be tricky to follow some other rules, like: N802 function name should be lowercase N803 argument name should be lowercase N806 variable in function should be lowercase Other issues may be addressed: F401 '<something>' imported but unused F403 'from <some_lib> import *' used; unable to detect undefined names To check all of this: flake8 --ignore=N802,N803,N806 --max-line-length=119 <root_folder> Other things changed: - import order (thanks isort) - useless elif changed to if - useless else removed - usage of ValueError, when an argument does not fit the expected type / size - issubclass(x.__class__, X) / x.__class__ == X → isinstance(x, X) - isinstance accepts a list or a tuple of classes (eg: isinstance(x, (int, float))) - print "" → print
Showing
- lab/python/exp_integration.py 36 additions, 34 deletionslab/python/exp_integration.py
- lab/python/kineinv.py 38 additions, 34 deletionslab/python/kineinv.py
- python/bindings.py 37 additions, 34 deletionspython/bindings.py
- python/test_model.py 16 additions, 15 deletionspython/test_model.py
- src/python/__init__.py 45 additions, 43 deletionssrc/python/__init__.py
- src/python/explog.py 25 additions, 16 deletionssrc/python/explog.py
- src/python/robot_wrapper.py 96 additions, 114 deletionssrc/python/robot_wrapper.py
- src/python/romeo_wrapper.py 46 additions, 38 deletionssrc/python/romeo_wrapper.py
- src/python/rpy.py 25 additions, 20 deletionssrc/python/rpy.py
- src/python/utils.py 84 additions, 75 deletionssrc/python/utils.py
Loading
Please register or sign in to comment