The following issues were found
tests/test_fakeasync.py
4 issues
Line: 1
Column: 1
import pytest
from fastapi.concurrency import _fake_asynccontextmanager
@_fake_asynccontextmanager
def never_run():
pass # pragma: no cover
Reported by Pylint.
Line: 1
Column: 1
import pytest
from fastapi.concurrency import _fake_asynccontextmanager
@_fake_asynccontextmanager
def never_run():
pass # pragma: no cover
Reported by Pylint.
Line: 6
Column: 1
@_fake_asynccontextmanager
def never_run():
pass # pragma: no cover
def test_fake_async():
with pytest.raises(RuntimeError):
Reported by Pylint.
Line: 10
Column: 1
pass # pragma: no cover
def test_fake_async():
with pytest.raises(RuntimeError):
never_run()
Reported by Pylint.
docs_src/settings/app01/config.py
4 issues
Line: 1
Column: 1
from pydantic import BaseSettings
class Settings(BaseSettings):
app_name: str = "Awesome API"
admin_email: str
items_per_user: int = 50
Reported by Pylint.
Line: 1
Column: 1
from pydantic import BaseSettings
class Settings(BaseSettings):
app_name: str = "Awesome API"
admin_email: str
items_per_user: int = 50
Reported by Pylint.
Line: 4
Column: 1
from pydantic import BaseSettings
class Settings(BaseSettings):
app_name: str = "Awesome API"
admin_email: str
items_per_user: int = 50
Reported by Pylint.
Line: 4
Column: 1
from pydantic import BaseSettings
class Settings(BaseSettings):
app_name: str = "Awesome API"
admin_email: str
items_per_user: int = 50
Reported by Pylint.
docs_src/security/tutorial006.py
4 issues
Line: 1
Column: 1
from fastapi import Depends, FastAPI
from fastapi.security import HTTPBasic, HTTPBasicCredentials
app = FastAPI()
security = HTTPBasic()
@app.get("/users/me")
Reported by Pylint.
Line: 2
Column: 1
from fastapi import Depends, FastAPI
from fastapi.security import HTTPBasic, HTTPBasicCredentials
app = FastAPI()
security = HTTPBasic()
@app.get("/users/me")
Reported by Pylint.
Line: 1
Column: 1
from fastapi import Depends, FastAPI
from fastapi.security import HTTPBasic, HTTPBasicCredentials
app = FastAPI()
security = HTTPBasic()
@app.get("/users/me")
Reported by Pylint.
Line: 10
Column: 1
@app.get("/users/me")
def read_current_user(credentials: HTTPBasicCredentials = Depends(security)):
return {"username": credentials.username, "password": credentials.password}
Reported by Pylint.
docs_src/security/tutorial001.py
4 issues
Line: 1
Column: 1
from fastapi import Depends, FastAPI
from fastapi.security import OAuth2PasswordBearer
app = FastAPI()
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
@app.get("/items/")
Reported by Pylint.
Line: 2
Column: 1
from fastapi import Depends, FastAPI
from fastapi.security import OAuth2PasswordBearer
app = FastAPI()
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
@app.get("/items/")
Reported by Pylint.
Line: 1
Column: 1
from fastapi import Depends, FastAPI
from fastapi.security import OAuth2PasswordBearer
app = FastAPI()
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
@app.get("/items/")
Reported by Pylint.
Line: 10
Column: 1
@app.get("/items/")
async def read_items(token: str = Depends(oauth2_scheme)):
return {"token": token}
Reported by Pylint.
tests/test_modules_same_name_body/app/a.py
4 issues
Line: 1
Column: 1
from fastapi import APIRouter, Body
router = APIRouter()
@router.post("/compute")
def compute(a: int = Body(...), b: str = Body(...)):
return {"a": a, "b": b}
Reported by Pylint.
Line: 7
Column: 1
@router.post("/compute")
def compute(a: int = Body(...), b: str = Body(...)):
return {"a": a, "b": b}
Reported by Pylint.
Line: 7
Column: 1
@router.post("/compute")
def compute(a: int = Body(...), b: str = Body(...)):
return {"a": a, "b": b}
Reported by Pylint.
Line: 7
Column: 1
@router.post("/compute")
def compute(a: int = Body(...), b: str = Body(...)):
return {"a": a, "b": b}
Reported by Pylint.
tests/test_modules_same_name_body/app/b.py
4 issues
Line: 1
Column: 1
from fastapi import APIRouter, Body
router = APIRouter()
@router.post("/compute/")
def compute(a: int = Body(...), b: str = Body(...)):
return {"a": a, "b": b}
Reported by Pylint.
Line: 7
Column: 1
@router.post("/compute/")
def compute(a: int = Body(...), b: str = Body(...)):
return {"a": a, "b": b}
Reported by Pylint.
Line: 7
Column: 1
@router.post("/compute/")
def compute(a: int = Body(...), b: str = Body(...)):
return {"a": a, "b": b}
Reported by Pylint.
Line: 7
Column: 1
@router.post("/compute/")
def compute(a: int = Body(...), b: str = Body(...)):
return {"a": a, "b": b}
Reported by Pylint.
docs_src/response_headers/tutorial001.py
4 issues
Line: 1
Column: 1
from fastapi import FastAPI
from fastapi.responses import JSONResponse
app = FastAPI()
@app.get("/headers/")
def get_headers():
content = {"message": "Hello World"}
Reported by Pylint.
Line: 2
Column: 1
from fastapi import FastAPI
from fastapi.responses import JSONResponse
app = FastAPI()
@app.get("/headers/")
def get_headers():
content = {"message": "Hello World"}
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI
from fastapi.responses import JSONResponse
app = FastAPI()
@app.get("/headers/")
def get_headers():
content = {"message": "Hello World"}
Reported by Pylint.
Line: 8
Column: 1
@app.get("/headers/")
def get_headers():
content = {"message": "Hello World"}
headers = {"X-Cat-Dog": "alone in the world", "Content-Language": "en-US"}
return JSONResponse(content=content, headers=headers)
Reported by Pylint.
docs_src/response_cookies/tutorial001.py
4 issues
Line: 1
Column: 1
from fastapi import FastAPI
from fastapi.responses import JSONResponse
app = FastAPI()
@app.post("/cookie/")
def create_cookie():
content = {"message": "Come to the dark side, we have cookies"}
Reported by Pylint.
Line: 2
Column: 1
from fastapi import FastAPI
from fastapi.responses import JSONResponse
app = FastAPI()
@app.post("/cookie/")
def create_cookie():
content = {"message": "Come to the dark side, we have cookies"}
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI
from fastapi.responses import JSONResponse
app = FastAPI()
@app.post("/cookie/")
def create_cookie():
content = {"message": "Come to the dark side, we have cookies"}
Reported by Pylint.
Line: 8
Column: 1
@app.post("/cookie/")
def create_cookie():
content = {"message": "Come to the dark side, we have cookies"}
response = JSONResponse(content=content)
response.set_cookie(key="fakesession", value="fake-cookie-session-value")
return response
Reported by Pylint.
docs_src/request_forms/tutorial001.py
4 issues
Line: 1
Column: 1
from fastapi import FastAPI, Form
app = FastAPI()
@app.post("/login/")
async def login(username: str = Form(...), password: str = Form(...)):
return {"username": username}
Reported by Pylint.
Line: 7
Column: 44
@app.post("/login/")
async def login(username: str = Form(...), password: str = Form(...)):
return {"username": username}
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI, Form
app = FastAPI()
@app.post("/login/")
async def login(username: str = Form(...), password: str = Form(...)):
return {"username": username}
Reported by Pylint.
Line: 7
Column: 1
@app.post("/login/")
async def login(username: str = Form(...), password: str = Form(...)):
return {"username": username}
Reported by Pylint.
docs_src/request_files/tutorial001.py
4 issues
Line: 1
Column: 1
from fastapi import FastAPI, File, UploadFile
app = FastAPI()
@app.post("/files/")
async def create_file(file: bytes = File(...)):
return {"file_size": len(file)}
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI, File, UploadFile
app = FastAPI()
@app.post("/files/")
async def create_file(file: bytes = File(...)):
return {"file_size": len(file)}
Reported by Pylint.
Line: 7
Column: 1
@app.post("/files/")
async def create_file(file: bytes = File(...)):
return {"file_size": len(file)}
@app.post("/uploadfile/")
async def create_upload_file(file: UploadFile = File(...)):
Reported by Pylint.
Line: 12
Column: 1
@app.post("/uploadfile/")
async def create_upload_file(file: UploadFile = File(...)):
return {"filename": file.filename}
Reported by Pylint.