marcogorelli / auto-walrus Goto Github PK
View Code? Open in Web Editor NEWAutomatically use the awesome walrus operator
License: MIT License
Automatically use the awesome walrus operator
License: MIT License
For example, changing
i = 10
while i > 0:
i -= 1
to
while (i := 10) > 0:
i -= 1
is probably not desirable, since the latter never completes.
It would be slightly useful to allow the tool to take directories and apply the changes recursively to all *.py files.
Not that you couldn't find . -name \*.py -exec auto-walrus --line-length 88 '{}' \;
or something.
Would you see this as a desirable feature? If so (without signing any promise in blood), I would try to write a PR.
I ran a pre-commit autoupdate
on my project and now pre-commit won't run. The log is below:
auto-walrus..............................................................Failed
- hook id: auto-walrus
- exit code: 1
Traceback (most recent call last):
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/bin/auto-walrus", line 5, in <module>
from auto_walrus import main
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/lib/python3.10/site-packages/auto_walrus.py", line 17, in <module>
import tomli as tomllib
ModuleNotFoundError: No module named 'tomli'
Traceback (most recent call last):
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/bin/auto-walrus", line 5, in <module>
from auto_walrus import main
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/lib/python3.10/site-packages/auto_walrus.py", line 17, in <module>
import tomli as tomllib
ModuleNotFoundError: No module named 'tomli'
Traceback (most recent call last):
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/bin/auto-walrus", line 5, in <module>
from auto_walrus import main
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/lib/python3.10/site-packages/auto_walrus.py", line 17, in <module>
import tomli as tomllib
ModuleNotFoundError: No module named 'tomli'
Traceback (most recent call last):
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/bin/auto-walrus", line 5, in <module>
from auto_walrus import main
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/lib/python3.10/site-packages/auto_walrus.py", line 17, in <module>
import tomli as tomllib
ModuleNotFoundError: No module named 'tomli'
Traceback (most recent call last):
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/bin/auto-walrus", line 5, in <module>
from auto_walrus import main
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/lib/python3.10/site-packages/auto_walrus.py", line 17, in <module>
import tomli as tomllib
ModuleNotFoundError: No module named 'tomli'
I'm not really sure how to debug this in a pre-commit environment.
I'm using poetry and my python version is 3.10.12.
Hi there.
Thanks a lot for that code-formatter. Just want to leave here a feature request about ignoring the specific lines of codes where it should not be applied. Would you be interested in seeing that feature in that package? Do you need help with developing it? Appreciate any thoughts around that feature-request. Thanks in advance.
https://pipx.pypa.io
https://github.com/MarcoGorelli/auto-walrus/releases
% pipx run auto-walrus
'auto-walrus' executable script not found in package 'auto-walrus'.
Available executable scripts:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.