The following issues were found

docs_src/response_directly/tutorial002.py
3 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Response

app = FastAPI()


@app.get("/legacy/")
def get_legacy_data():
    data = """<?xml version="1.0"?>
    <shampoo>

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Response

app = FastAPI()


@app.get("/legacy/")
def get_legacy_data():
    data = """<?xml version="1.0"?>
    <shampoo>

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              

@app.get("/legacy/")
def get_legacy_data():
    data = """<?xml version="1.0"?>
    <shampoo>
    <Header>
        Apply shampoo here.
    </Header>

            

Reported by Pylint.

docs_src/behind_a_proxy/tutorial002.py
3 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Request

app = FastAPI(root_path="/api/v1")


@app.get("/app")
def read_main(request: Request):
    return {"message": "Hello World", "root_path": request.scope.get("root_path")}

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Request

app = FastAPI(root_path="/api/v1")


@app.get("/app")
def read_main(request: Request):
    return {"message": "Hello World", "root_path": request.scope.get("root_path")}

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              

@app.get("/app")
def read_main(request: Request):
    return {"message": "Hello World", "root_path": request.scope.get("root_path")}

            

Reported by Pylint.

docs_src/response_headers/tutorial002.py
3 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Response

app = FastAPI()


@app.get("/headers-and-object/")
def get_headers(response: Response):
    response.headers["X-Cat-Dog"] = "alone in the world"
    return {"message": "Hello World"}

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Response

app = FastAPI()


@app.get("/headers-and-object/")
def get_headers(response: Response):
    response.headers["X-Cat-Dog"] = "alone in the world"
    return {"message": "Hello World"}

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              

@app.get("/headers-and-object/")
def get_headers(response: Response):
    response.headers["X-Cat-Dog"] = "alone in the world"
    return {"message": "Hello World"}

            

Reported by Pylint.

docs_src/behind_a_proxy/tutorial001.py
3 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Request

app = FastAPI()


@app.get("/app")
def read_main(request: Request):
    return {"message": "Hello World", "root_path": request.scope.get("root_path")}

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Request

app = FastAPI()


@app.get("/app")
def read_main(request: Request):
    return {"message": "Hello World", "root_path": request.scope.get("root_path")}

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              

@app.get("/app")
def read_main(request: Request):
    return {"message": "Hello World", "root_path": request.scope.get("root_path")}

            

Reported by Pylint.

docs_src/behind_a_proxy/tutorial004.py
3 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Request

app = FastAPI(
    servers=[
        {"url": "https://stag.example.com", "description": "Staging environment"},
        {"url": "https://prod.example.com", "description": "Production environment"},
    ],
    root_path="/api/v1",
    root_path_in_servers=False,

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Request

app = FastAPI(
    servers=[
        {"url": "https://stag.example.com", "description": "Staging environment"},
        {"url": "https://prod.example.com", "description": "Production environment"},
    ],
    root_path="/api/v1",
    root_path_in_servers=False,

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 14 Column: 1

              

@app.get("/app")
def read_main(request: Request):
    return {"message": "Hello World", "root_path": request.scope.get("root_path")}

            

Reported by Pylint.

fastapi/security/base.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              from fastapi.openapi.models import SecurityBase as SecurityBaseModel


class SecurityBase:
    model: SecurityBaseModel
    scheme_name: str

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 4 Column: 1

              from fastapi.openapi.models import SecurityBase as SecurityBaseModel


class SecurityBase:
    model: SecurityBaseModel
    scheme_name: str

            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              from fastapi.openapi.models import SecurityBase as SecurityBaseModel


class SecurityBase:
    model: SecurityBaseModel
    scheme_name: str

            

Reported by Pylint.

tests/test_tutorial/test_sql_databases/test_testing_databases.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              import importlib
from pathlib import Path


def test_testing_dbs():
    test_db = Path("./test.db")
    if test_db.is_file():  # pragma: nocover
        test_db.unlink()
    # Import while creating the client to create the DB after starting the test session

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 1

              from pathlib import Path


def test_testing_dbs():
    test_db = Path("./test.db")
    if test_db.is_file():  # pragma: nocover
        test_db.unlink()
    # Import while creating the client to create the DB after starting the test session
    from docs_src.sql_databases.sql_app.tests import test_sql_app

            

Reported by Pylint.

Import outside toplevel (docs_src.sql_databases.sql_app.tests.test_sql_app)
Error

Line: 10 Column: 5

                  if test_db.is_file():  # pragma: nocover
        test_db.unlink()
    # Import while creating the client to create the DB after starting the test session
    from docs_src.sql_databases.sql_app.tests import test_sql_app

    # Ensure import side effects are re-executed
    importlib.reload(test_sql_app)
    test_sql_app.test_create_user()
    if test_db.is_file():  # pragma: nocover

            

Reported by Pylint.

tests/test_tutorial/test_async_tests/test_main.py
3 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import pytest

from docs_src.async_tests.test_main import test_root


@pytest.mark.asyncio
async def test_async_testing():
    await test_root()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import pytest

from docs_src.async_tests.test_main import test_root


@pytest.mark.asyncio
async def test_async_testing():
    await test_root()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              

@pytest.mark.asyncio
async def test_async_testing():
    await test_root()

            

Reported by Pylint.

docs_src/async_tests/main.py
3 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI

app = FastAPI()


@app.get("/")
async def root():
    return {"message": "Tomato"}

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI

app = FastAPI()


@app.get("/")
async def root():
    return {"message": "Tomato"}

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              

@app.get("/")
async def root():
    return {"message": "Tomato"}

            

Reported by Pylint.

docs_src/metadata/tutorial002.py
3 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI

app = FastAPI(openapi_url="/api/v1/openapi.json")


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

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI

app = FastAPI(openapi_url="/api/v1/openapi.json")


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

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              

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

            

Reported by Pylint.