The following issues were found

tests/test_tutorial/test_response_headers/test_tutorial002.py
5 issues
Missing module docstring
Error

Line: 1 Column: 1

              from fastapi.testclient import TestClient

from docs_src.response_headers.tutorial002 import app

client = TestClient(app)


def test_path_operation():
    response = client.get("/headers-and-object/")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

              client = TestClient(app)


def test_path_operation():
    response = client.get("/headers-and-object/")
    assert response.status_code == 200, response.text
    assert response.json() == {"message": "Hello World"}
    assert response.headers["X-Cat-Dog"] == "alone in the world"

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 10
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
def test_path_operation():
    response = client.get("/headers-and-object/")
    assert response.status_code == 200, response.text
    assert response.json() == {"message": "Hello World"}
    assert response.headers["X-Cat-Dog"] == "alone in the world"

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 11
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              def test_path_operation():
    response = client.get("/headers-and-object/")
    assert response.status_code == 200, response.text
    assert response.json() == {"message": "Hello World"}
    assert response.headers["X-Cat-Dog"] == "alone in the world"

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 12
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  response = client.get("/headers-and-object/")
    assert response.status_code == 200, response.text
    assert response.json() == {"message": "Hello World"}
    assert response.headers["X-Cat-Dog"] == "alone in the world"

            

Reported by Bandit.

tests/test_tutorial/test_response_cookies/test_tutorial002.py
5 issues
Missing module docstring
Error

Line: 1 Column: 1

              from fastapi.testclient import TestClient

from docs_src.response_cookies.tutorial002 import app

client = TestClient(app)


def test_path_operation():
    response = client.post("/cookie-and-object/")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

              client = TestClient(app)


def test_path_operation():
    response = client.post("/cookie-and-object/")
    assert response.status_code == 200, response.text
    assert response.json() == {"message": "Come to the dark side, we have cookies"}
    assert response.cookies["fakesession"] == "fake-cookie-session-value"

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 10
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
def test_path_operation():
    response = client.post("/cookie-and-object/")
    assert response.status_code == 200, response.text
    assert response.json() == {"message": "Come to the dark side, we have cookies"}
    assert response.cookies["fakesession"] == "fake-cookie-session-value"

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 11
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              def test_path_operation():
    response = client.post("/cookie-and-object/")
    assert response.status_code == 200, response.text
    assert response.json() == {"message": "Come to the dark side, we have cookies"}
    assert response.cookies["fakesession"] == "fake-cookie-session-value"

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 12
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  response = client.post("/cookie-and-object/")
    assert response.status_code == 200, response.text
    assert response.json() == {"message": "Come to the dark side, we have cookies"}
    assert response.cookies["fakesession"] == "fake-cookie-session-value"

            

Reported by Bandit.

tests/test_tutorial/test_response_cookies/test_tutorial001.py
5 issues
Missing module docstring
Error

Line: 1 Column: 1

              from fastapi.testclient import TestClient

from docs_src.response_cookies.tutorial001 import app

client = TestClient(app)


def test_path_operation():
    response = client.post("/cookie/")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

              client = TestClient(app)


def test_path_operation():
    response = client.post("/cookie/")
    assert response.status_code == 200, response.text
    assert response.json() == {"message": "Come to the dark side, we have cookies"}
    assert response.cookies["fakesession"] == "fake-cookie-session-value"

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 10
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
def test_path_operation():
    response = client.post("/cookie/")
    assert response.status_code == 200, response.text
    assert response.json() == {"message": "Come to the dark side, we have cookies"}
    assert response.cookies["fakesession"] == "fake-cookie-session-value"

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 11
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              def test_path_operation():
    response = client.post("/cookie/")
    assert response.status_code == 200, response.text
    assert response.json() == {"message": "Come to the dark side, we have cookies"}
    assert response.cookies["fakesession"] == "fake-cookie-session-value"

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 12
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  response = client.post("/cookie/")
    assert response.status_code == 200, response.text
    assert response.json() == {"message": "Come to the dark side, we have cookies"}
    assert response.cookies["fakesession"] == "fake-cookie-session-value"

            

Reported by Bandit.

docs_src/path_params_numeric_validations/tutorial006.py
5 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Path, Query

app = FastAPI()


@app.get("/items/{item_id}")
async def read_items(
    *,
    item_id: int = Path(..., title="The ID of the item to get", ge=0, le=1000),

            

Reported by Pylint.

Unused argument 'size'
Error

Line: 11 Column: 5

                  *,
    item_id: int = Path(..., title="The ID of the item to get", ge=0, le=1000),
    q: str,
    size: float = Query(..., gt=0, lt=10.5)
):
    results = {"item_id": item_id}
    if q:
        results.update({"q": q})
    return results

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Path, Query

app = FastAPI()


