1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 10:42:07 +02:00
tldr/pages/common/autoflake.md
Vitor Henrique c8f956319f
pages*: simplify page description (#12149)
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2024-02-14 21:25:13 +01:00

714 B

autoflake

Remove unused imports and variables from Python code. More information: https://github.com/myint/autoflake.

  • Remove unused variables from a single file and display the diff:

autoflake --remove-unused-variables {{path/to/file.py}}

  • Remove unused imports from multiple files and display the diffs:

autoflake --remove-all-unused-imports {{path/to/file1.py path/to/file2.py ...}}

  • Remove unused variables from a file, overwriting the file:

autoflake --remove-unused-variables --in-place {{path/to/file.py}}

  • Remove unused variables recursively from all files in a directory, overwriting each file:

autoflake --remove-unused-variables --in-place --recursive {{path/to/directory}}