The following issues were found

docs_src/additional_responses/tutorial002.py
9 issues
Unable to import 'fastapi'
Error

Line: 3 Column: 1

              from typing import Optional

from fastapi import FastAPI
from fastapi.responses import FileResponse
from pydantic import BaseModel


class Item(BaseModel):
    id: str

            

Reported by Pylint.

Unable to import 'fastapi.responses'
Error

Line: 4 Column: 1

              from typing import Optional

from fastapi import FastAPI
from fastapi.responses import FileResponse
from pydantic import BaseModel


class Item(BaseModel):
    id: str

            

Reported by Pylint.

Unable to import 'pydantic'
Error

Line: 5 Column: 1

              
from fastapi import FastAPI
from fastapi.responses import FileResponse
from pydantic import BaseModel


class Item(BaseModel):
    id: str
    value: str

            

Reported by Pylint.

Unused argument 'item_id'
Error

Line: 26 Column: 21

                      }
    },
)
async def read_item(item_id: str, img: Optional[bool] = None):
    if img:
        return FileResponse("image.png", media_type="image/png")
    else:
        return {"id": "foo", "value": "there goes my hero"}

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from typing import Optional

from fastapi import FastAPI
from fastapi.responses import FileResponse
from pydantic import BaseModel


class Item(BaseModel):
    id: str

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 8 Column: 1

              from pydantic import BaseModel


class Item(BaseModel):
    id: str
    value: str


app = FastAPI()

            

Reported by Pylint.

Missing class docstring
Error

Line: 8 Column: 1

              from pydantic import BaseModel


class Item(BaseModel):
    id: str
    value: str


app = FastAPI()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 23 Column: 1

                      200: {
            "content": {"image/png": {}},
            "description": "Return the JSON item or an image.",
        }
    },
)
async def read_item(item_id: str, img: Optional[bool] = None):
    if img:
        return FileResponse("image.png", media_type="image/png")

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 27 Column: 5

                  },
)
async def read_item(item_id: str, img: Optional[bool] = None):
    if img:
        return FileResponse("image.png", media_type="image/png")
    else:
        return {"id": "foo", "value": "there goes my hero"}

            

Reported by Pylint.

tests/test_tutorial/test_body_updates/test_tutorial001.py
9 issues
Missing module docstring
Error

Line: 1 Column: 1

              from fastapi.testclient import TestClient

from docs_src.body_updates.tutorial001 import app

client = TestClient(app)

openapi_schema = {
    "openapi": "3.0.2",
    "info": {"title": "FastAPI", "version": "0.1.0"},

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 134 Column: 1

              }


def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema



            

Reported by Pylint.

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

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

              
def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema


def test_get():
    response = client.get("/items/baz")

            

Reported by Bandit.

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

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

              def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema


def test_get():
    response = client.get("/items/baz")
    assert response.status_code == 200, response.text

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 140 Column: 1

                  assert response.json() == openapi_schema


