table of contents
autoflake(1) | General Commands Manual | autoflake(1) |
NAME¶
autoflake - removes unused imports and unused variables in Python code
SYNOPSIS¶
autoflake [-h] [-c | -cd] [--imports IMPORTS | --remove-all-unused-imports] [-r] [-j n] [--exclude globs] [--expand-star-imports] [--ignore-init-module-imports] [--remove-duplicate-keys] [--remove-unused-variables] [--remove-rhs-for-unused-variables] [--ignore-pass-statements] [--ignore-pass-after-docstring] [--version] [--quiet] [-v] [--stdin-display-name STDIN_DISPLAY_NAME] [--config CONFIG_FILE] [-i | -s] files [files ...]
DESCRIPTION¶
Removes unused imports and unused variables as reported by pyflakes.
OPTIONS¶
- files
- files to format
- -c, --check
- return error code if changes are needed
- -cd, --check-diff
- return error code if changes are needed, also display file diffs
- --imports IMPORTS
- by default, only unused standard library imports are removed; specify a
comma-
separated list of additional modules/packages - --remove-all-unused-imports
- remove all unused imports (not just those from the standard library)
- -r, --recursive
- drill down directories recursively
- -j n, --jobs n
- number of parallel jobs; match CPU count if value is 0 (default: 0)
- --exclude globs
- exclude file/directory names that match these comma-separated globs
- --expand-star-imports
- expand wildcard star imports with undefined names; this only triggers if
there
is only one star import in the file; this is skipped if there are any uses of
`__all__` or `del` in the file - --ignore-init-module-imports
- exclude __init__.py when removing unused imports
- --remove-duplicate-keys
- remove all duplicate keys in objects
- --remove-unused-variables
- remove unused variables
- --remove-rhs-for-unused-variables
- remove RHS of statements when removing unused variables (unsafe)
- --ignore-pass-statements
- ignore all pass statements
- --ignore-pass-after-docstring
- ignore pass statements after a newline ending on '"""'
- --version
- show program's version number and exit
- --quiet
- Suppress output if there are no issues
- -v, --verbose
- print more verbose logs (you can repeat `-v` to make it more verbose)
- --stdin-display-name STDIN_DISPLAY_NAME
- the name used when processing input from stdin
- --config CONFIG_FILE
- Explicitly set the config file instead of auto determining based on file
location - -i, --in-place
- make changes to files instead of printing diffs
- -s, --stdout
- print changed text to stdout. defaults to true when formatting stdin, or
to
false otherwise
AUTHORS¶
autoflake was written by Steven Myint <git@stevenmyint.com>.
DISTRIBUTION¶
The latest version of autoflake may be downloaded from https://github.com/PyCQA/autoflake
Manual |