Some scripts that use pybowler.io for refactoring Python code
MIT License
This is a set of scripts which refactor your Python code. They're invocations of Bowler, which is a Facebook incubator project for refactoring Python code using lib2to3.
These scripts are just assorted refactoring steps I've found helpful in my day job as a full time Python developer, that I was unable to find elsewhere.
Please suggest or contribute extra scripts. I will accept any high quality scripts that may be useful, even if they're not useful to me. If you have a cool idea, please open an issue.
Upgrades source file to use f-strings wherever possible. i.e. converts this
'%s string literal' % myvar
into this:
f'{myvar} string literal'
Partially converts your xunit-style tests to pytest ones. Doesn't get you all the way there, but reduces the effort required to manually finish the job.
This repo exists primarily as a learning exercise in concrete syntax trees. You should exercise care if trying to using these scripts on code that is dear to you.
requirements.txt
Some ideas I had which I haven't implemented yet:
super(X, self)
to super()
(assuming X matches the class def)__future__
import statements (do any of the existing futurize/modernize tools do this? I couldn't find any)git clone [email protected]:craigds/decrapify.git
virtualenv venv
. venv/bin/activate
pip install -r requirements.txt