The following issues were found
docs_src/path_params_numeric_validations/tutorial003.py
4 issues
Line: 1
Column: 1
from fastapi import FastAPI, Path
app = FastAPI()
@app.get("/items/{item_id}")
async def read_items(
*, item_id: int = Path(..., title="The ID of the item to get"), q: str
):
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI, Path
app = FastAPI()
@app.get("/items/{item_id}")
async def read_items(
*, item_id: int = Path(..., title="The ID of the item to get"), q: str
):
Reported by Pylint.
Line: 7
Column: 1
@app.get("/items/{item_id}")
async def read_items(
*, item_id: int = Path(..., title="The ID of the item to get"), q: str
):
results = {"item_id": item_id}
if q:
results.update({"q": q})
Reported by Pylint.
Line: 8
Column: 69
@app.get("/items/{item_id}")
async def read_items(
*, item_id: int = Path(..., title="The ID of the item to get"), q: str
):
results = {"item_id": item_id}
if q:
results.update({"q": q})
return results
Reported by Pylint.
docs_src/path_params_numeric_validations/tutorial002.py
4 issues
Line: 1
Column: 1
from fastapi import FastAPI, Path
app = FastAPI()
@app.get("/items/{item_id}")
async def read_items(
q: str, item_id: int = Path(..., title="The ID of the item to get")
):
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI, Path
app = FastAPI()
@app.get("/items/{item_id}")
async def read_items(
q: str, item_id: int = Path(..., title="The ID of the item to get")
):
Reported by Pylint.
Line: 7
Column: 1
@app.get("/items/{item_id}")
async def read_items(
q: str, item_id: int = Path(..., title="The ID of the item to get")
):
results = {"item_id": item_id}
if q:
results.update({"q": q})
Reported by Pylint.
Line: 7
Column: 1
@app.get("/items/{item_id}")
async def read_items(
q: str, item_id: int = Path(..., title="The ID of the item to get")
):
results = {"item_id": item_id}
if q:
results.update({"q": q})
Reported by Pylint.
docs_src/path_params_numeric_validations/tutorial001.py
4 issues
Line: 3
Column: 1
from typing import Optional
from fastapi import FastAPI, Path, Query
app = FastAPI()
@app.get("/items/{item_id}")
async def read_items(
Reported by Pylint.
Line: 1
Column: 1
from typing import Optional
from fastapi import FastAPI, Path, Query
app = FastAPI()
@app.get("/items/{item_id}")
async def read_items(
Reported by Pylint.
Line: 9
Column: 1
@app.get("/items/{item_id}")
async def read_items(
item_id: int = Path(..., title="The ID of the item to get"),
q: Optional[str] = Query(None, alias="item-query"),
):
results = {"item_id": item_id}
if q:
Reported by Pylint.
Line: 9
Column: 1
@app.get("/items/{item_id}")
async def read_items(
item_id: int = Path(..., title="The ID of the item to get"),
q: Optional[str] = Query(None, alias="item-query"),
):
results = {"item_id": item_id}
if q:
Reported by Pylint.
docs_src/path_params/tutorial003.py
4 issues
Line: 1
Column: 1
from fastapi import FastAPI
app = FastAPI()
@app.get("/users/me")
async def read_user_me():
return {"user_id": "the current user"}
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI
app = FastAPI()
@app.get("/users/me")
async def read_user_me():
return {"user_id": "the current user"}
Reported by Pylint.
Line: 7
Column: 1
@app.get("/users/me")
async def read_user_me():
return {"user_id": "the current user"}
@app.get("/users/{user_id}")
async def read_user(user_id: str):
Reported by Pylint.
Line: 12
Column: 1
@app.get("/users/{user_id}")
async def read_user(user_id: str):
return {"user_id": user_id}
Reported by Pylint.
docs_src/path_operation_advanced_configuration/tutorial006.py
4 issues
Line: 1
Column: 1
from fastapi import FastAPI, Request
app = FastAPI()
def magic_data_reader(raw_body: bytes):
return {
"size": len(raw_body),
"content": {
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI, Request
app = FastAPI()
def magic_data_reader(raw_body: bytes):
return {
"size": len(raw_body),
"content": {
Reported by Pylint.
Line: 6
Column: 1
app = FastAPI()
def magic_data_reader(raw_body: bytes):
return {
"size": len(raw_body),
"content": {
"name": "Maaaagic",
"price": 42,
Reported by Pylint.
Line: 35
Column: 1
}
},
"required": True,
},
},
)
async def create_item(request: Request):
raw_body = await request.body()
data = magic_data_reader(raw_body)
Reported by Pylint.
docs_src/metadata/tutorial004.py
4 issues
Line: 1
Column: 1
from fastapi import FastAPI
tags_metadata = [
{
"name": "users",
"description": "Operations with users. The **login** logic is also here.",
},
{
"name": "items",
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI
tags_metadata = [
{
"name": "users",
"description": "Operations with users. The **login** logic is also here.",
},
{
"name": "items",
Reported by Pylint.
Line: 22
Column: 1
@app.get("/users/", tags=["users"])
async def get_users():
return [{"name": "Harry"}, {"name": "Ron"}]
@app.get("/items/", tags=["items"])
async def get_items():
Reported by Pylint.
Line: 27
Column: 1
@app.get("/items/", tags=["items"])
async def get_items():
return [{"name": "wand"}, {"name": "flying broom"}]
Reported by Pylint.
docs_src/metadata/tutorial001.py
4 issues
Line: 1
Column: 1
from fastapi import FastAPI
description = """
ChimichangApp API helps you do awesome stuff. 🚀
## Items
You can **read items**.
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI
description = """
ChimichangApp API helps you do awesome stuff. 🚀
## Items
You can **read items**.
Reported by Pylint.
Line: 3
Column: 1
from fastapi import FastAPI
description = """
ChimichangApp API helps you do awesome stuff. 🚀
## Items
You can **read items**.
Reported by Pylint.
Line: 36
Column: 1
@app.get("/items/")
async def read_items():
return [{"name": "Katana"}]
Reported by Pylint.
docs_src/events/tutorial002.py
4 issues
Line: 1
Column: 1
from fastapi import FastAPI
app = FastAPI()
@app.on_event("shutdown")
def shutdown_event():
with open("log.txt", mode="a") as log:
log.write("Application shutdown")
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI
app = FastAPI()
@app.on_event("shutdown")
def shutdown_event():
with open("log.txt", mode="a") as log:
log.write("Application shutdown")
Reported by Pylint.
Line: 7
Column: 1
@app.on_event("shutdown")
def shutdown_event():
with open("log.txt", mode="a") as log:
log.write("Application shutdown")
@app.get("/items/")
Reported by Pylint.
Line: 13
Column: 1
@app.get("/items/")
async def read_items():
return [{"name": "Foo"}]
Reported by Pylint.
docs_src/events/tutorial001.py
4 issues
Line: 1
Column: 1
from fastapi import FastAPI
app = FastAPI()
items = {}
@app.on_event("startup")
async def startup_event():
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI
app = FastAPI()
items = {}
@app.on_event("startup")
async def startup_event():
Reported by Pylint.
Line: 9
Column: 1
@app.on_event("startup")
async def startup_event():
items["foo"] = {"name": "Fighters"}
items["bar"] = {"name": "Tenders"}
@app.get("/items/{item_id}")
Reported by Pylint.
Line: 15
Column: 1
@app.get("/items/{item_id}")
async def read_items(item_id: str):
return items[item_id]
Reported by Pylint.
docs_src/dependencies/tutorial007.py
4 issues
Line: 2
Column: 10
async def get_db():
db = DBSession()
try:
yield db
finally:
db.close()
Reported by Pylint.
Line: 1
Column: 1
async def get_db():
db = DBSession()
try:
yield db
finally:
db.close()
Reported by Pylint.
Line: 1
Column: 1
async def get_db():
db = DBSession()
try:
yield db
finally:
db.close()
Reported by Pylint.
Line: 2
Column: 5
async def get_db():
db = DBSession()
try:
yield db
finally:
db.close()
Reported by Pylint.