为较旧的 (python 3.5) 目标开发(例如 pylint)
Developing (e.g. pylint) for older (python 3.5) target
我正在为 python3.5 目标编写代码。我无法控制我的开发环境,它最近升级到 3.8。现在,pylint 为 python3.5 中不可用的功能吐出 100 条消息(例如 f-strings)。
我没有 sudo 权限,所以我怀疑我能否安装自己的 3.5 二进制文件。我该怎么办?
您可以尝试将 py-version
设置为 3.5,它不太可能适用于所有内容,因为它是在 python 3.5 从 pylint 中删除后添加的,所以 python 3.5 中没有记 but it's going to work for f-strings。您还可以在 pylintrc 中禁用有关 fstring 的消息:
[MASTER]
# Minimum supported python version
py-version = 3.5.0
[MESSAGES CONTROL]
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then re-enable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=consider-using-f-string, f-string-without-interpolation, ...
我正在为 python3.5 目标编写代码。我无法控制我的开发环境,它最近升级到 3.8。现在,pylint 为 python3.5 中不可用的功能吐出 100 条消息(例如 f-strings)。
我没有 sudo 权限,所以我怀疑我能否安装自己的 3.5 二进制文件。我该怎么办?
您可以尝试将 py-version
设置为 3.5,它不太可能适用于所有内容,因为它是在 python 3.5 从 pylint 中删除后添加的,所以 python 3.5 中没有记 but it's going to work for f-strings。您还可以在 pylintrc 中禁用有关 fstring 的消息:
[MASTER]
# Minimum supported python version
py-version = 3.5.0
[MESSAGES CONTROL]
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then re-enable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=consider-using-f-string, f-string-without-interpolation, ...