The following issues were found
tests/test_include_router_defaults_overrides.py
217 issues
Line: 1
Column: 1
import pytest
from fastapi import APIRouter, Depends, FastAPI, Response
from fastapi.responses import JSONResponse
from fastapi.testclient import TestClient
class ResponseLevel0(JSONResponse):
media_type = "application/x-level-0"
Reported by Pylint.
Line: 59
Column: 21
@callback_router0.get("/")
async def callback0(level0: str):
pass # pragma: nocover
callback_router1 = APIRouter()
Reported by Pylint.
Line: 67
Column: 21
@callback_router1.get("/")
async def callback1(level1: str):
pass # pragma: nocover
callback_router2 = APIRouter()
Reported by Pylint.
Line: 75
Column: 21
@callback_router2.get("/")
async def callback2(level2: str):
pass # pragma: nocover
callback_router3 = APIRouter()
Reported by Pylint.
Line: 83
Column: 21
@callback_router3.get("/")
async def callback3(level3: str):
pass # pragma: nocover
callback_router4 = APIRouter()
Reported by Pylint.
Line: 91
Column: 21
@callback_router4.get("/")
async def callback4(level4: str):
pass # pragma: nocover
callback_router5 = APIRouter()
Reported by Pylint.
Line: 99
Column: 21
@callback_router5.get("/")
async def callback5(level5: str):
pass # pragma: nocover
app = FastAPI(
dependencies=[Depends(dep0)],
Reported by Pylint.
Line: 345
Column: 5
def test_openapi():
client = TestClient(app)
response = client.get("/openapi.json")
assert response.json() == openapi_schema
def test_level1_override():
Reported by Pylint.
Line: 1
Column: 1
import pytest
from fastapi import APIRouter, Depends, FastAPI, Response
from fastapi.responses import JSONResponse
from fastapi.testclient import TestClient
class ResponseLevel0(JSONResponse):
media_type = "application/x-level-0"
Reported by Pylint.
Line: 1
Column: 1
import pytest
from fastapi import APIRouter, Depends, FastAPI, Response
from fastapi.responses import JSONResponse
from fastapi.testclient import TestClient
class ResponseLevel0(JSONResponse):
media_type = "application/x-level-0"
Reported by Pylint.
tests/test_dependency_contextmanager.py
148 issues
Line: 3
Column: 1
from typing import Dict
import pytest
from fastapi import BackgroundTasks, Depends, FastAPI
from fastapi.testclient import TestClient
app = FastAPI()
state = {
"/async": "asyncgen not started",
Reported by Pylint.
Line: 38
Column: 26
pass
async def asyncgen_state(state: Dict[str, str] = Depends(get_state)):
state["/async"] = "asyncgen started"
yield state["/async"]
state["/async"] = "asyncgen completed"
Reported by Pylint.
Line: 44
Column: 21
state["/async"] = "asyncgen completed"
def generator_state(state: Dict[str, str] = Depends(get_state)):
state["/sync"] = "generator started"
yield state["/sync"]
state["/sync"] = "generator completed"
Reported by Pylint.
Line: 50
Column: 30
state["/sync"] = "generator completed"
async def asyncgen_state_try(state: Dict[str, str] = Depends(get_state)):
state["/async_raise"] = "asyncgen raise started"
try:
yield state["/async_raise"]
except AsyncDependencyError:
errors.append("/async_raise")
Reported by Pylint.
Line: 60
Column: 25
state["/async_raise"] = "asyncgen raise finalized"
def generator_state_try(state: Dict[str, str] = Depends(get_state)):
state["/sync_raise"] = "generator raise started"
try:
yield state["/sync_raise"]
except SyncDependencyError:
errors.append("/sync_raise")
Reported by Pylint.
Line: 70
Column: 21
state["/sync_raise"] = "generator raise finalized"
async def context_a(state: dict = Depends(get_state)):
state["context_a"] = "started a"
try:
yield state
finally:
state["context_a"] = "finished a"
Reported by Pylint.
Line: 78
Column: 21
state["context_a"] = "finished a"
async def context_b(state: dict = Depends(context_a)):
state["context_b"] = "started b"
try:
yield state
finally:
state["context_b"] = f"finished b with a: {state['context_a']}"
Reported by Pylint.
Line: 87
Column: 21
@app.get("/async")
async def get_async(state: str = Depends(asyncgen_state)):
return state
@app.get("/sync")
async def get_sync(state: str = Depends(generator_state)):
Reported by Pylint.
Line: 92
Column: 20
@app.get("/sync")
async def get_sync(state: str = Depends(generator_state)):
return state
@app.get("/async_raise")
async def get_async_raise(state: str = Depends(asyncgen_state_try)):
Reported by Pylint.
Line: 97
Column: 27
@app.get("/async_raise")
async def get_async_raise(state: str = Depends(asyncgen_state_try)):
assert state == "asyncgen raise started"
raise AsyncDependencyError()
@app.get("/sync_raise")
Reported by Pylint.
fastapi/openapi/models.py
139 issues
Line: 5
Column: 1
from typing import Any, Callable, Dict, Iterable, List, Optional, Union
from fastapi.logger import logger
from pydantic import AnyUrl, BaseModel, Field
try:
import email_validator # type: ignore
assert email_validator # make autoflake ignore the unused import
Reported by Pylint.
Line: 1
Column: 1
from enum import Enum
from typing import Any, Callable, Dict, Iterable, List, Optional, Union
from fastapi.logger import logger
from pydantic import AnyUrl, BaseModel, Field
try:
import email_validator # type: ignore
Reported by Pylint.
Line: 10
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
try:
import email_validator # type: ignore
assert email_validator # make autoflake ignore the unused import
from pydantic import EmailStr
except ImportError: # pragma: no cover
class EmailStr(str): # type: ignore
@classmethod
Reported by Bandit.
Line: 11
Column: 5
import email_validator # type: ignore
assert email_validator # make autoflake ignore the unused import
from pydantic import EmailStr
except ImportError: # pragma: no cover
class EmailStr(str): # type: ignore
@classmethod
def __get_validators__(cls) -> Iterable[Callable[..., Any]]:
Reported by Pylint.
Line: 14
Column: 5
from pydantic import EmailStr
except ImportError: # pragma: no cover
class EmailStr(str): # type: ignore
@classmethod
def __get_validators__(cls) -> Iterable[Callable[..., Any]]:
yield cls.validate
@classmethod
Reported by Pylint.
Line: 20
Column: 9
yield cls.validate
@classmethod
def validate(cls, v: Any) -> str:
logger.warning(
"email-validator not installed, email fields will be treated as str.\n"
"To install, run: pip install email-validator"
)
return str(v)
Reported by Pylint.
Line: 20
Column: 9
yield cls.validate
@classmethod
def validate(cls, v: Any) -> str:
logger.warning(
"email-validator not installed, email fields will be treated as str.\n"
"To install, run: pip install email-validator"
)
return str(v)
Reported by Pylint.
Line: 28
Column: 1
return str(v)
class Contact(BaseModel):
name: Optional[str] = None
url: Optional[AnyUrl] = None
email: Optional[EmailStr] = None
class Config:
Reported by Pylint.
Line: 28
Column: 1
return str(v)
class Contact(BaseModel):
name: Optional[str] = None
url: Optional[AnyUrl] = None
email: Optional[EmailStr] = None
class Config:
Reported by Pylint.
Line: 33
Column: 5
url: Optional[AnyUrl] = None
email: Optional[EmailStr] = None
class Config:
extra = "allow"
class License(BaseModel):
name: str
Reported by Pylint.
.github/actions/people/app/main.py
114 issues
Line: 9
Column: 1
from pathlib import Path
from typing import Container, DefaultDict, Dict, List, Optional, Set
import httpx
import yaml
from github import Github
from pydantic import BaseModel, BaseSettings, SecretStr
github_graphql_url = "https://api.github.com/graphql"
Reported by Pylint.
Line: 11
Column: 1
import httpx
import yaml
from github import Github
from pydantic import BaseModel, BaseSettings, SecretStr
github_graphql_url = "https://api.github.com/graphql"
issues_query = """
Reported by Pylint.
Line: 12
Column: 1
import httpx
import yaml
from github import Github
from pydantic import BaseModel, BaseSettings, SecretStr
github_graphql_url = "https://api.github.com/graphql"
issues_query = """
query Q($after: String) {
Reported by Pylint.
Line: 266
Column: 8
def get_graphql_response(
*, settings: Settings, query: str, after: Optional[str] = None
):
headers = {"Authorization": f"token {settings.input_token.get_secret_value()}"}
variables = {"after": after}
response = httpx.post(
github_graphql_url,
Reported by Pylint.
Line: 276
Column: 9
json={"query": query, "variables": variables, "operationName": "Q"},
)
if not response.status_code == 200:
logging.error(f"Response was not 200, after: {after}")
logging.error(response.text)
raise RuntimeError(response.text)
data = response.json()
return data
Reported by Pylint.
Line: 283
Column: 32
return data
def get_graphql_issue_edges(*, settings: Settings, after: Optional[str] = None):
data = get_graphql_response(settings=settings, query=issues_query, after=after)
graphql_response = IssuesResponse.parse_obj(data)
return graphql_response.data.repository.issues.edges
Reported by Pylint.
Line: 289
Column: 29
return graphql_response.data.repository.issues.edges
def get_graphql_pr_edges(*, settings: Settings, after: Optional[str] = None):
data = get_graphql_response(settings=settings, query=prs_query, after=after)
graphql_response = PRsResponse.parse_obj(data)
return graphql_response.data.repository.pullRequests.edges
Reported by Pylint.
Line: 295
Column: 34
return graphql_response.data.repository.pullRequests.edges
def get_graphql_sponsor_edges(*, settings: Settings, after: Optional[str] = None):
data = get_graphql_response(settings=settings, query=sponsors_query, after=after)
graphql_response = SponsorsResponse.parse_obj(data)
return graphql_response.data.user.sponsorshipsAsMaintainer.edges
Reported by Pylint.
Line: 301
Column: 17
return graphql_response.data.user.sponsorshipsAsMaintainer.edges
def get_experts(settings: Settings):
issue_nodes: List[IssuesNode] = []
issue_edges = get_graphql_issue_edges(settings=settings)
while issue_edges:
for edge in issue_edges:
Reported by Pylint.
Line: 313
Column: 5
commentors = Counter()
last_month_commentors = Counter()
authors: Dict[str, Author] = {}
now = datetime.now(tz=timezone.utc)
one_month_ago = now - timedelta(days=30)
for issue in issue_nodes:
Reported by Pylint.
fastapi/routing.py
99 issues
Line: 39
Column: 1
generate_operation_id_for_path,
get_value_or_default,
)
from pydantic import BaseModel
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from pydantic.fields import ModelField, Undefined
from starlette import routing
from starlette.concurrency import run_in_threadpool
from starlette.exceptions import HTTPException
Reported by Pylint.
Line: 40
Column: 1
get_value_or_default,
)
from pydantic import BaseModel
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from pydantic.fields import ModelField, Undefined
from starlette import routing
from starlette.concurrency import run_in_threadpool
from starlette.exceptions import HTTPException
from starlette.requests import Request
Reported by Pylint.
Line: 41
Column: 1
)
from pydantic import BaseModel
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from pydantic.fields import ModelField, Undefined
from starlette import routing
from starlette.concurrency import run_in_threadpool
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
Reported by Pylint.
Line: 42
Column: 1
from pydantic import BaseModel
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from pydantic.fields import ModelField, Undefined
from starlette import routing
from starlette.concurrency import run_in_threadpool
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
from starlette.routing import BaseRoute
Reported by Pylint.
Line: 43
Column: 1
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from pydantic.fields import ModelField, Undefined
from starlette import routing
from starlette.concurrency import run_in_threadpool
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
from starlette.routing import BaseRoute
from starlette.routing import Mount as Mount # noqa
Reported by Pylint.
Line: 44
Column: 1
from pydantic.fields import ModelField, Undefined
from starlette import routing
from starlette.concurrency import run_in_threadpool
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
from starlette.routing import BaseRoute
from starlette.routing import Mount as Mount # noqa
from starlette.routing import (
Reported by Pylint.
Line: 45
Column: 1
from starlette import routing
from starlette.concurrency import run_in_threadpool
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
from starlette.routing import BaseRoute
from starlette.routing import Mount as Mount # noqa
from starlette.routing import (
compile_path,
Reported by Pylint.
Line: 46
Column: 1
from starlette.concurrency import run_in_threadpool
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
from starlette.routing import BaseRoute
from starlette.routing import Mount as Mount # noqa
from starlette.routing import (
compile_path,
get_name,
Reported by Pylint.
Line: 47
Column: 1
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
from starlette.routing import BaseRoute
from starlette.routing import Mount as Mount # noqa
from starlette.routing import (
compile_path,
get_name,
request_response,
Reported by Pylint.
Line: 48
Column: 1
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
from starlette.routing import BaseRoute
from starlette.routing import Mount as Mount # noqa
from starlette.routing import (
compile_path,
get_name,
request_response,
websocket_session,
Reported by Pylint.
tests/test_tutorial/test_security/test_tutorial005.py
71 issues
Line: 1
Column: 1
from fastapi.testclient import TestClient
from docs_src.security.tutorial005 import (
app,
create_access_token,
fake_users_db,
get_password_hash,
verify_password,
)
Reported by Pylint.
Line: 45
Column: 1
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "#/components/schemas/Body_login_for_access_token_token_post"
}
}
},
"required": True,
},
Reported by Pylint.
Line: 180
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.
Line: 182
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 get_access_token(username="johndoe", password="secret", scope=None):
data = {"username": username, "password": password}
Reported by Bandit.
Line: 183
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 get_access_token(username="johndoe", password="secret", scope=None):
data = {"username": username, "password": password}
if scope:
Reported by Bandit.
Line: 186
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b107_hardcoded_password_default.html
assert response.json() == openapi_schema
def get_access_token(username="johndoe", password="secret", scope=None):
data = {"username": username, "password": password}
if scope:
data["scope"] = scope
response = client.post("/token", data=data)
content = response.json()
Reported by Bandit.
Line: 186
Column: 1
assert response.json() == openapi_schema
def get_access_token(username="johndoe", password="secret", scope=None):
data = {"username": username, "password": password}
if scope:
data["scope"] = scope
response = client.post("/token", data=data)
content = response.json()
Reported by Pylint.
Line: 196
Column: 1
return access_token
def test_login():
response = client.post("/token", data={"username": "johndoe", "password": "secret"})
assert response.status_code == 200, response.text
content = response.json()
assert "access_token" in content
assert content["token_type"] == "bearer"
Reported by Pylint.
Line: 198
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_login():
response = client.post("/token", data={"username": "johndoe", "password": "secret"})
assert response.status_code == 200, response.text
content = response.json()
assert "access_token" in content
assert content["token_type"] == "bearer"
Reported by Bandit.
Line: 200
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
response = client.post("/token", data={"username": "johndoe", "password": "secret"})
assert response.status_code == 200, response.text
content = response.json()
assert "access_token" in content
assert content["token_type"] == "bearer"
def test_login_incorrect_password():
response = client.post(
Reported by Bandit.
tests/test_jsonable_encoder.py
69 issues
Line: 6
Column: 1
from pathlib import PurePath, PurePosixPath, PureWindowsPath
from typing import Optional
import pytest
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel, Field, ValidationError, create_model
class Person:
Reported by Pylint.
Line: 8
Column: 1
import pytest
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel, Field, ValidationError, create_model
class Person:
def __init__(self, name: str):
self.name = name
Reported by Pylint.
Line: 1
Column: 1
from datetime import datetime, timezone
from enum import Enum
from pathlib import PurePath, PurePosixPath, PureWindowsPath
from typing import Optional
import pytest
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel, Field, ValidationError, create_model
Reported by Pylint.
Line: 11
Column: 1
from pydantic import BaseModel, Field, ValidationError, create_model
class Person:
def __init__(self, name: str):
self.name = name
class Pet:
Reported by Pylint.
Line: 11
Column: 1
from pydantic import BaseModel, Field, ValidationError, create_model
class Person:
def __init__(self, name: str):
self.name = name
class Pet:
Reported by Pylint.
Line: 16
Column: 1
self.name = name
class Pet:
def __init__(self, owner: Person, name: str):
self.owner = owner
self.name = name
Reported by Pylint.
Line: 16
Column: 1
self.name = name
class Pet:
def __init__(self, owner: Person, name: str):
self.owner = owner
self.name = name
Reported by Pylint.
Line: 22
Column: 1
self.name = name
class DictablePerson(Person):
def __iter__(self):
return ((k, v) for k, v in self.__dict__.items())
class DictablePet(Pet):
Reported by Pylint.
Line: 22
Column: 1
self.name = name
class DictablePerson(Person):
def __iter__(self):
return ((k, v) for k, v in self.__dict__.items())
class DictablePet(Pet):
Reported by Pylint.
Line: 27
Column: 1
return ((k, v) for k, v in self.__dict__.items())
class DictablePet(Pet):
def __iter__(self):
return ((k, v) for k, v in self.__dict__.items())
class Unserializable:
Reported by Pylint.
fastapi/dependencies/utils.py
69 issues
Line: 33
Column: 1
from fastapi.security.oauth2 import OAuth2, SecurityScopes
from fastapi.security.open_id_connect_url import OpenIdConnect
from fastapi.utils import create_response_field, get_path_param_names
from pydantic import BaseModel, create_model
from pydantic.error_wrappers import ErrorWrapper
from pydantic.errors import MissingError
from pydantic.fields import (
SHAPE_LIST,
SHAPE_SEQUENCE,
Reported by Pylint.
Line: 34
Column: 1
from fastapi.security.open_id_connect_url import OpenIdConnect
from fastapi.utils import create_response_field, get_path_param_names
from pydantic import BaseModel, create_model
from pydantic.error_wrappers import ErrorWrapper
from pydantic.errors import MissingError
from pydantic.fields import (
SHAPE_LIST,
SHAPE_SEQUENCE,
SHAPE_SET,
Reported by Pylint.
Line: 35
Column: 1
from fastapi.utils import create_response_field, get_path_param_names
from pydantic import BaseModel, create_model
from pydantic.error_wrappers import ErrorWrapper
from pydantic.errors import MissingError
from pydantic.fields import (
SHAPE_LIST,
SHAPE_SEQUENCE,
SHAPE_SET,
SHAPE_SINGLETON,
Reported by Pylint.
Line: 36
Column: 1
from pydantic import BaseModel, create_model
from pydantic.error_wrappers import ErrorWrapper
from pydantic.errors import MissingError
from pydantic.fields import (
SHAPE_LIST,
SHAPE_SEQUENCE,
SHAPE_SET,
SHAPE_SINGLETON,
SHAPE_TUPLE,
Reported by Pylint.
Line: 47
Column: 1
ModelField,
Required,
)
from pydantic.schema import get_annotation_from_field_info
from pydantic.typing import ForwardRef, evaluate_forwardref
from pydantic.utils import lenient_issubclass
from starlette.background import BackgroundTasks
from starlette.concurrency import run_in_threadpool
from starlette.datastructures import FormData, Headers, QueryParams, UploadFile
Reported by Pylint.
Line: 48
Column: 1
Required,
)
from pydantic.schema import get_annotation_from_field_info
from pydantic.typing import ForwardRef, evaluate_forwardref
from pydantic.utils import lenient_issubclass
from starlette.background import BackgroundTasks
from starlette.concurrency import run_in_threadpool
from starlette.datastructures import FormData, Headers, QueryParams, UploadFile
from starlette.requests import HTTPConnection, Request
Reported by Pylint.
Line: 49
Column: 1
)
from pydantic.schema import get_annotation_from_field_info
from pydantic.typing import ForwardRef, evaluate_forwardref
from pydantic.utils import lenient_issubclass
from starlette.background import BackgroundTasks
from starlette.concurrency import run_in_threadpool
from starlette.datastructures import FormData, Headers, QueryParams, UploadFile
from starlette.requests import HTTPConnection, Request
from starlette.responses import Response
Reported by Pylint.
Line: 50
Column: 1
from pydantic.schema import get_annotation_from_field_info
from pydantic.typing import ForwardRef, evaluate_forwardref
from pydantic.utils import lenient_issubclass
from starlette.background import BackgroundTasks
from starlette.concurrency import run_in_threadpool
from starlette.datastructures import FormData, Headers, QueryParams, UploadFile
from starlette.requests import HTTPConnection, Request
from starlette.responses import Response
from starlette.websockets import WebSocket
Reported by Pylint.
Line: 51
Column: 1
from pydantic.typing import ForwardRef, evaluate_forwardref
from pydantic.utils import lenient_issubclass
from starlette.background import BackgroundTasks
from starlette.concurrency import run_in_threadpool
from starlette.datastructures import FormData, Headers, QueryParams, UploadFile
from starlette.requests import HTTPConnection, Request
from starlette.responses import Response
from starlette.websockets import WebSocket
Reported by Pylint.
Line: 52
Column: 1
from pydantic.utils import lenient_issubclass
from starlette.background import BackgroundTasks
from starlette.concurrency import run_in_threadpool
from starlette.datastructures import FormData, Headers, QueryParams, UploadFile
from starlette.requests import HTTPConnection, Request
from starlette.responses import Response
from starlette.websockets import WebSocket
sequence_shapes = {
Reported by Pylint.
fastapi/params.py
69 issues
Line: 4
Column: 1
from enum import Enum
from typing import Any, Callable, Dict, Optional, Sequence
from pydantic.fields import FieldInfo, Undefined
class ParamTypes(Enum):
query = "query"
header = "header"
Reported by Pylint.
Line: 103
Column: 5
class Query(Param):
in_ = ParamTypes.query
def __init__(
self,
default: Any,
*,
alias: Optional[str] = None,
title: Optional[str] = None,
Reported by Pylint.
Line: 187
Column: 5
class Cookie(Param):
in_ = ParamTypes.cookie
def __init__(
self,
default: Any,
*,
alias: Optional[str] = None,
title: Optional[str] = None,
Reported by Pylint.
Line: 1
Column: 1
from enum import Enum
from typing import Any, Callable, Dict, Optional, Sequence
from pydantic.fields import FieldInfo, Undefined
class ParamTypes(Enum):
query = "query"
header = "header"
Reported by Pylint.
Line: 7
Column: 1
from pydantic.fields import FieldInfo, Undefined
class ParamTypes(Enum):
query = "query"
header = "header"
path = "path"
cookie = "cookie"
Reported by Pylint.
Line: 8
Column: 5
class ParamTypes(Enum):
query = "query"
header = "header"
path = "path"
cookie = "cookie"
Reported by Pylint.
Line: 9
Column: 5
class ParamTypes(Enum):
query = "query"
header = "header"
path = "path"
cookie = "cookie"
class Param(FieldInfo):
Reported by Pylint.
Line: 10
Column: 5
class ParamTypes(Enum):
query = "query"
header = "header"
path = "path"
cookie = "cookie"
class Param(FieldInfo):
in_: ParamTypes
Reported by Pylint.
Line: 11
Column: 5
query = "query"
header = "header"
path = "path"
cookie = "cookie"
class Param(FieldInfo):
in_: ParamTypes
Reported by Pylint.
Line: 14
Column: 1
cookie = "cookie"
class Param(FieldInfo):
in_: ParamTypes
def __init__(
self,
default: Any,
Reported by Pylint.
tests/test_default_response_class.py
68 issues
Line: 3
Column: 1
from typing import Any
import orjson
from fastapi import APIRouter, FastAPI
from fastapi.responses import HTMLResponse, JSONResponse, PlainTextResponse
from fastapi.testclient import TestClient
class ORJSONResponse(JSONResponse):
Reported by Pylint.
Line: 1
Column: 1
from typing import Any
import orjson
from fastapi import APIRouter, FastAPI
from fastapi.responses import HTMLResponse, JSONResponse, PlainTextResponse
from fastapi.testclient import TestClient
class ORJSONResponse(JSONResponse):
Reported by Pylint.
Line: 9
Column: 1
from fastapi.testclient import TestClient
class ORJSONResponse(JSONResponse):
media_type = "application/x-orjson"
def render(self, content: Any) -> bytes:
return orjson.dumps(content)
Reported by Pylint.
Line: 9
Column: 1
from fastapi.testclient import TestClient
class ORJSONResponse(JSONResponse):
media_type = "application/x-orjson"
def render(self, content: Any) -> bytes:
return orjson.dumps(content)
Reported by Pylint.
Line: 12
Column: 5
class ORJSONResponse(JSONResponse):
media_type = "application/x-orjson"
def render(self, content: Any) -> bytes:
return orjson.dumps(content)
class OverrideResponse(JSONResponse):
media_type = "application/x-override"
Reported by Pylint.
Line: 12
Column: 5
class ORJSONResponse(JSONResponse):
media_type = "application/x-orjson"
def render(self, content: Any) -> bytes:
return orjson.dumps(content)
class OverrideResponse(JSONResponse):
media_type = "application/x-override"
Reported by Pylint.
Line: 16
Column: 1
return orjson.dumps(content)
class OverrideResponse(JSONResponse):
media_type = "application/x-override"
app = FastAPI(default_response_class=ORJSONResponse)
router_a = APIRouter()
Reported by Pylint.
Line: 16
Column: 1
return orjson.dumps(content)
class OverrideResponse(JSONResponse):
media_type = "application/x-override"
app = FastAPI(default_response_class=ORJSONResponse)
router_a = APIRouter()
Reported by Pylint.
Line: 30
Column: 1
@app.get("/")
def get_root():
return {"msg": "Hello World"}
@app.get("/override", response_class=PlainTextResponse)
def get_path_override():
Reported by Pylint.
Line: 35
Column: 1
@app.get("/override", response_class=PlainTextResponse)
def get_path_override():
return "Hello World"
@router_a.get("/")
def get_a():
Reported by Pylint.