我在我的系统上安装了 Pyton 3.6.8。
python3 --version //-> Python 3.6.8
python3.6 --version //-> Python 3.6.8
我的 pre-commit-config.yaml 是:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
language_version: python3.6
我为我的项目安装了预提交挂钩。每次我想对 git 提交一些更改时,预提交都会运行 flake8 错误:
TYP005 NamedTuple does not support defaults in 3.6.0
这适用于 Python 3.6.0,因为 Python 3.6.1+ 引入并允许此功能。 https://docs.python.org/3.6/library/typing.html#typing.NamedTuple
如何将 flake8 配置为与 Python 3.6.8 一起运行?
编辑 当我运行 flake8 file.rb 时,我没有收到错误消息 TYP005。
python3 -m pip install flake
flake --version //-> 3.7.9 (the same version as in the pre-commit script file)