@app.get("/items/{item_id}")
async def read_items(
    *,
    item_id: int = Path(..., title="The ID of the item to get", ge=0, le=1000),

            

Reported by Pylint.

Missing function or method docstring
Error

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", ge=0, le=1000),
    q: str,
    size: float = Query(..., gt=0, lt=10.5)
):

            

Reported by Pylint.

Variable name "q" doesn't conform to snake_case naming style
Error

Line: 10 Column: 5

              async def read_items(
    *,
    item_id: int = Path(..., title="The ID of the item to get", ge=0, le=1000),
    q: str,
    size: float = Query(..., gt=0, lt=10.5)
):
    results = {"item_id": item_id}
    if q:
        results.update({"q": q})

            

Reported by Pylint.

docs_src/bigger_applications/app/routers/users.py
5 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import APIRouter

router = APIRouter()


@router.get("/users/", tags=["users"])
async def read_users():
    return [{"username": "Rick"}, {"username": "Morty"}]


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import APIRouter

router = APIRouter()


@router.get("/users/", tags=["users"])
async def read_users():
    return [{"username": "Rick"}, {"username": "Morty"}]


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              

@router.get("/users/", tags=["users"])
async def read_users():
    return [{"username": "Rick"}, {"username": "Morty"}]


@router.get("/users/me", tags=["users"])
async def read_user_me():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 1

              

@router.get("/users/me", tags=["users"])
async def read_user_me():
    return {"username": "fakecurrentuser"}


@router.get("/users/{username}", tags=["users"])
async def read_user(username: str):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

              

@router.get("/users/{username}", tags=["users"])
async def read_user(username: str):
    return {"username": username}

            

Reported by Pylint.

docs_src/path_operation_configuration/tutorial006.py
5 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI

app = FastAPI()


@app.get("/items/", tags=["items"])
async def read_items():
    return [{"name": "Foo", "price": 42}]


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI

app = FastAPI()


@app.get("/items/", tags=["items"])
async def read_items():
    return [{"name": "Foo", "price": 42}]


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              

@app.get("/items/", tags=["items"])
async def read_items():
    return [{"name": "Foo", "price": 42}]


@app.get("/users/", tags=["users"])
async def read_users():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 1

              

@app.get("/users/", tags=["users"])
async def read_users():
    return [{"username": "johndoe"}]


@app.get("/elements/", tags=["items"], deprecated=True)
async def read_elements():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

              

@app.get("/elements/", tags=["items"], deprecated=True)
async def read_elements():
    return [{"item_id": "Foo"}]

            

Reported by Pylint.

docs_src/path_operation_configuration/tutorial004.py
5 issues
Unable to import 'fastapi'
Error

Line: 3 Column: 1

              from typing import Optional, Set

from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()


class Item(BaseModel):

            

Reported by Pylint.

Unable to import 'pydantic'
Error

Line: 4 Column: 1

              from typing import Optional, Set

from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()


class Item(BaseModel):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from typing import Optional, Set

from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()


class Item(BaseModel):

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 9 Column: 1

              app = FastAPI()


class Item(BaseModel):
    name: str
    description: Optional[str] = None
    price: float
    tax: Optional[float] = None
    tags: Set[str] = []

            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

              app = FastAPI()


class Item(BaseModel):
    name: str
    description: Optional[str] = None
    price: float
    tax: Optional[float] = None
    tags: Set[str] = []

            

Reported by Pylint.

docs_src/custom_response/tutorial003.py
4 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI
from fastapi.responses import HTMLResponse

app = FastAPI()


@app.get("/items/")
async def read_items():
    html_content = """

            

Reported by Pylint.

Unable to import 'fastapi.responses'
Error

Line: 2 Column: 1

              from fastapi import FastAPI
from fastapi.responses import HTMLResponse

app = FastAPI()


@app.get("/items/")
async def read_items():
    html_content = """

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI
from fastapi.responses import HTMLResponse

app = FastAPI()


@app.get("/items/")
async def read_items():
    html_content = """

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

              

@app.get("/items/")
async def read_items():
    html_content = """
    <html>
        <head>
            <title>Some HTML in here</title>
        </head>

            

Reported by Pylint.

docs_src/settings/app02/config.py
4 issues
Unable to import 'pydantic'
Error

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.

Missing module docstring
Error

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.

Missing class docstring
Error

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.

Too few public methods (0/2)
Error

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/settings/app01/main.py
4 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI

from .config import settings

app = FastAPI()


@app.get("/info")
async def info():

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 3 Column: 1

              from fastapi import FastAPI

from .config import settings

app = FastAPI()


@app.get("/info")
async def info():

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI

from .config import settings

app = FastAPI()


@app.get("/info")
async def info():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 9 Column: 1

              

@app.get("/info")
async def info():
    return {
        "app_name": settings.app_name,
        "admin_email": settings.admin_email,
        "items_per_user": settings.items_per_user,
    }

            

Reported by Pylint.