运行黑色会导致错误“此浮标没有领先的数字”。

发布于 2025-01-24 08:05:31 字数 557 浏览 3 评论 0原文

当我尝试使用black a_file.py.py在我的python项目的特定文件上运行黑色时,我会收到以下错误:

 Error reading configuration file: This float doesn't have a leading digit (line 19 column 1 char 205)

下面是我的pyproject.toml文件:

[tool.black]
line-length = 88
include = '\.pyi?$'
exclude = '''
/(
    \.git
  | \.hg
  | \.mypy_cache
  | \.tox
  | \.venv
  | buck-out
  | build
)/
'''

[flake8]
max-line-length = 88
max-complexity = 18
select = B, C, E, F, W, T4, B9
ignore = E203, E266, E501, W503, F403, F401

如何解决此问题?

When I try to run black on a specific file of my python project using black a_file.py, I get the following error:

 Error reading configuration file: This float doesn't have a leading digit (line 19 column 1 char 205)

Below is my pyproject.toml file:

[tool.black]
line-length = 88
include = '\.pyi?

How can I fix this issue?

exclude = ''' /( \.git | \.hg | \.mypy_cache | \.tox | \.venv | buck-out | build )/ ''' [flake8] max-line-length = 88 max-complexity = 18 select = B, C, E, F, W, T4, B9 ignore = E203, E266, E501, W503, F403, F401

How can I fix this issue?

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

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

发布评论

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

评论(1

高跟鞋的旋律 2025-01-31 08:05:31

这是您使用错误语法的pyproject.toml文件的问题。例如,select = b,c,e,f,w,t4,b9之类的行是ini-syntax - 在toml中,等效的是select =“ b,c,c, e,f,w,t4,b9“select = [“ b”,“ c”,“ e”,“ f”,“ w”,“ w”,“ t4”,“ b9”]] < /代码>。

但是, flake8尚未支持pyproject.toml首先。只需从文件中删除其配置即可。

configuration>配置位置

flake8支持将其配置存储在您的项目中,以在setup.cfg,tox.ini和.flake8。

This is an issue of your pyproject.toml file using incorrect syntax. For example, a line such as select = B, C, E, F, W, T4, B9 is INI-syntax – in TOML the equivalent would be select = "B, C, E, F, W, T4, B9" or select = ["B", "C", "E", "F", "W", "T4", "B9"].

However, flake8 does not yet support pyproject.toml to begin with. Simply remove its configuration from the file.

Configuration Locations

Flake8 supports storing its configuration in your project in one of setup.cfg, tox.ini, or .flake8.

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