aseba-community / aseba

Aseba is a set of tools which allow beginners to program robots easily and efficiently. To contact us, please open an issue.
http://aseba.wikidot.com
GNU Lesser General Public License v3.0
48 stars 62 forks source link

WIP: Python 3 compatibility, fix #888 #889

Open nim65s opened 5 years ago

nim65s commented 5 years ago

Hi again,

This PR follows https://github.com/enki-community/enki/pull/61 & https://github.com/enki-community/enki/pull/62 and fixes #888

As in https://github.com/enki-community/enki/pull/62, to ensure that there is no syntax errors in python scripts neither in python2 nor 3, I used the flake8 linter with python2 -m flake8 and python3 -m flake8.

I also ran the full test suite with success with both python versions.

Most changes are:

isort and yapf have also been helping a bit, and they have made aesthetic choices you might not be comfortable with. If this is the case, I can obviously revert that to the previous format that you did prefer.

NB: u-strings have not been removed, therefore this will not work on python3 < 3.3, but most distributions provide >= 3.4.

PS: This is a Work In Progress, as there is no point in merging this PR before those that enable python3 build in enki

nim65s commented 5 years ago

Also, this adds a dependency on six. We could either hope that it is already widely available everywhere, or document that, or just include it in the project:

It is contained in only one Python file, so it can be easily copied into your project. (The copyright and license notice must be retained.)

stephanemagnenat commented 5 years ago

Thank you for your PR!

As in Enki, this PR contains both Python 3 compatibility code and whitespace and other aesthetic changes. Using tabs instead of whitespace is the Aseba style. Similarly, keeping relatively long lines is as well, as most editors have good soft warp. At that point, I do not want to change this style as it has been working well for a long time, and re-indenting everything would both loose the blame history.

Can you please submit a PR that just bring the necessary changes for Python 3 compatibility? Thank you!