开发(例如Python 3.5)目标(例如Pylint)

发布于 2025-01-17 14:17:40 字数 158 浏览 1 评论 0 原文

我正在为 python3.5 目标编写代码。我无法控制我的开发环境,它最近升级到了 3.8。现在 pylint 会针对 python3.5 中不可用的功能(例如 f 字符串)吐出 100 条消息。

我没有 sudo 权限,所以我怀疑我是否可以安装自己的 3.5 二进制文件。我应该怎么办?

I have code being written for python3.5 target. I have no control of my development environment and it was recently upgraded to 3.8. Now the pylint spits out 100s of messages for features that are not available in python3.5 (e.g. f-strings).

I do not have sudo rights so I doubt I can install my own 3.5 binary. What should I do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蝶…霜飞 2025-01-24 14:17:40

您可以尝试将 py-version 设置为3.5,在从Pylint上删除Python 3.5后添加的所有内容都不太可能有效,因此不要考虑python 3.5 ,但它适用于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, ...

You can try to set the py-version to 3.5, it's unlikely to work for everything as it was added after python 3.5 was dropped from pylint so not with python 3.5 in mind but it's going to work for f-strings. You could also disable the message concerning the fstring in your pylintrc:

[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, ...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文