WIP: Python 3 compatibility, fix #888
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:
- whitespaces, around operators, after a #, and some tabs have been replaced by spaces. To see this PR more clearly, you can ignore this by adding ?w=1 at the end of the url
- using the print function
- removing unused imports
- splitting lines that are too long
- changing
if var == True:
intoif var:
- changing
if var {!,=}= None
intoif var is {not,} None
- using six for
raw_input
andbasestring
- relatively importing maintainer/translations/path.py, and removing the wildcard import
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