gpt4 book ai didi

python - Github Action flake8 失败 : f-string is missing placeholders

转载 作者:行者123 更新时间:2023-12-02 20:56:40 61 4
gpt4 key购买 nike

按照“FastAPI-TDD with Docker”类(class),我让项目在本地构建和传递,然后在 github 操作中失败:
来源中的进攻线似乎是:

    response = test_app_with_db.get(f"/summaries/")
Github Action 结果是:
Run docker exec fastapi-tdd python -m flake8 .
docker exec fastapi-tdd python -m flake8 .
shell: /bin/bash -e {0}
env:
IMAGE: docker.pkg.github.com/$GITHUB_REPOSITORY/web
./app/db.py:14:1: E303 too many blank lines (3)
./tests/test_ping.py:4:1: F401 'app.main' imported but unused
./tests/test_summaries.py:6:1: F401 'pytest' imported but unused
./tests/test_summaries.py:60:37: F541 f-string is missing placeholders
##[error]Process completed with exit code 1.

最佳答案

f 字符串与占位符一起使用
例子 :
如果您想将 '/summary/' 放在 f 字符串中,请将其分配给某个变量,然后将该变量放在占位符中
语法是

f'{variable}'
例子 :
f'{"quoted string"}'

关于python - Github Action flake8 失败 : f-string is missing placeholders,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62565979/

61 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com