Linux command
pyflakes 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Check a Python file
pyflakes [file.py]
Check multiple files
pyflakes [file1.py] [file2.py]
Check from stdin
cat [file.py] | pyflakes
Check a directory
pyflakes [path/to/directory]
说明
pyflakes is a fast, lightweight static analysis tool that checks Python source files for common errors without executing them. It detects issues like undefined names, unused imports, redefined variables, and other logical mistakes that would cause runtime failures. Unlike pylint or flake8, pyflakes focuses exclusively on error detection and does not check code style or formatting. This narrow scope makes it significantly faster and produces no false positives for stylistic choices, making it well-suited for integration into editors and pre-commit hooks where speed matters.
参数
- --version
- Show program version and exit
- -h, --help
- Show help message and exit
FAQ
What is the pyflakes command used for?
pyflakes is a fast, lightweight static analysis tool that checks Python source files for common errors without executing them. It detects issues like undefined names, unused imports, redefined variables, and other logical mistakes that would cause runtime failures. Unlike pylint or flake8, pyflakes focuses exclusively on error detection and does not check code style or formatting. This narrow scope makes it significantly faster and produces no false positives for stylistic choices, making it well-suited for integration into editors and pre-commit hooks where speed matters.
How do I run a basic pyflakes example?
Run `pyflakes [file.py]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --version do in pyflakes?
Show program version and exit