Re: [python-uk] Python 2.7 code: a spring-clean

2019-12-05 Thread Steve Holden
There's been loose talk of adding "minus2" fixers to 2to3, but I don't know whether there's been any concrete progress. At least most refactorings will be taking place on a code base that already runs on Python 3, so tests (where they exist) can ensure that such automated refactorings would do rel

Re: [python-uk] Python 2.7 code: a spring-clean

2019-12-04 Thread Richard Barran
That might do the trick - I’ll try it out. Mucho thanks! > On 4 Dec 2019, at 10:51, Jonathan Lange wrote: > > We've had good luck using https://github.com/asottile/pyupgrade > as a pre-commit hook (see > https://pre-commit.com/

Re: [python-uk] Python 2.7 code: a spring-clean

2019-12-04 Thread Jonathan Lange
We've had good luck using https://github.com/asottile/pyupgrade as a pre-commit hook (see https://pre-commit.com/ – highly recommended). We were already using Python 3, but it's helped us deal with some of the 3.n -> 3.n+1 upgrades. On Tue, 3 Dec 2019 at 21:23, Richard Barran wrote: > Hi all, >

Re: [python-uk] Python 2.7 code: a spring-clean

2019-12-03 Thread Steve - Gadget Barnes
Hi Richard, One trick that I have used is to use os.walk to find all of the python files and then tried parsing them with ast - this at least throws an error for the files that are completely broken for python 3. Another is to use the python 3 version pylint on the files/project this finds more