def test_get():
    response = client.get("/items/baz")
    assert response.status_code == 200, response.text
    assert response.json() == {
        "name": "Baz",
        "description": None,

            

Reported by Pylint.

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

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

              
def test_get():
    response = client.get("/items/baz")
    assert response.status_code == 200, response.text
    assert response.json() == {
        "name": "Baz",
        "description": None,
        "price": 50.2,
        "tax": 10.5,

            

Reported by Bandit.

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

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

              def test_get():
    response = client.get("/items/baz")
    assert response.status_code == 200, response.text
    assert response.json() == {
        "name": "Baz",
        "description": None,
        "price": 50.2,
        "tax": 10.5,
        "tags": [],

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 152 Column: 1

                  }


def test_put():
    response = client.put(
        "/items/bar", json={"name": "Barz", "price": 3, "description": None}
    )
    assert response.json() == {
        "name": "Barz",

            

Reported by Pylint.

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

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

                  response = client.put(
        "/items/bar", json={"name": "Barz", "price": 3, "description": None}
    )
    assert response.json() == {
        "name": "Barz",
        "description": None,
        "price": 3,
        "tax": 10.5,
        "tags": [],

            

Reported by Bandit.

docs_src/path_operation_advanced_configuration/tutorial007.py
9 issues
Unable to import 'fastapi'
Error

Line: 4 Column: 1

              from typing import List

import yaml
from fastapi import FastAPI, HTTPException, Request
from pydantic import BaseModel, ValidationError

app = FastAPI()



            

Reported by Pylint.

Unable to import 'pydantic'
Error

Line: 5 Column: 1

              
import yaml
from fastapi import FastAPI, HTTPException, Request
from pydantic import BaseModel, ValidationError

app = FastAPI()


class Item(BaseModel):

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 29 Column: 9

                  try:
        data = yaml.safe_load(raw_body)
    except yaml.YAMLError:
        raise HTTPException(status_code=422, detail="Invalid YAML")
    try:
        item = Item.parse_obj(data)
    except ValidationError as e:
        raise HTTPException(status_code=422, detail=e.errors())
    return item

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 33 Column: 9

                  try:
        item = Item.parse_obj(data)
    except ValidationError as e:
        raise HTTPException(status_code=422, detail=e.errors())
    return item

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from typing import List

import yaml
from fastapi import FastAPI, HTTPException, Request
from pydantic import BaseModel, ValidationError

app = FastAPI()



            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 10 Column: 1

              app = FastAPI()


class Item(BaseModel):
    name: str
    tags: List[str]


@app.post(

            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

              app = FastAPI()


class Item(BaseModel):
    name: str
    tags: List[str]


@app.post(

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 1

                      "requestBody": {
            "content": {"application/x-yaml": {"schema": Item.schema()}},
            "required": True,
        },
    },
)
async def create_item(request: Request):
    raw_body = await request.body()
    try:

            

Reported by Pylint.

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

Line: 32 Column: 5

                      raise HTTPException(status_code=422, detail="Invalid YAML")
    try:
        item = Item.parse_obj(data)
    except ValidationError as e:
        raise HTTPException(status_code=422, detail=e.errors())
    return item

            

Reported by Pylint.

tests/test_tutorial/test_body_fields/test_tutorial001.py
8 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import pytest
from fastapi.testclient import TestClient

from docs_src.body_fields.tutorial001 import app

client = TestClient(app)


openapi_schema = {

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import pytest
from fastapi.testclient import TestClient

from docs_src.body_fields.tutorial001 import app

client = TestClient(app)


openapi_schema = {

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 112 Column: 1

              }


def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema



            

Reported by Pylint.

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

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

              
def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema


price_not_greater = {
    "detail": [

            

Reported by Bandit.

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

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

              def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema


price_not_greater = {
    "detail": [
        {

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 164 Column: 1

                          },
        ),
        ("/items/5", {"item": {"name": "Foo", "price": -3.0}}, 422, price_not_greater),
    ],
)
def test(path, body, expected_status, expected_response):
    response = client.put(path, json=body)
    assert response.status_code == expected_status
    assert response.json() == expected_response

            

Reported by Pylint.

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

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

              )
def test(path, body, expected_status, expected_response):
    response = client.put(path, json=body)
    assert response.status_code == expected_status
    assert response.json() == expected_response

            

Reported by Bandit.

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

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

              def test(path, body, expected_status, expected_response):
    response = client.put(path, json=body)
    assert response.status_code == expected_status
    assert response.json() == expected_response

            

Reported by Bandit.

docs_src/custom_request_and_route/tutorial003.py
8 issues
Unable to import 'fastapi'
Error

Line: 4 Column: 1

              import time
from typing import Callable

from fastapi import APIRouter, FastAPI, Request, Response
from fastapi.routing import APIRoute


class TimedRoute(APIRoute):
    def get_route_handler(self) -> Callable:

            

Reported by Pylint.

Unable to import 'fastapi.routing'
Error

Line: 5 Column: 1

              from typing import Callable

from fastapi import APIRouter, FastAPI, Request, Response
from fastapi.routing import APIRoute


class TimedRoute(APIRoute):
    def get_route_handler(self) -> Callable:
        original_route_handler = super().get_route_handler()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import time
from typing import Callable

from fastapi import APIRouter, FastAPI, Request, Response
from fastapi.routing import APIRoute


class TimedRoute(APIRoute):
    def get_route_handler(self) -> Callable:

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 8 Column: 1

              from fastapi.routing import APIRoute


class TimedRoute(APIRoute):
    def get_route_handler(self) -> Callable:
        original_route_handler = super().get_route_handler()

        async def custom_route_handler(request: Request) -> Response:
            before = time.time()

            

Reported by Pylint.

Missing class docstring
Error

Line: 8 Column: 1

              from fastapi.routing import APIRoute


class TimedRoute(APIRoute):
    def get_route_handler(self) -> Callable:
        original_route_handler = super().get_route_handler()

        async def custom_route_handler(request: Request) -> Response:
            before = time.time()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 9 Column: 5

              

class TimedRoute(APIRoute):
    def get_route_handler(self) -> Callable:
        original_route_handler = super().get_route_handler()

        async def custom_route_handler(request: Request) -> Response:
            before = time.time()
            response: Response = await original_route_handler(request)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 30 Column: 1

              

@app.get("/")
async def not_timed():
    return {"message": "Not timed"}


@router.get("/timed")
async def timed():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 35 Column: 1

              

@router.get("/timed")
async def timed():
    return {"message": "It's the time of my life"}


app.include_router(router)

            

Reported by Pylint.

fastapi/security/open_id_connect_url.py
8 issues
Unable to import 'starlette.exceptions'
Error

Line: 5 Column: 1

              
from fastapi.openapi.models import OpenIdConnect as OpenIdConnectModel
from fastapi.security.base import SecurityBase
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.status import HTTP_403_FORBIDDEN


class OpenIdConnect(SecurityBase):

            

Reported by Pylint.

Unable to import 'starlette.requests'
Error

Line: 6 Column: 1

              from fastapi.openapi.models import OpenIdConnect as OpenIdConnectModel
from fastapi.security.base import SecurityBase
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.status import HTTP_403_FORBIDDEN


class OpenIdConnect(SecurityBase):
    def __init__(

            

Reported by Pylint.

Unable to import 'starlette.status'
Error

Line: 7 Column: 1

              from fastapi.security.base import SecurityBase
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.status import HTTP_403_FORBIDDEN


class OpenIdConnect(SecurityBase):
    def __init__(
        self,

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from typing import Optional

from fastapi.openapi.models import OpenIdConnect as OpenIdConnectModel
from fastapi.security.base import SecurityBase
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.status import HTTP_403_FORBIDDEN



            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 10 Column: 1

              from starlette.status import HTTP_403_FORBIDDEN


class OpenIdConnect(SecurityBase):
    def __init__(
        self,
        *,
        openIdConnectUrl: str,
        scheme_name: Optional[str] = None,

            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

              from starlette.status import HTTP_403_FORBIDDEN


class OpenIdConnect(SecurityBase):
    def __init__(
        self,
        *,
        openIdConnectUrl: str,
        scheme_name: Optional[str] = None,

            

Reported by Pylint.

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

Line: 14 Column: 9

                  def __init__(
        self,
        *,
        openIdConnectUrl: str,
        scheme_name: Optional[str] = None,
        description: Optional[str] = None,
        auto_error: bool = True
    ):
        self.model = OpenIdConnectModel(

            

Reported by Pylint.

Unnecessary "else" after "raise"
Error

Line: 28 Column: 13

                  async def __call__(self, request: Request) -> Optional[str]:
        authorization: str = request.headers.get("Authorization")
        if not authorization:
            if self.auto_error:
                raise HTTPException(
                    status_code=HTTP_403_FORBIDDEN, detail="Not authenticated"
                )
            else:
                return None

            

Reported by Pylint.

tests/test_tutorial/test_body_multiple_params/test_tutorial001.py
8 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import pytest
from fastapi.testclient import TestClient

from docs_src.body_multiple_params.tutorial001 import app

client = TestClient(app)

openapi_schema = {
    "openapi": "3.0.2",

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import pytest
from fastapi.testclient import TestClient

from docs_src.body_multiple_params.tutorial001 import app

client = TestClient(app)

openapi_schema = {
    "openapi": "3.0.2",

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 104 Column: 1

              }


def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema



            

Reported by Pylint.

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

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

              
def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema


item_id_not_int = {
    "detail": [

            

Reported by Bandit.

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

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

              def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema


item_id_not_int = {
    "detail": [
        {

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 142 Column: 1

                      ("/items/5?q=bar", None, 200, {"item_id": 5, "q": "bar"}),
        ("/items/5", None, 200, {"item_id": 5}),
        ("/items/foo", None, 422, item_id_not_int),
    ],
)
def test_post_body(path, body, expected_status, expected_response):
    response = client.put(path, json=body)
    assert response.status_code == expected_status
    assert response.json() == expected_response

            

Reported by Pylint.

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

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

              )
def test_post_body(path, body, expected_status, expected_response):
    response = client.put(path, json=body)
    assert response.status_code == expected_status
    assert response.json() == expected_response

            

Reported by Bandit.

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

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

              def test_post_body(path, body, expected_status, expected_response):
    response = client.put(path, json=body)
    assert response.status_code == expected_status
    assert response.json() == expected_response

            

Reported by Bandit.

docs_src/handling_errors/tutorial006.py
8 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI, HTTPException
from fastapi.exception_handlers import (
    http_exception_handler,
    request_validation_exception_handler,
)
from fastapi.exceptions import RequestValidationError
from starlette.exceptions import HTTPException as StarletteHTTPException

app = FastAPI()

            

Reported by Pylint.

Unable to import 'fastapi.exception_handlers'
Error

Line: 2 Column: 1

              from fastapi import FastAPI, HTTPException
from fastapi.exception_handlers import (
    http_exception_handler,
    request_validation_exception_handler,
)
from fastapi.exceptions import RequestValidationError
from starlette.exceptions import HTTPException as StarletteHTTPException

app = FastAPI()

            

Reported by Pylint.

Unable to import 'fastapi.exceptions'
Error

Line: 6 Column: 1

                  http_exception_handler,
    request_validation_exception_handler,
)
from fastapi.exceptions import RequestValidationError
from starlette.exceptions import HTTPException as StarletteHTTPException

app = FastAPI()



            

Reported by Pylint.

Unable to import 'starlette.exceptions'
Error

Line: 7 Column: 1

                  request_validation_exception_handler,
)
from fastapi.exceptions import RequestValidationError
from starlette.exceptions import HTTPException as StarletteHTTPException

app = FastAPI()


@app.exception_handler(StarletteHTTPException)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI, HTTPException
from fastapi.exception_handlers import (
    http_exception_handler,
    request_validation_exception_handler,
)
from fastapi.exceptions import RequestValidationError
from starlette.exceptions import HTTPException as StarletteHTTPException

app = FastAPI()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

              

@app.exception_handler(StarletteHTTPException)
async def custom_http_exception_handler(request, exc):
    print(f"OMG! An HTTP error!: {repr(exc)}")
    return await http_exception_handler(request, exc)


@app.exception_handler(RequestValidationError)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 1

              

@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request, exc):
    print(f"OMG! The client sent invalid data!: {exc}")
    return await request_validation_exception_handler(request, exc)


@app.get("/items/{item_id}")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 25 Column: 1

              

@app.get("/items/{item_id}")
async def read_item(item_id: int):
    if item_id == 3:
        raise HTTPException(status_code=418, detail="Nope! I don't like 3.")
    return {"item_id": item_id}

            

Reported by Pylint.

docs_src/handling_errors/tutorial003.py
8 issues
Unable to import 'fastapi'
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse


class UnicornException(Exception):
    def __init__(self, name: str):
        self.name = name



            

Reported by Pylint.

Unable to import 'fastapi.responses'
Error

Line: 2 Column: 1

              from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse


class UnicornException(Exception):
    def __init__(self, name: str):
        self.name = name



            

Reported by Pylint.

__init__ method from base class 'Exception' is not called
Error

Line: 6 Column: 5

              

class UnicornException(Exception):
    def __init__(self, name: str):
        self.name = name


app = FastAPI()


            

Reported by Pylint.

Unused argument 'request'
Error

Line: 14 Column: 37

              

@app.exception_handler(UnicornException)
async def unicorn_exception_handler(request: Request, exc: UnicornException):
    return JSONResponse(
        status_code=418,
        content={"message": f"Oops! {exc.name} did something. There goes a rainbow..."},
    )


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse


class UnicornException(Exception):
    def __init__(self, name: str):
        self.name = name



            

Reported by Pylint.

Missing class docstring
Error

Line: 5 Column: 1

              from fastapi.responses import JSONResponse


class UnicornException(Exception):
    def __init__(self, name: str):
        self.name = name


app = FastAPI()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 14 Column: 1

              

@app.exception_handler(UnicornException)
async def unicorn_exception_handler(request: Request, exc: UnicornException):
    return JSONResponse(
        status_code=418,
        content={"message": f"Oops! {exc.name} did something. There goes a rainbow..."},
    )


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 22 Column: 1

              

@app.get("/unicorns/{name}")
async def read_unicorn(name: str):
    if name == "yolo":
        raise UnicornException(name=name)
    return {"unicorn_name": name}

            

Reported by Pylint.

docs_src/body_updates/tutorial002.py
8 issues
Unable to import 'fastapi'
Error

Line: 3 Column: 1

              from typing import List, Optional

from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel

app = FastAPI()



            

Reported by Pylint.

Unable to import 'fastapi.encoders'
Error

Line: 4 Column: 1

              from typing import List, Optional

from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel

app = FastAPI()



            

Reported by Pylint.

Unable to import 'pydantic'
Error

Line: 5 Column: 1

              
from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel

app = FastAPI()


class Item(BaseModel):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from typing import List, Optional

from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel

app = FastAPI()



            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

              app = FastAPI()


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

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 10 Column: 1

              app = FastAPI()


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

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 26 Column: 1

              

@app.get("/items/{item_id}", response_model=Item)
async def read_item(item_id: str):
    return items[item_id]


@app.patch("/items/{item_id}", response_model=Item)
async def update_item(item_id: str, item: Item):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 31 Column: 1

              

@app.patch("/items/{item_id}", response_model=Item)
async def update_item(item_id: str, item: Item):
    stored_item_data = items[item_id]
    stored_item_model = Item(**stored_item_data)
    update_data = item.dict(exclude_unset=True)
    updated_item = stored_item_model.copy(update=update_data)
    items[item_id] = jsonable_encoder(updated_item)

            

Reported by Pylint.