Add flake8-comprehensions linter (#157)

This commit is contained in:
Martijn Pieters
2023-05-16 13:18:53 +01:00
committed by GitHub
parent 50e3f91a87
commit d938bbe4d2
3 changed files with 10 additions and 9 deletions

View File

@@ -27,7 +27,7 @@ async def get_ret():
@app.get("/") @app.get("/")
@cache(namespace="test", expire=10) @cache(namespace="test", expire=10)
async def index(): async def index():
return dict(ret=await get_ret()) return {"ret": await get_ret()}
@app.get("/clear") @app.get("/clear")

View File

@@ -38,7 +38,7 @@ async def get_ret():
@app.get("/") @app.get("/")
@cache(namespace="test", expire=10) @cache(namespace="test", expire=10)
async def index(): async def index():
return dict(ret=await get_ret()) return {"ret": await get_ret()}
@app.get("/clear") @app.get("/clear")
@@ -58,7 +58,7 @@ async def get_data(request: Request, response: Response):
@cache(namespace="test", expire=10) @cache(namespace="test", expire=10)
def blocking(): def blocking():
time.sleep(2) time.sleep(2)
return dict(ret=42) return {"ret": 42}
@app.get("/datetime") @app.get("/datetime")

View File

@@ -81,12 +81,13 @@ addopts = "-p no:warnings"
ignore = ["E501"] ignore = ["E501"]
line-length = 80 line-length = 80
select = [ select = [
"B", # flake8-bugbear "B", # flake8-bugbear
"E", # pycodestyle errors "C4", # flake8-comprehensions
"F", # pyflakes "E", # pycodestyle errors
"I", # isort "F", # pyflakes
"S", # flake8-bandit "I", # isort
"W", # pycodestyle warnings "S", # flake8-bandit
"W", # pycodestyle warnings
"UP", # pyupgrade "UP", # pyupgrade
] ]
target-version = "py37" target-version = "py37"