index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
25,843 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/cookie_params/tutorial001.py | 8,10 | 1,11 | read_items | 10,11 | 10,11 | from typing import Union
from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Union[str, None] = Cookie(default=None)):
FILL_FUNC_BODY | from typing import Union
from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Union[str, None] = Cookie(default=None)):
FILL_FUNC_BODY | return {"ads_id": ads_id}
| return {"ads_id": ads_id}
| 3 | 70 | 13 | 83 | from typing import Union
from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Union[str, None] = Cookie(default=None)):
FILL_FUNC_BODY | from typing import Union
from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Union[str, None] = Cookie(default=None)):
FILL_FUNC_BODY | |
25,844 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/cookie_params/tutorial001_an.py | 9,11 | 1,12 | read_items | 11,12 | 11,12 | from typing import Union
from fastapi import Cookie, FastAPI
from typing_extensions import Annotated
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Annotated[Union[str, None], Cookie()] = None):
FILL_FUNC_BODY | from typing import Union
from fastapi import Cookie, FastAPI
from typing_extensions import Annotated
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Annotated[Union[str, None], Cookie()] = None):
FILL_FUNC_BODY | return {"ads_id": ads_id}
| return {"ads_id": ads_id}
| 3 | 82 | 13 | 95 | from typing import Union
from fastapi import Cookie, FastAPI
from typing_extensions import Annotated
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Annotated[Union[str, None], Cookie()] = None):
FILL_FUNC_BODY | from typing import Union
from fastapi import Cookie, FastAPI
from typing_extensions import Annotated
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Annotated[Union[str, None], Cookie()] = None):
FILL_FUNC_BODY | |
25,845 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/cookie_params/tutorial001_an_py310.py | 8,10 | 1,11 | read_items | 10,11 | 10,11 | from typing import Annotated
from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Annotated[str | None, Cookie()] = None):
FILL_FUNC_BODY | from typing import Annotated
from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Annotated[str | None, Cookie()] = None):
FILL_FUNC_BODY | return {"ads_id": ads_id}
| return {"ads_id": ads_id}
| 3 | 72 | 13 | 85 | from typing import Annotated
from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Annotated[str | None, Cookie()] = None):
FILL_FUNC_BODY | from typing import Annotated
from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Annotated[str | None, Cookie()] = None):
FILL_FUNC_BODY | |
25,846 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/cookie_params/tutorial001_an_py39.py | 8,10 | 1,11 | read_items | 10,11 | 10,11 | from typing import Annotated, Union
from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Annotated[Union[str, None], Cookie()] = None):
FILL_FUNC_BODY | from typing import Annotated, Union
from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Annotated[Union[str, None], Cookie()] = None):
FILL_FUNC_BODY | return {"ads_id": ads_id}
| return {"ads_id": ads_id}
| 3 | 77 | 13 | 90 | from typing import Annotated, Union
from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Annotated[Union[str, None], Cookie()] = None):
FILL_FUNC_BODY | from typing import Annotated, Union
from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: Annotated[Union[str, None], Cookie()] = None):
FILL_FUNC_BODY | |
25,847 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/cookie_params/tutorial001_py310.py | 6,8 | 1,9 | read_items | 8,9 | 8,9 | from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: str | None = Cookie(default=None)):
FILL_FUNC_BODY | from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: str | None = Cookie(default=None)):
FILL_FUNC_BODY | return {"ads_id": ads_id}
| return {"ads_id": ads_id}
| 3 | 61 | 13 | 74 | from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: str | None = Cookie(default=None)):
FILL_FUNC_BODY | from fastapi import Cookie, FastAPI
app = FastAPI()
@app.get("/items/")
async def read_items(ads_id: str | None = Cookie(default=None)):
FILL_FUNC_BODY | |
25,848 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/cors/tutorial001.py | 22,24 | 1,25 | main | 24,25 | 24,25 | from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
origins = [
"http://localhost.tiangolo.com",
"https://localhost.tiangolo.com",
"http://localhost",
"http://localhost:8080",
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_cre... | from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
origins = [
"http://localhost.tiangolo.com",
"https://localhost.tiangolo.com",
"http://localhost",
"http://localhost:8080",
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_cre... | return {"message": "Hello World"}
| return {"message": "Hello World"}
| 4 | 163 | 11 | 174 | from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
origins = [
"http://localhost.tiangolo.com",
"https://localhost.tiangolo.com",
"http://localhost",
"http://localhost:8080",
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_cre... | from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
origins = [
"http://localhost.tiangolo.com",
"https://localhost.tiangolo.com",
"http://localhost",
"http://localhost:8080",
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_cre... | |
25,849 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_docs_ui/tutorial001.py | 11,13 | 1,39 | custom_swagger_ui_html | 13,22 | 13,22 | from fastapi import FastAPI
from fastapi.openapi.docs import (
get_redoc_html,
get_swagger_ui_html,
get_swagger_ui_oauth2_redirect_html,
)
app = FastAPI(docs_url=None, redoc_url=None)
@app.get("/docs", include_in_schema=False)
async def custom_swagger_ui_html():
FILL_FUNC_BODY@app.get(app.swagger_ui_oaut... | from fastapi import FastAPI
from fastapi.openapi.docs import (
get_redoc_html,
get_swagger_ui_html,
get_swagger_ui_oauth2_redirect_html,
)
app = FastAPI(docs_url=None, redoc_url=None)
@app.get("/docs", include_in_schema=False)
async def custom_swagger_ui_html():
FILL_FUNC_BODY@app.get(app.swagger_ui_oaut... | return get_swagger_ui_html(
openapi_url=app.openapi_url,
title=app.title + " - Swagger UI",
oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url,
swagger_js_url="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-bundle.js",
swagger_css_url="https://unpkg.com/swagger-ui-dis... | return get_swagger_ui_html(
openapi_url=app.openapi_url,
title=app.title + " - Swagger UI",
oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url,
swagger_js_url="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-bundle.js",
swagger_css_url="https://unpkg.com/swagger-ui-dis... | 13 | 316 | 157 | 473 | from fastapi import FastAPI
from fastapi.openapi.docs import (
get_redoc_html,
get_swagger_ui_html,
get_swagger_ui_oauth2_redirect_html,
)
app = FastAPI(docs_url=None, redoc_url=None)
@app.get("/docs", include_in_schema=False)
async def custom_swagger_ui_html():
FILL_FUNC_BODY@app.get(app.swagger_ui_oaut... | from fastapi import FastAPI
from fastapi.openapi.docs import (
get_redoc_html,
get_swagger_ui_html,
get_swagger_ui_oauth2_redirect_html,
)
app = FastAPI(docs_url=None, redoc_url=None)
@app.get("/docs", include_in_schema=False)
async def custom_swagger_ui_html():
FILL_FUNC_BODY@app.get(app.swagger_ui_oaut... | |
25,850 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_docs_ui/tutorial002.py | 30,32 | 1,42 | redoc_html | 32,39 | 32,39 | from fastapi import FastAPI
from fastapi.openapi.docs import (
get_redoc_html,
get_swagger_ui_html,
get_swagger_ui_oauth2_redirect_html,
)
from fastapi.staticfiles import StaticFiles
app = FastAPI(docs_url=None, redoc_url=None)
app.mount("/static", StaticFiles(directory="static"), name="static")
@app.ge... | from fastapi import FastAPI
from fastapi.openapi.docs import (
get_redoc_html,
get_swagger_ui_html,
get_swagger_ui_oauth2_redirect_html,
)
from fastapi.staticfiles import StaticFiles
app = FastAPI(docs_url=None, redoc_url=None)
app.mount("/static", StaticFiles(directory="static"), name="static")
@app.ge... | return get_redoc_html(
openapi_url=app.openapi_url,
title=app.title + " - ReDoc",
redoc_js_url="/static/redoc.standalone.js",
)
| return get_redoc_html(
openapi_url=app.openapi_url,
title=app.title + " - ReDoc",
redoc_js_url="/static/redoc.standalone.js",
)
| 10 | 385 | 69 | 454 | from fastapi import FastAPI
from fastapi.openapi.docs import (
get_redoc_html,
get_swagger_ui_html,
get_swagger_ui_oauth2_redirect_html,
)
from fastapi.staticfiles import StaticFiles
app = FastAPI(docs_url=None, redoc_url=None)
app.mount("/static", StaticFiles(directory="static"), name="static")
@app.ge... | from fastapi import FastAPI
from fastapi.openapi.docs import (
get_redoc_html,
get_swagger_ui_html,
get_swagger_ui_oauth2_redirect_html,
)
from fastapi.staticfiles import StaticFiles
app = FastAPI(docs_url=None, redoc_url=None)
app.mount("/static", StaticFiles(directory="static"), name="static")
@app.ge... | |
25,851 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_request_and_route/tutorial001.py | 33,35 | 1,36 | sum_numbers | 35,36 | 35,36 | import gzip
from typing import Callable, List
from fastapi import Body, FastAPI, Request, Response
from fastapi.routing import APIRoute
class GzipRequest(Request):
async def body(self) -> bytes:
if not hasattr(self, "_body"):
body = await super().body()
if "gzip" in self.headers.g... | import gzip
from typing import Callable, List
from fastapi import Body, FastAPI, Request, Response
from fastapi.routing import APIRoute
class GzipRequest(Request):
async def body(self) -> bytes:
if not hasattr(self, "_body"):
body = await super().body()
if "gzip" in self.headers.g... | return {"sum": sum(numbers)}
| return {"sum": sum(numbers)}
| 3 | 286 | 12 | 298 | import gzip
from typing import Callable, List
from fastapi import Body, FastAPI, Request, Response
from fastapi.routing import APIRoute
class GzipRequest(Request):
async def body(self) -> bytes:
if not hasattr(self, "_body"):
body = await super().body()
if "gzip" in self.headers.g... | import gzip
from typing import Callable, List
from fastapi import Body, FastAPI, Request, Response
from fastapi.routing import APIRoute
class GzipRequest(Request):
async def body(self) -> bytes:
if not hasattr(self, "_body"):
body = await super().body()
if "gzip" in self.headers.g... | |
25,852 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_request_and_route/tutorial001.py | 9,10 | 8,18 | body | GzipRequest | 10,18 | 10,18 | class GzipRequest(Request):
async def body(self) -> bytes:
FILL_FUNC_BODY | class GzipRequest(Request):
async def body(self) -> bytes:
FILL_FUNC_BODY | if not hasattr(self, "_body"):
body = await super().body()
if "gzip" in self.headers.getlist("Content-Encoding"):
body = gzip.decompress(body)
self._body = body
return self._body
| if not hasattr(self, "_body"):
body = await super().body()
if "gzip" in self.headers.getlist("Content-Encoding"):
body = gzip.decompress(body)
self._body = body
return self._body
| 20 | 30 | 78 | 108 | import gzip
from typing import Callable, List
from fastapi import Body, FastAPI, Request, Response
from fastapi.routing import APIRoute
class GzipRequest(Request):
async def body(self) -> bytes:
FILL_FUNC_BODYclass GzipRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler =... | import gzip
from typing import Callable, List
from fastapi import Body, FastAPI, Request, Response
from fastapi.routing import APIRoute
class GzipRequest(Request):
async def body(self) -> bytes:
FILL_FUNC_BODYclass GzipRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler =... |
25,853 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_request_and_route/tutorial001.py | 22,23 | 18,29 | custom_route_handler | GzipRoute | 23,26 | 23,26 | class GzipRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request: Request) -> Response:
FILL_FUNC_BODY return custom_route_handler
| class GzipRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request: Request) -> Response:
FILL_FUNC_BODY return custom_route_handler
| request = GzipRequest(request.scope, request.receive)
return await original_route_handler(request)
| request = GzipRequest(request.scope, request.receive)
return await original_route_handler(request)
| 7 | 81 | 33 | 114 | import gzip
from typing import Callable, List
from fastapi import Body, FastAPI, Request, Response
from fastapi.routing import APIRoute
class GzipRequest(Request):
async def body(self) -> bytes:
if not hasattr(self, "_body"):
body = await super().body()
if "gzip" in self.headers.g... | import gzip
from typing import Callable, List
from fastapi import Body, FastAPI, Request, Response
from fastapi.routing import APIRoute
class GzipRequest(Request):
async def body(self) -> bytes:
if not hasattr(self, "_body"):
body = await super().body()
if "gzip" in self.headers.g... |
25,854 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_request_and_route/tutorial002.py | 27,29 | 1,30 | sum_numbers | 29,30 | 29,30 | from typing import Callable, List
from fastapi import Body, FastAPI, HTTPException, Request, Response
from fastapi.exceptions import RequestValidationError
from fastapi.routing import APIRoute
class ValidationErrorLoggingRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = s... | from typing import Callable, List
from fastapi import Body, FastAPI, HTTPException, Request, Response
from fastapi.exceptions import RequestValidationError
from fastapi.routing import APIRoute
class ValidationErrorLoggingRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = s... | return sum(numbers)
| return sum(numbers)
| 2 | 253 | 9 | 262 | from typing import Callable, List
from fastapi import Body, FastAPI, HTTPException, Request, Response
from fastapi.exceptions import RequestValidationError
from fastapi.routing import APIRoute
class ValidationErrorLoggingRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = s... | from typing import Callable, List
from fastapi import Body, FastAPI, HTTPException, Request, Response
from fastapi.exceptions import RequestValidationError
from fastapi.routing import APIRoute
class ValidationErrorLoggingRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = s... | |
25,855 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_request_and_route/tutorial002.py | 12,13 | 8,23 | custom_route_handler | ValidationErrorLoggingRoute | 13,20 | 13,20 | class ValidationErrorLoggingRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request: Request) -> Response:
FILL_FUNC_BODY return custom_route_handler
| class ValidationErrorLoggingRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request: Request) -> Response:
FILL_FUNC_BODY return custom_route_handler
| try:
return await original_route_handler(request)
except RequestValidationError as exc:
body = await request.body()
detail = {"errors": exc.errors(), "body": body.decode()}
raise HTTPException(status_code=422, detail=detail)
| try:
return await original_route_handler(request)
except RequestValidationError as exc:
body = await request.body()
detail = {"errors": exc.errors(), "body": body.decode()}
raise HTTPException(status_code=422, detail=detail)
| 21 | 84 | 79 | 163 | from typing import Callable, List
from fastapi import Body, FastAPI, HTTPException, Request, Response
from fastapi.exceptions import RequestValidationError
from fastapi.routing import APIRoute
class ValidationErrorLoggingRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = s... | from typing import Callable, List
from fastapi import Body, FastAPI, HTTPException, Request, Response
from fastapi.exceptions import RequestValidationError
from fastapi.routing import APIRoute
class ValidationErrorLoggingRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = s... |
25,856 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_request_and_route/tutorial003.py | 29,31 | 1,40 | not_timed | 31,34 | 31,34 | 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:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request:... | 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:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request:... | return {"message": "Not timed"}
| return {"message": "Not timed"}
| 4 | 295 | 16 | 311 | 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:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request:... | 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:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request:... | |
25,857 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_request_and_route/tutorial003.py | 12,13 | 8,25 | custom_route_handler | TimedRoute | 13,22 | 13,22 | class TimedRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request: Request) -> Response:
FILL_FUNC_BODY return custom_route_handler
| class TimedRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request: Request) -> Response:
FILL_FUNC_BODY return custom_route_handler
| before = time.time()
response: Response = await original_route_handler(request)
duration = time.time() - before
response.headers["X-Response-Time"] = str(duration)
print(f"route duration: {duration}")
print(f"route response: {response}")
... | before = time.time()
response: Response = await original_route_handler(request)
duration = time.time() - before
response.headers["X-Response-Time"] = str(duration)
print(f"route duration: {duration}")
print(f"route response: {response}")
... | 28 | 81 | 106 | 187 | 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:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request:... | 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:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request:... |
25,858 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial001.py | 7,9 | 1,10 | read_items | 9,10 | 9,10 | from fastapi import FastAPI
from fastapi.responses import UJSONResponse
app = FastAPI()
@app.get("/items/", response_class=UJSONResponse)
async def read_items():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import UJSONResponse
app = FastAPI()
@app.get("/items/", response_class=UJSONResponse)
async def read_items():
FILL_FUNC_BODY | return [{"item_id": "Foo"}]
| return [{"item_id": "Foo"}]
| 3 | 61 | 15 | 76 | from fastapi import FastAPI
from fastapi.responses import UJSONResponse
app = FastAPI()
@app.get("/items/", response_class=UJSONResponse)
async def read_items():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import UJSONResponse
app = FastAPI()
@app.get("/items/", response_class=UJSONResponse)
async def read_items():
FILL_FUNC_BODY | |
25,859 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial001b.py | 7,9 | 1,10 | read_items | 9,10 | 9,10 | from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
app = FastAPI()
@app.get("/items/", response_class=ORJSONResponse)
async def read_items():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
app = FastAPI()
@app.get("/items/", response_class=ORJSONResponse)
async def read_items():
FILL_FUNC_BODY | return ORJSONResponse([{"item_id": "Foo"}])
| return ORJSONResponse([{"item_id": "Foo"}])
| 3 | 61 | 18 | 79 | from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
app = FastAPI()
@app.get("/items/", response_class=ORJSONResponse)
async def read_items():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
app = FastAPI()
@app.get("/items/", response_class=ORJSONResponse)
async def read_items():
FILL_FUNC_BODY | |
25,860 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial002.py | 7,9 | 1,19 | read_items | 9,19 | 9,19 | from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
@app.get("/items/", response_class=HTMLResponse)
async def read_items():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
@app.get("/items/", response_class=HTMLResponse)
async def read_items():
FILL_FUNC_BODY | return """
<html>
<head>
<title>Some HTML in here</title>
</head>
<body>
<h1>Look ma! HTML!</h1>
</body>
</html>
"""
| return """
<html>
<head>
<title>Some HTML in here</title>
</head>
<body>
<h1>Look ma! HTML!</h1>
</body>
</html>
"""
| 16 | 59 | 71 | 130 | from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
@app.get("/items/", response_class=HTMLResponse)
async def read_items():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
@app.get("/items/", response_class=HTMLResponse)
async def read_items():
FILL_FUNC_BODY | |
25,861 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial003.py | 7,9 | 1,20 | read_items | 9,20 | 9,20 | from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
@app.get("/items/")
async def read_items():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
@app.get("/items/")
async def read_items():
FILL_FUNC_BODY | html_content = """
<html>
<head>
<title>Some HTML in here</title>
</head>
<body>
<h1>Look ma! HTML!</h1>
</body>
</html>
"""
return HTMLResponse(content=html_content, status_code=200)
| html_content = """
<html>
<head>
<title>Some HTML in here</title>
</head>
<body>
<h1>Look ma! HTML!</h1>
</body>
</html>
"""
return HTMLResponse(content=html_content, status_code=200)
| 20 | 52 | 95 | 147 | from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
@app.get("/items/")
async def read_items():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
@app.get("/items/")
async def read_items():
FILL_FUNC_BODY | |
25,862 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial004.py | 7,8 | 1,24 | generate_html_response | 8,21 | 8,21 | from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
def generate_html_response():
FILL_FUNC_BODY@app.get("/items/", response_class=HTMLResponse)
async def read_items():
return generate_html_response()
| from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
def generate_html_response():
FILL_FUNC_BODY@app.get("/items/", response_class=HTMLResponse)
async def read_items():
return generate_html_response()
| html_content = """
<html>
<head>
<title>Some HTML in here</title>
</head>
<body>
<h1>Look ma! HTML!</h1>
</body>
</html>
"""
return HTMLResponse(content=html_content, status_code=200)
| html_content = """
<html>
<head>
<title>Some HTML in here</title>
</head>
<body>
<h1>Look ma! HTML!</h1>
</body>
</html>
"""
return HTMLResponse(content=html_content, status_code=200)
| 20 | 76 | 99 | 175 | from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
def generate_html_response():
FILL_FUNC_BODY@app.get("/items/", response_class=HTMLResponse)
async def read_items():
return generate_html_response()
| from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
def generate_html_response():
FILL_FUNC_BODY@app.get("/items/", response_class=HTMLResponse)
async def read_items():
return generate_html_response()
| |
25,863 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial005.py | 7,9 | 1,10 | main | 9,10 | 9,10 | from fastapi import FastAPI
from fastapi.responses import PlainTextResponse
app = FastAPI()
@app.get("/", response_class=PlainTextResponse)
async def main():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import PlainTextResponse
app = FastAPI()
@app.get("/", response_class=PlainTextResponse)
async def main():
FILL_FUNC_BODY | return "Hello World"
| return "Hello World"
| 3 | 59 | 8 | 67 | from fastapi import FastAPI
from fastapi.responses import PlainTextResponse
app = FastAPI()
@app.get("/", response_class=PlainTextResponse)
async def main():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import PlainTextResponse
app = FastAPI()
@app.get("/", response_class=PlainTextResponse)
async def main():
FILL_FUNC_BODY | |
25,864 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial006.py | 7,9 | 1,10 | redirect_typer | 9,10 | 9,10 | from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/typer")
async def redirect_typer():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/typer")
async def redirect_typer():
FILL_FUNC_BODY | return RedirectResponse("https://typer.tiangolo.com")
| return RedirectResponse("https://typer.tiangolo.com")
| 2 | 54 | 19 | 73 | from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/typer")
async def redirect_typer():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/typer")
async def redirect_typer():
FILL_FUNC_BODY | |
25,865 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial006b.py | 7,9 | 1,10 | redirect_fastapi | 9,10 | 9,10 | from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/fastapi", response_class=RedirectResponse)
async def redirect_fastapi():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/fastapi", response_class=RedirectResponse)
async def redirect_fastapi():
FILL_FUNC_BODY | return "https://fastapi.tiangolo.com"
| return "https://fastapi.tiangolo.com"
| 2 | 62 | 16 | 78 | from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/fastapi", response_class=RedirectResponse)
async def redirect_fastapi():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/fastapi", response_class=RedirectResponse)
async def redirect_fastapi():
FILL_FUNC_BODY | |
25,866 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial006c.py | 7,9 | 1,10 | redirect_pydantic | 9,10 | 9,10 | from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/pydantic", response_class=RedirectResponse, status_code=302)
async def redirect_pydantic():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/pydantic", response_class=RedirectResponse, status_code=302)
async def redirect_pydantic():
FILL_FUNC_BODY | return "https://docs.pydantic.dev/"
| return "https://docs.pydantic.dev/"
| 2 | 72 | 15 | 87 | from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/pydantic", response_class=RedirectResponse, status_code=302)
async def redirect_pydantic():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/pydantic", response_class=RedirectResponse, status_code=302)
async def redirect_pydantic():
FILL_FUNC_BODY | |
25,867 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial007.py | 7,8 | 1,15 | fake_video_streamer | 8,12 | 8,12 | from fastapi import FastAPI
from fastapi.responses import StreamingResponse
app = FastAPI()
async def fake_video_streamer():
FILL_FUNC_BODY@app.get("/")
async def main():
return StreamingResponse(fake_video_streamer())
| from fastapi import FastAPI
from fastapi.responses import StreamingResponse
app = FastAPI()
async def fake_video_streamer():
FILL_FUNC_BODY@app.get("/")
async def main():
return StreamingResponse(fake_video_streamer())
| for i in range(10):
yield b"some fake video bytes"
| for i in range(10):
yield b"some fake video bytes"
| 9 | 73 | 26 | 99 | from fastapi import FastAPI
from fastapi.responses import StreamingResponse
app = FastAPI()
async def fake_video_streamer():
FILL_FUNC_BODY@app.get("/")
async def main():
return StreamingResponse(fake_video_streamer())
| from fastapi import FastAPI
from fastapi.responses import StreamingResponse
app = FastAPI()
async def fake_video_streamer():
FILL_FUNC_BODY@app.get("/")
async def main():
return StreamingResponse(fake_video_streamer())
| |
25,868 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial008.py | 8,10 | 1,15 | main | 10,15 | 10,15 | from fastapi import FastAPI
from fastapi.responses import StreamingResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/")
def main():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import StreamingResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/")
def main():
FILL_FUNC_BODY | def iterfile(): # (1)
with open(some_file_path, mode="rb") as file_like: # (2)
yield from file_like # (3)
return StreamingResponse(iterfile(), media_type="video/mp4")
| def iterfile(): # (1)
with open(some_file_path, mode="rb") as file_like: # (2)
yield from file_like # (3)
return StreamingResponse(iterfile(), media_type="video/mp4")
| 19 | 65 | 75 | 140 | from fastapi import FastAPI
from fastapi.responses import StreamingResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/")
def main():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import StreamingResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/")
def main():
FILL_FUNC_BODY | |
25,869 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial009.py | 8,10 | 1,11 | main | 10,11 | 10,11 | from fastapi import FastAPI
from fastapi.responses import FileResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/")
async def main():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import FileResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/")
async def main():
FILL_FUNC_BODY | return FileResponse(some_file_path)
| return FileResponse(some_file_path)
| 2 | 65 | 13 | 78 | from fastapi import FastAPI
from fastapi.responses import FileResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/")
async def main():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import FileResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/")
async def main():
FILL_FUNC_BODY | |
25,870 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial009b.py | 8,10 | 1,11 | main | 10,11 | 10,11 | from fastapi import FastAPI
from fastapi.responses import FileResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/", response_class=FileResponse)
async def main():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import FileResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/", response_class=FileResponse)
async def main():
FILL_FUNC_BODY | return some_file_path
| return some_file_path
| 2 | 72 | 9 | 81 | from fastapi import FastAPI
from fastapi.responses import FileResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/", response_class=FileResponse)
async def main():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import FileResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/", response_class=FileResponse)
async def main():
FILL_FUNC_BODY | |
25,871 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial009c.py | 17,19 | 1,20 | main | 19,20 | 19,20 | from typing import Any
import orjson
from fastapi import FastAPI, Response
app = FastAPI()
class CustomORJSONResponse(Response):
media_type = "application/json"
def render(self, content: Any) -> bytes:
assert orjson is not None, "orjson must be installed"
return orjson.dumps(content, option... | from typing import Any
import orjson
from fastapi import FastAPI, Response
app = FastAPI()
class CustomORJSONResponse(Response):
media_type = "application/json"
def render(self, content: Any) -> bytes:
assert orjson is not None, "orjson must be installed"
return orjson.dumps(content, option... | return {"message": "Hello World"}
| return {"message": "Hello World"}
| 4 | 136 | 11 | 147 | from typing import Any
import orjson
from fastapi import FastAPI, Response
app = FastAPI()
class CustomORJSONResponse(Response):
media_type = "application/json"
def render(self, content: Any) -> bytes:
assert orjson is not None, "orjson must be installed"
return orjson.dumps(content, option... | from typing import Any
import orjson
from fastapi import FastAPI, Response
app = FastAPI()
class CustomORJSONResponse(Response):
media_type = "application/json"
def render(self, content: Any) -> bytes:
assert orjson is not None, "orjson must be installed"
return orjson.dumps(content, option... | |
25,872 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial009c.py | 12,13 | 9,17 | render | CustomORJSONResponse | 13,17 | 13,17 | class CustomORJSONResponse(Response):
media_type = "application/json"
def render(self, content: Any) -> bytes:
FILL_FUNC_BODY | class CustomORJSONResponse(Response):
media_type = "application/json"
def render(self, content: Any) -> bytes:
FILL_FUNC_BODY | assert orjson is not None, "orjson must be installed"
return orjson.dumps(content, option=orjson.OPT_INDENT_2)
| assert orjson is not None, "orjson must be installed"
return orjson.dumps(content, option=orjson.OPT_INDENT_2)
| 12 | 46 | 45 | 91 | from typing import Any
import orjson
from fastapi import FastAPI, Response
app = FastAPI()
class CustomORJSONResponse(Response):
media_type = "application/json"
def render(self, content: Any) -> bytes:
FILL_FUNC_BODY@app.get("/", response_class=CustomORJSONResponse)
async def main():
return {"message":... | from typing import Any
import orjson
from fastapi import FastAPI, Response
app = FastAPI()
class CustomORJSONResponse(Response):
media_type = "application/json"
def render(self, content: Any) -> bytes:
FILL_FUNC_BODY@app.get("/", response_class=CustomORJSONResponse)
async def main():
return {"message":... |
25,873 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/custom_response/tutorial010.py | 7,9 | 1,10 | read_items | 9,10 | 9,10 | from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
app = FastAPI(default_response_class=ORJSONResponse)
@app.get("/items/")
async def read_items():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
app = FastAPI(default_response_class=ORJSONResponse)
@app.get("/items/")
async def read_items():
FILL_FUNC_BODY | return [{"item_id": "Foo"}]
| return [{"item_id": "Foo"}]
| 3 | 63 | 15 | 78 | from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
app = FastAPI(default_response_class=ORJSONResponse)
@app.get("/items/")
async def read_items():
FILL_FUNC_BODY | from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
app = FastAPI(default_response_class=ORJSONResponse)
@app.get("/items/")
async def read_items():
FILL_FUNC_BODY | |
25,874 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dataclasses/tutorial001.py | 18,20 | 1,21 | create_item | 20,21 | 20,21 | from dataclasses import dataclass
from typing import Union
from fastapi import FastAPI
@dataclass
class Item:
name: str
price: float
description: Union[str, None] = None
tax: Union[float, None] = None
app = FastAPI()
@app.post("/items/")
async def create_item(item: Item):
FILL_FUNC_BODY | from dataclasses import dataclass
from typing import Union
from fastapi import FastAPI
@dataclass
class Item:
name: str
price: float
description: Union[str, None] = None
tax: Union[float, None] = None
app = FastAPI()
@app.post("/items/")
async def create_item(item: Item):
FILL_FUNC_BODY | return item
| return item
| 2 | 108 | 5 | 113 | from dataclasses import dataclass
from typing import Union
from fastapi import FastAPI
@dataclass
class Item:
name: str
price: float
description: Union[str, None] = None
tax: Union[float, None] = None
app = FastAPI()
@app.post("/items/")
async def create_item(item: Item):
FILL_FUNC_BODY | from dataclasses import dataclass
from typing import Union
from fastapi import FastAPI
@dataclass
class Item:
name: str
price: float
description: Union[str, None] = None
tax: Union[float, None] = None
app = FastAPI()
@app.post("/items/")
async def create_item(item: Item):
FILL_FUNC_BODY | |
25,875 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dataclasses/tutorial002.py | 19,21 | 1,27 | read_next_item | 21,27 | 21,27 | from dataclasses import dataclass, field
from typing import List, Union
from fastapi import FastAPI
@dataclass
class Item:
name: str
price: float
tags: List[str] = field(default_factory=list)
description: Union[str, None] = None
tax: Union[float, None] = None
app = FastAPI()
@app.get("/items/... | from dataclasses import dataclass, field
from typing import List, Union
from fastapi import FastAPI
@dataclass
class Item:
name: str
price: float
tags: List[str] = field(default_factory=list)
description: Union[str, None] = None
tax: Union[float, None] = None
app = FastAPI()
@app.get("/items/... | return {
"name": "Island In The Moon",
"price": 12.99,
"description": "A place to be be playin' and havin' fun",
"tags": ["breater"],
}
| return {
"name": "Island In The Moon",
"price": 12.99,
"description": "A place to be be playin' and havin' fun",
"tags": ["breater"],
}
| 22 | 134 | 67 | 201 | from dataclasses import dataclass, field
from typing import List, Union
from fastapi import FastAPI
@dataclass
class Item:
name: str
price: float
tags: List[str] = field(default_factory=list)
description: Union[str, None] = None
tax: Union[float, None] = None
app = FastAPI()
@app.get("/items/... | from dataclasses import dataclass, field
from typing import List, Union
from fastapi import FastAPI
@dataclass
class Item:
name: str
price: float
tags: List[str] = field(default_factory=list)
description: Union[str, None] = None
tax: Union[float, None] = None
app = FastAPI()
@app.get("/items/... | |
25,876 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dataclasses/tutorial003.py | 28,30 | 1,56 | get_authors | 30,56 | 30,56 | from dataclasses import field # (1)
from typing import List, Union
from fastapi import FastAPI
from pydantic.dataclasses import dataclass # (2)
@dataclass
class Item:
name: str
description: Union[str, None] = None
@dataclass
class Author:
name: str
items: List[Item] = field(default_factory=list) ... | from dataclasses import field # (1)
from typing import List, Union
from fastapi import FastAPI
from pydantic.dataclasses import dataclass # (2)
@dataclass
class Item:
name: str
description: Union[str, None] = None
@dataclass
class Author:
name: str
items: List[Item] = field(default_factory=list) ... | return [ # (9)
{
"name": "Breaters",
"items": [
{
"name": "Island In The Moon",
"description": "A place to be be playin' and havin' fun",
},
{"name": "Holy Buddies"},
],
},
... | return [ # (9)
{
"name": "Breaters",
"items": [
{
"name": "Island In The Moon",
"description": "A place to be be playin' and havin' fun",
},
{"name": "Holy Buddies"},
],
},
... | 67 | 244 | 215 | 459 | from dataclasses import field # (1)
from typing import List, Union
from fastapi import FastAPI
from pydantic.dataclasses import dataclass # (2)
@dataclass
class Item:
name: str
description: Union[str, None] = None
@dataclass
class Author:
name: str
items: List[Item] = field(default_factory=list) ... | from dataclasses import field # (1)
from typing import List, Union
from fastapi import FastAPI
from pydantic.dataclasses import dataclass # (2)
@dataclass
class Item:
name: str
description: Union[str, None] = None
@dataclass
class Author:
name: str
items: List[Item] = field(default_factory=list) ... | |
25,877 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/debugging/tutorial001.py | 7,9 | 1,16 | root | 9,14 | 9,14 | import uvicorn
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def root():
FILL_FUNC_BODYif __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
| import uvicorn
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def root():
FILL_FUNC_BODYif __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
| a = "a"
b = "b" + a
return {"hello world": b}
| a = "a"
b = "b" + a
return {"hello world": b}
| 12 | 83 | 32 | 115 | import uvicorn
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def root():
FILL_FUNC_BODYif __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
| import uvicorn
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def root():
FILL_FUNC_BODYif __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
| |
25,878 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial001.py | 8,11 | 1,22 | common_parameters | 11,14 | 11,14 | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
return commons
@app.get("/users/")
a... | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
return commons
@app.get("/users/")
a... | return {"q": q, "skip": skip, "limit": limit}
| return {"q": q, "skip": skip, "limit": limit}
| 7 | 135 | 23 | 158 | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
return commons
@app.get("/users/")
a... | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
return commons
@app.get("/users/")
a... | |
25,879 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial001_02_an.py | 9,12 | 1,26 | common_parameters | 12,15 | 12,15 | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODYCommonsDep = Annotated[dict, Depends(common_parameters)]
@app.get("/items/")
async def... | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODYCommonsDep = Annotated[dict, Depends(common_parameters)]
@app.get("/items/")
async def... | return {"q": q, "skip": skip, "limit": limit}
| return {"q": q, "skip": skip, "limit": limit}
| 7 | 151 | 23 | 174 | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODYCommonsDep = Annotated[dict, Depends(common_parameters)]
@app.get("/items/")
async def... | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODYCommonsDep = Annotated[dict, Depends(common_parameters)]
@app.get("/items/")
async def... | |
25,880 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial001_02_an_py310.py | 20,22 | 1,23 | read_users | 22,23 | 22,23 | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
return {"q": q, "skip": skip, "limit": limit}
CommonsDep = Annotated[dict, Depends(common_parameters)]
@app.get("/items/")
async def read_item... | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
return {"q": q, "skip": skip, "limit": limit}
CommonsDep = Annotated[dict, Depends(common_parameters)]
@app.get("/items/")
async def read_item... | return commons
| return commons
| 2 | 153 | 6 | 159 | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
return {"q": q, "skip": skip, "limit": limit}
CommonsDep = Annotated[dict, Depends(common_parameters)]
@app.get("/items/")
async def read_item... | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
return {"q": q, "skip": skip, "limit": limit}
CommonsDep = Annotated[dict, Depends(common_parameters)]
@app.get("/items/")
async def read_item... | |
25,881 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial001_02_an_py39.py | 8,11 | 1,25 | common_parameters | 11,14 | 11,14 | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODYCommonsDep = Annotated[dict, Depends(common_parameters)]
@app.get("/items/")
async def read_items(commons: CommonsD... | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODYCommonsDep = Annotated[dict, Depends(common_parameters)]
@app.get("/items/")
async def read_items(commons: CommonsD... | return {"q": q, "skip": skip, "limit": limit}
| return {"q": q, "skip": skip, "limit": limit}
| 7 | 146 | 23 | 169 | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODYCommonsDep = Annotated[dict, Depends(common_parameters)]
@app.get("/items/")
async def read_items(commons: CommonsD... | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODYCommonsDep = Annotated[dict, Depends(common_parameters)]
@app.get("/items/")
async def read_items(commons: CommonsD... | |
25,882 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial001_an.py | 15,17 | 1,23 | read_items | 17,20 | 17,20 | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
return {"q": q, "skip": skip, "limit": limit}
@app.get("/items/")
async def read_items(commons: ... | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
return {"q": q, "skip": skip, "limit": limit}
@app.get("/items/")
async def read_items(commons: ... | return commons
| return commons
| 2 | 165 | 10 | 175 | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
return {"q": q, "skip": skip, "limit": limit}
@app.get("/items/")
async def read_items(commons: ... | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
return {"q": q, "skip": skip, "limit": limit}
@app.get("/items/")
async def read_items(commons: ... | |
25,883 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial001_an_py310.py | 8,9 | 1,20 | common_parameters | 9,12 | 9,12 | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
return commons
@app.get("/users/")... | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
return commons
@app.get("/users/")... | return {"q": q, "skip": skip, "limit": limit}
| return {"q": q, "skip": skip, "limit": limit}
| 7 | 139 | 23 | 162 | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
return commons
@app.get("/users/")... | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
return commons
@app.get("/users/")... | |
25,884 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial001_an_py39.py | 8,11 | 1,22 | common_parameters | 11,14 | 11,14 | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
return commons
... | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
return commons
... | return {"q": q, "skip": skip, "limit": limit}
| return {"q": q, "skip": skip, "limit": limit}
| 7 | 147 | 23 | 170 | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
return commons
... | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
return commons
... | |
25,885 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial001_py310.py | 6,7 | 1,18 | common_parameters | 7,10 | 7,10 | from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
return commons
@app.get("/users/")
async def read_users(commons: dict = De... | from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
return commons
@app.get("/users/")
async def read_users(commons: dict = De... | return {"q": q, "skip": skip, "limit": limit}
| return {"q": q, "skip": skip, "limit": limit}
| 7 | 123 | 23 | 146 | from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
return commons
@app.get("/users/")
async def read_users(commons: dict = De... | from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
FILL_FUNC_BODY@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
return commons
@app.get("/users/")
async def read_users(commons: dict = De... | |
25,886 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial002.py | 18,20 | 1,26 | read_items | 20,26 | 20,26 | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip... | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 162 | 72 | 234 | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip... | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip... | |
25,887 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial002_an.py | 19,21 | 1,27 | read_items | 21,27 | 21,27 | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
... | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 175 | 72 | 247 | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
... | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
... | |
25,888 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial002_an_py310.py | 18,20 | 1,26 | read_items | 20,26 | 20,26 | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
... | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 165 | 72 | 237 | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
... | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
... | |
25,889 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial002_an_py39.py | 18,20 | 1,26 | read_items | 20,26 | 20,26 | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.... | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 170 | 72 | 242 | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.... | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.... | |
25,890 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial002_py310.py | 16,18 | 1,24 | read_items | 18,24 | 18,24 | from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
self.limit = limit
@a... | from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
self.limit = limit
@a... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 153 | 72 | 225 | from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
self.limit = limit
@a... | from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
self.limit = limit
@a... | |
25,891 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial003.py | 18,20 | 1,26 | read_items | 20,26 | 20,26 | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip... | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 159 | 72 | 231 | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip... | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip... | |
25,892 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial003_an.py | 19,21 | 1,27 | read_items | 21,27 | 21,27 | from typing import Any, Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100)... | from typing import Any, Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100)... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 175 | 72 | 247 | from typing import Any, Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100)... | from typing import Any, Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100)... | |
25,893 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial003_an_py310.py | 18,20 | 1,26 | read_items | 20,26 | 20,26 | from typing import Annotated, Any
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = s... | from typing import Annotated, Any
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = s... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 165 | 72 | 237 | from typing import Annotated, Any
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = s... | from typing import Annotated, Any
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = s... | |
25,894 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial003_an_py39.py | 18,20 | 1,26 | read_items | 20,26 | 20,26 | from typing import Annotated, Any, Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
... | from typing import Annotated, Any, Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 170 | 72 | 242 | from typing import Annotated, Any, Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
... | from typing import Annotated, Any, Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
... | |
25,895 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial003_py310.py | 16,18 | 1,24 | read_items | 18,24 | 18,24 | from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
self.limit = limit
@a... | from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
self.limit = limit
@a... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 150 | 72 | 222 | from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
self.limit = limit
@a... | from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
self.limit = limit
@a... | |
25,896 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial004.py | 18,20 | 1,26 | read_items | 20,26 | 20,26 | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip... | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 158 | 72 | 230 | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip... | from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip... | |
25,897 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial004_an.py | 19,21 | 1,27 | read_items | 21,27 | 21,27 | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
... | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 172 | 72 | 244 | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
... | from typing import Union
from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
... | |
25,898 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial004_an_py310.py | 18,20 | 1,26 | read_items | 20,26 | 20,26 | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
... | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 162 | 72 | 234 | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
... | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
... | |
25,899 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial004_an_py39.py | 18,20 | 1,26 | read_items | 20,26 | 20,26 | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.... | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 167 | 72 | 239 | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.... | from typing import Annotated, Union
from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
self.q = q
self.... | |
25,900 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial004_py310.py | 16,18 | 1,24 | read_items | 18,24 | 18,24 | from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
self.limit = limit
@a... | from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
self.limit = limit
@a... | response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| response = {}
if commons.q:
response.update({"q": commons.q})
items = fake_items_db[commons.skip : commons.skip + commons.limit]
response.update({"items": items})
return response
| 18 | 149 | 72 | 221 | from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
self.limit = limit
@a... | from fastapi import Depends, FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class CommonQueryParams:
def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
self.q = q
self.skip = skip
self.limit = limit
@a... | |
25,901 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial005.py | 21,23 | 1,24 | read_query | 23,24 | 23,24 | from typing import Union
from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: Union[str, None] = None):
return q
def query_or_cookie_extractor(
q: str = Depends(query_extractor),
last_query: Union[str, None] = Cookie(default=None),
):
if not q:
return last_qu... | from typing import Union
from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: Union[str, None] = None):
return q
def query_or_cookie_extractor(
q: str = Depends(query_extractor),
last_query: Union[str, None] = Cookie(default=None),
):
if not q:
return last_qu... | return {"q_or_cookie": query_or_default}
| return {"q_or_cookie": query_or_default}
| 3 | 163 | 18 | 181 | from typing import Union
from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: Union[str, None] = None):
return q
def query_or_cookie_extractor(
q: str = Depends(query_extractor),
last_query: Union[str, None] = Cookie(default=None),
):
if not q:
return last_qu... | from typing import Union
from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: Union[str, None] = None):
return q
def query_or_cookie_extractor(
q: str = Depends(query_extractor),
last_query: Union[str, None] = Cookie(default=None),
):
if not q:
return last_qu... | |
25,902 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial005_an.py | 13,17 | 1,27 | query_or_cookie_extractor | 17,22 | 17,22 | from typing import Union
from fastapi import Cookie, Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
def query_extractor(q: Union[str, None] = None):
return q
def query_or_cookie_extractor(
q: Annotated[str, Depends(query_extractor)],
last_query: Annotated[Union[str, None], Co... | from typing import Union
from fastapi import Cookie, Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
def query_extractor(q: Union[str, None] = None):
return q
def query_or_cookie_extractor(
q: Annotated[str, Depends(query_extractor)],
last_query: Annotated[Union[str, None], Co... | if not q:
return last_query
return q
| if not q:
return last_query
return q
| 7 | 188 | 23 | 211 | from typing import Union
from fastapi import Cookie, Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
def query_extractor(q: Union[str, None] = None):
return q
def query_or_cookie_extractor(
q: Annotated[str, Depends(query_extractor)],
last_query: Annotated[Union[str, None], Co... | from typing import Union
from fastapi import Cookie, Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
def query_extractor(q: Union[str, None] = None):
return q
def query_or_cookie_extractor(
q: Annotated[str, Depends(query_extractor)],
last_query: Annotated[Union[str, None], Co... | |
25,903 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial005_an_py310.py | 12,16 | 1,26 | query_or_cookie_extractor | 16,21 | 16,21 | from typing import Annotated
from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: str | None = None):
return q
def query_or_cookie_extractor(
q: Annotated[str, Depends(query_extractor)],
last_query: Annotated[str | None, Cookie()] = None,
):
FILL_FUNC_BODY@app.get("/item... | from typing import Annotated
from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: str | None = None):
return q
def query_or_cookie_extractor(
q: Annotated[str, Depends(query_extractor)],
last_query: Annotated[str | None, Cookie()] = None,
):
FILL_FUNC_BODY@app.get("/item... | if not q:
return last_query
return q
| if not q:
return last_query
return q
| 7 | 175 | 23 | 198 | from typing import Annotated
from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: str | None = None):
return q
def query_or_cookie_extractor(
q: Annotated[str, Depends(query_extractor)],
last_query: Annotated[str | None, Cookie()] = None,
):
FILL_FUNC_BODY@app.get("/item... | from typing import Annotated
from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: str | None = None):
return q
def query_or_cookie_extractor(
q: Annotated[str, Depends(query_extractor)],
last_query: Annotated[str | None, Cookie()] = None,
):
FILL_FUNC_BODY@app.get("/item... | |
25,904 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial005_an_py39.py | 12,16 | 1,26 | query_or_cookie_extractor | 16,21 | 16,21 | from typing import Annotated, Union
from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: Union[str, None] = None):
return q
def query_or_cookie_extractor(
q: Annotated[str, Depends(query_extractor)],
last_query: Annotated[Union[str, None], Cookie()] = None,
):
FILL_FUNC_... | from typing import Annotated, Union
from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: Union[str, None] = None):
return q
def query_or_cookie_extractor(
q: Annotated[str, Depends(query_extractor)],
last_query: Annotated[Union[str, None], Cookie()] = None,
):
FILL_FUNC_... | if not q:
return last_query
return q
| if not q:
return last_query
return q
| 7 | 183 | 23 | 206 | from typing import Annotated, Union
from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: Union[str, None] = None):
return q
def query_or_cookie_extractor(
q: Annotated[str, Depends(query_extractor)],
last_query: Annotated[Union[str, None], Cookie()] = None,
):
FILL_FUNC_... | from typing import Annotated, Union
from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: Union[str, None] = None):
return q
def query_or_cookie_extractor(
q: Annotated[str, Depends(query_extractor)],
last_query: Annotated[Union[str, None], Cookie()] = None,
):
FILL_FUNC_... | |
25,905 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial005_py310.py | 10,13 | 1,21 | query_or_cookie_extractor | 13,18 | 13,18 | from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: str | None = None):
return q
def query_or_cookie_extractor(
q: str = Depends(query_extractor), last_query: str | None = Cookie(default=None)
):
FILL_FUNC_BODY@app.get("/items/")
async def read_query(query_or_default: str = ... | from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: str | None = None):
return q
def query_or_cookie_extractor(
q: str = Depends(query_extractor), last_query: str | None = Cookie(default=None)
):
FILL_FUNC_BODY@app.get("/items/")
async def read_query(query_or_default: str = ... | if not q:
return last_query
return q
| if not q:
return last_query
return q
| 7 | 148 | 23 | 171 | from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: str | None = None):
return q
def query_or_cookie_extractor(
q: str = Depends(query_extractor), last_query: str | None = Cookie(default=None)
):
FILL_FUNC_BODY@app.get("/items/")
async def read_query(query_or_default: str = ... | from fastapi import Cookie, Depends, FastAPI
app = FastAPI()
def query_extractor(q: str | None = None):
return q
def query_or_cookie_extractor(
q: str = Depends(query_extractor), last_query: str | None = Cookie(default=None)
):
FILL_FUNC_BODY@app.get("/items/")
async def read_query(query_or_default: str = ... | |
25,906 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial006.py | 6,7 | 1,20 | verify_token | 7,11 | 7,11 | from fastapi import Depends, FastAPI, Header, HTTPException
app = FastAPI()
async def verify_token(x_token: str = Header()):
FILL_FUNC_BODYasync def verify_key(x_key: str = Header()):
if x_key != "fake-super-secret-key":
raise HTTPException(status_code=400, detail="X-Key header invalid")
return x_key... | from fastapi import Depends, FastAPI, Header, HTTPException
app = FastAPI()
async def verify_token(x_token: str = Header()):
FILL_FUNC_BODYasync def verify_key(x_key: str = Header()):
if x_key != "fake-super-secret-key":
raise HTTPException(status_code=400, detail="X-Key header invalid")
return x_key... | if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
| if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
| 9 | 169 | 46 | 215 | from fastapi import Depends, FastAPI, Header, HTTPException
app = FastAPI()
async def verify_token(x_token: str = Header()):
FILL_FUNC_BODYasync def verify_key(x_key: str = Header()):
if x_key != "fake-super-secret-key":
raise HTTPException(status_code=400, detail="X-Key header invalid")
return x_key... | from fastapi import Depends, FastAPI, Header, HTTPException
app = FastAPI()
async def verify_token(x_token: str = Header()):
FILL_FUNC_BODYasync def verify_key(x_key: str = Header()):
if x_key != "fake-super-secret-key":
raise HTTPException(status_code=400, detail="X-Key header invalid")
return x_key... | |
25,907 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial006_an.py | 7,8 | 1,21 | verify_token | 8,12 | 8,12 | from fastapi import Depends, FastAPI, Header, HTTPException
from typing_extensions import Annotated
app = FastAPI()
async def verify_token(x_token: Annotated[str, Header()]):
FILL_FUNC_BODYasync def verify_key(x_key: Annotated[str, Header()]):
if x_key != "fake-super-secret-key":
raise HTTPException(stat... | from fastapi import Depends, FastAPI, Header, HTTPException
from typing_extensions import Annotated
app = FastAPI()
async def verify_token(x_token: Annotated[str, Header()]):
FILL_FUNC_BODYasync def verify_key(x_key: Annotated[str, Header()]):
if x_key != "fake-super-secret-key":
raise HTTPException(stat... | if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
| if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
| 9 | 188 | 46 | 234 | from fastapi import Depends, FastAPI, Header, HTTPException
from typing_extensions import Annotated
app = FastAPI()
async def verify_token(x_token: Annotated[str, Header()]):
FILL_FUNC_BODYasync def verify_key(x_key: Annotated[str, Header()]):
if x_key != "fake-super-secret-key":
raise HTTPException(stat... | from fastapi import Depends, FastAPI, Header, HTTPException
from typing_extensions import Annotated
app = FastAPI()
async def verify_token(x_token: Annotated[str, Header()]):
FILL_FUNC_BODYasync def verify_key(x_key: Annotated[str, Header()]):
if x_key != "fake-super-secret-key":
raise HTTPException(stat... | |
25,908 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial006_an_py39.py | 8,9 | 1,22 | verify_token | 9,13 | 9,13 | from typing import Annotated
from fastapi import Depends, FastAPI, Header, HTTPException
app = FastAPI()
async def verify_token(x_token: Annotated[str, Header()]):
FILL_FUNC_BODYasync def verify_key(x_key: Annotated[str, Header()]):
if x_key != "fake-super-secret-key":
raise HTTPException(status_code=40... | from typing import Annotated
from fastapi import Depends, FastAPI, Header, HTTPException
app = FastAPI()
async def verify_token(x_token: Annotated[str, Header()]):
FILL_FUNC_BODYasync def verify_key(x_key: Annotated[str, Header()]):
if x_key != "fake-super-secret-key":
raise HTTPException(status_code=40... | if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
| if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
| 9 | 187 | 46 | 233 | from typing import Annotated
from fastapi import Depends, FastAPI, Header, HTTPException
app = FastAPI()
async def verify_token(x_token: Annotated[str, Header()]):
FILL_FUNC_BODYasync def verify_key(x_key: Annotated[str, Header()]):
if x_key != "fake-super-secret-key":
raise HTTPException(status_code=40... | from typing import Annotated
from fastapi import Depends, FastAPI, Header, HTTPException
app = FastAPI()
async def verify_token(x_token: Annotated[str, Header()]):
FILL_FUNC_BODYasync def verify_key(x_key: Annotated[str, Header()]):
if x_key != "fake-super-secret-key":
raise HTTPException(status_code=40... | |
25,909 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial008b.py | 16,17 | 1,31 | get_username | 17,23 | 17,23 | from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get... | from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get... | try:
yield "Rick"
except OwnerError as e:
raise HTTPException(status_code=400, detail=f"Owner error: {e}")
| try:
yield "Rick"
except OwnerError as e:
raise HTTPException(status_code=400, detail=f"Owner error: {e}")
| 12 | 213 | 53 | 266 | from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get... | from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get... | |
25,910 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial008b_an.py | 24,26 | 1,32 | get_item | 26,32 | 26,32 | from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
de... | from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
de... | if item_id not in data:
raise HTTPException(status_code=404, detail="Item not found")
item = data[item_id]
if item["owner"] != username:
raise OwnerError(username)
return item
| if item_id not in data:
raise HTTPException(status_code=404, detail="Item not found")
item = data[item_id]
if item["owner"] != username:
raise OwnerError(username)
return item
| 21 | 208 | 71 | 279 | from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
de... | from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
de... | |
25,911 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial008b_an_py39.py | 25,27 | 1,33 | get_item | 27,33 | 27,33 | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
def get_user... | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
def get_user... | if item_id not in data:
raise HTTPException(status_code=404, detail="Item not found")
item = data[item_id]
if item["owner"] != username:
raise OwnerError(username)
return item
| if item_id not in data:
raise HTTPException(status_code=404, detail="Item not found")
item = data[item_id]
if item["owner"] != username:
raise OwnerError(username)
return item
| 21 | 207 | 71 | 278 | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
def get_user... | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
def get_user... | |
25,912 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial008c.py | 17,19 | 1,28 | get_item | 19,28 | 19,28 | from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
try:
yield "Rick"
except InternalError:
print("Oops, we didn't raise again, Britney 😱")
@app.get("/items/{item_id}")
def get_item(item_id: str, username: str =... | from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
try:
yield "Rick"
except InternalError:
print("Oops, we didn't raise again, Britney 😱")
@app.get("/items/{item_id}")
def get_item(item_id: str, username: str =... | if item_id == "portal-gun":
raise InternalError(
f"The portal gun is too dangerous to be owned by {username}"
)
if item_id != "plumbus":
raise HTTPException(
status_code=404, detail="Item not found, there's only a plumbus here"
)
return item_id
| if item_id == "portal-gun":
raise InternalError(
f"The portal gun is too dangerous to be owned by {username}"
)
if item_id != "plumbus":
raise HTTPException(
status_code=404, detail="Item not found, there's only a plumbus here"
)
return item_id
| 36 | 124 | 103 | 227 | from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
try:
yield "Rick"
except InternalError:
print("Oops, we didn't raise again, Britney 😱")
@app.get("/items/{item_id}")
def get_item(item_id: str, username: str =... | from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
try:
yield "Rick"
except InternalError:
print("Oops, we didn't raise again, Britney 😱")
@app.get("/items/{item_id}")
def get_item(item_id: str, username: str =... | |
25,913 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial008c_an.py | 11,12 | 1,29 | get_username | 12,18 | 12,18 | from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get("/items/{item_id}")
def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
if item_id == "portal-... | from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get("/items/{item_id}")
def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
if item_id == "portal-... | try:
yield "Rick"
except InternalError:
print("Oops, we didn't raise again, Britney 😱")
| try:
yield "Rick"
except InternalError:
print("Oops, we didn't raise again, Britney 😱")
| 12 | 192 | 45 | 237 | from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get("/items/{item_id}")
def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
if item_id == "portal-... | from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get("/items/{item_id}")
def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
if item_id == "portal-... | |
25,914 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial008c_an_py39.py | 19,21 | 1,30 | get_item | 21,30 | 21,30 | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
try:
yield "Rick"
except InternalError:
print("Oops, we didn't raise again, Britney 😱")
@app.get("/items/{item_id}")
def get_item... | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
try:
yield "Rick"
except InternalError:
print("Oops, we didn't raise again, Britney 😱")
@app.get("/items/{item_id}")
def get_item... | if item_id == "portal-gun":
raise InternalError(
f"The portal gun is too dangerous to be owned by {username}"
)
if item_id != "plumbus":
raise HTTPException(
status_code=404, detail="Item not found, there's only a plumbus here"
)
return item_id
| if item_id == "portal-gun":
raise InternalError(
f"The portal gun is too dangerous to be owned by {username}"
)
if item_id != "plumbus":
raise HTTPException(
status_code=404, detail="Item not found, there's only a plumbus here"
)
return item_id
| 36 | 136 | 103 | 239 | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
try:
yield "Rick"
except InternalError:
print("Oops, we didn't raise again, Britney 😱")
@app.get("/items/{item_id}")
def get_item... | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
try:
yield "Rick"
except InternalError:
print("Oops, we didn't raise again, Britney 😱")
@app.get("/items/{item_id}")
def get_item... | |
25,915 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial008d.py | 10,11 | 1,29 | get_username | 11,18 | 11,18 | from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get("/items/{item_id}")
def get_item(item_id: str, username: str = Depends(get_username)):
if item_id == "portal-gun":
raise InternalError(
f"T... | from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get("/items/{item_id}")
def get_item(item_id: str, username: str = Depends(get_username)):
if item_id == "portal-gun":
raise InternalError(
f"T... | try:
yield "Rick"
except InternalError:
print("We don't swallow the internal error here, we raise again 😎")
raise
| try:
yield "Rick"
except InternalError:
print("We don't swallow the internal error here, we raise again 😎")
raise
| 17 | 179 | 51 | 230 | from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get("/items/{item_id}")
def get_item(item_id: str, username: str = Depends(get_username)):
if item_id == "portal-gun":
raise InternalError(
f"T... | from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get("/items/{item_id}")
def get_item(item_id: str, username: str = Depends(get_username)):
if item_id == "portal-gun":
raise InternalError(
f"T... | |
25,916 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial008d_an.py | 19,21 | 1,30 | get_item | 21,30 | 21,30 | from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
try:
yield "Rick"
except InternalError:
print("We don't swallow the internal error here, we raise again 😎")
raise... | from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
try:
yield "Rick"
except InternalError:
print("We don't swallow the internal error here, we raise again 😎")
raise... | if item_id == "portal-gun":
raise InternalError(
f"The portal gun is too dangerous to be owned by {username}"
)
if item_id != "plumbus":
raise HTTPException(
status_code=404, detail="Item not found, there's only a plumbus here"
)
return item_id
| if item_id == "portal-gun":
raise InternalError(
f"The portal gun is too dangerous to be owned by {username}"
)
if item_id != "plumbus":
raise HTTPException(
status_code=404, detail="Item not found, there's only a plumbus here"
)
return item_id
| 36 | 142 | 103 | 245 | from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
try:
yield "Rick"
except InternalError:
print("We don't swallow the internal error here, we raise again 😎")
raise... | from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
try:
yield "Rick"
except InternalError:
print("We don't swallow the internal error here, we raise again 😎")
raise... | |
25,917 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial008d_an_py39.py | 12,13 | 1,31 | get_username | 13,20 | 13,20 | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get("/items/{item_id}")
def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
if item_id == "portal-gun":
... | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get("/items/{item_id}")
def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
if item_id == "portal-gun":
... | try:
yield "Rick"
except InternalError:
print("We don't swallow the internal error here, we raise again 😎")
raise
| try:
yield "Rick"
except InternalError:
print("We don't swallow the internal error here, we raise again 😎")
raise
| 17 | 191 | 51 | 242 | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get("/items/{item_id}")
def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
if item_id == "portal-gun":
... | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException
app = FastAPI()
class InternalError(Exception):
pass
def get_username():
FILL_FUNC_BODY@app.get("/items/{item_id}")
def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
if item_id == "portal-gun":
... | |
25,918 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial011.py | 19,21 | 1,22 | read_query_check | 21,22 | 21,22 | from fastapi import Depends, FastAPI
app = FastAPI()
class FixedContentQueryChecker:
def __init__(self, fixed_content: str):
self.fixed_content = fixed_content
def __call__(self, q: str = ""):
if q:
return self.fixed_content in q
return False
checker = FixedContentQuery... | from fastapi import Depends, FastAPI
app = FastAPI()
class FixedContentQueryChecker:
def __init__(self, fixed_content: str):
self.fixed_content = fixed_content
def __call__(self, q: str = ""):
if q:
return self.fixed_content in q
return False
checker = FixedContentQuery... | return {"fixed_content_in_query": fixed_content_included}
| return {"fixed_content_in_query": fixed_content_included}
| 3 | 147 | 20 | 167 | from fastapi import Depends, FastAPI
app = FastAPI()
class FixedContentQueryChecker:
def __init__(self, fixed_content: str):
self.fixed_content = fixed_content
def __call__(self, q: str = ""):
if q:
return self.fixed_content in q
return False
checker = FixedContentQuery... | from fastapi import Depends, FastAPI
app = FastAPI()
class FixedContentQueryChecker:
def __init__(self, fixed_content: str):
self.fixed_content = fixed_content
def __call__(self, q: str = ""):
if q:
return self.fixed_content in q
return False
checker = FixedContentQuery... | |
25,919 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial011_an.py | 20,22 | 1,23 | read_query_check | 22,23 | 22,23 | from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
class FixedContentQueryChecker:
def __init__(self, fixed_content: str):
self.fixed_content = fixed_content
def __call__(self, q: str = ""):
if q:
return self.fixed_content in q
re... | from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
class FixedContentQueryChecker:
def __init__(self, fixed_content: str):
self.fixed_content = fixed_content
def __call__(self, q: str = ""):
if q:
return self.fixed_content in q
re... | return {"fixed_content_in_query": fixed_content_included}
| return {"fixed_content_in_query": fixed_content_included}
| 3 | 160 | 20 | 180 | from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
class FixedContentQueryChecker:
def __init__(self, fixed_content: str):
self.fixed_content = fixed_content
def __call__(self, q: str = ""):
if q:
return self.fixed_content in q
re... | from fastapi import Depends, FastAPI
from typing_extensions import Annotated
app = FastAPI()
class FixedContentQueryChecker:
def __init__(self, fixed_content: str):
self.fixed_content = fixed_content
def __call__(self, q: str = ""):
if q:
return self.fixed_content in q
re... | |
25,920 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial011_an_py39.py | 21,23 | 1,24 | read_query_check | 23,24 | 23,24 | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
class FixedContentQueryChecker:
def __init__(self, fixed_content: str):
self.fixed_content = fixed_content
def __call__(self, q: str = ""):
if q:
return self.fixed_content in q
return False... | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
class FixedContentQueryChecker:
def __init__(self, fixed_content: str):
self.fixed_content = fixed_content
def __call__(self, q: str = ""):
if q:
return self.fixed_content in q
return False... | return {"fixed_content_in_query": fixed_content_included}
| return {"fixed_content_in_query": fixed_content_included}
| 3 | 159 | 20 | 179 | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
class FixedContentQueryChecker:
def __init__(self, fixed_content: str):
self.fixed_content = fixed_content
def __call__(self, q: str = ""):
if q:
return self.fixed_content in q
return False... | from typing import Annotated
from fastapi import Depends, FastAPI
app = FastAPI()
class FixedContentQueryChecker:
def __init__(self, fixed_content: str):
self.fixed_content = fixed_content
def __call__(self, q: str = ""):
if q:
return self.fixed_content in q
return False... | |
25,921 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial012.py | 18,20 | 1,26 | read_items | 20,23 | 20,23 | from fastapi import Depends, FastAPI, Header, HTTPException
async def verify_token(x_token: str = Header()):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def verify_key(x_key: str = Header()):
if x_key != "fake-super-secret-key"... | from fastapi import Depends, FastAPI, Header, HTTPException
async def verify_token(x_token: str = Header()):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def verify_key(x_key: str = Header()):
if x_key != "fake-super-secret-key"... | return [{"item": "Portal Gun"}, {"item": "Plumbus"}]
| return [{"item": "Portal Gun"}, {"item": "Plumbus"}]
| 6 | 231 | 26 | 257 | from fastapi import Depends, FastAPI, Header, HTTPException
async def verify_token(x_token: str = Header()):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def verify_key(x_key: str = Header()):
if x_key != "fake-super-secret-key"... | from fastapi import Depends, FastAPI, Header, HTTPException
async def verify_token(x_token: str = Header()):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def verify_key(x_key: str = Header()):
if x_key != "fake-super-secret-key"... | |
25,922 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial012_an.py | 10,11 | 1,27 | verify_key | 11,16 | 11,16 | from fastapi import Depends, FastAPI, Header, HTTPException
from typing_extensions import Annotated
async def verify_token(x_token: Annotated[str, Header()]):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def verify_key(x_key: Annota... | from fastapi import Depends, FastAPI, Header, HTTPException
from typing_extensions import Annotated
async def verify_token(x_token: Annotated[str, Header()]):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def verify_key(x_key: Annota... | if x_key != "fake-super-secret-key":
raise HTTPException(status_code=400, detail="X-Key header invalid")
return x_key
| if x_key != "fake-super-secret-key":
raise HTTPException(status_code=400, detail="X-Key header invalid")
return x_key
| 11 | 225 | 53 | 278 | from fastapi import Depends, FastAPI, Header, HTTPException
from typing_extensions import Annotated
async def verify_token(x_token: Annotated[str, Header()]):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def verify_key(x_key: Annota... | from fastapi import Depends, FastAPI, Header, HTTPException
from typing_extensions import Annotated
async def verify_token(x_token: Annotated[str, Header()]):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def verify_key(x_key: Annota... | |
25,923 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/dependencies/tutorial012_an_py39.py | 24,26 | 1,27 | read_users | 26,27 | 26,27 | from fastapi import Depends, FastAPI, Header, HTTPException
from typing_extensions import Annotated
async def verify_token(x_token: Annotated[str, Header()]):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def verify_key(x_key: Annota... | from fastapi import Depends, FastAPI, Header, HTTPException
from typing_extensions import Annotated
async def verify_token(x_token: Annotated[str, Header()]):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def verify_key(x_key: Annota... | return [{"username": "Rick"}, {"username": "Morty"}]
| return [{"username": "Rick"}, {"username": "Morty"}]
| 5 | 253 | 21 | 274 | from fastapi import Depends, FastAPI, Header, HTTPException
from typing_extensions import Annotated
async def verify_token(x_token: Annotated[str, Header()]):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def verify_key(x_key: Annota... | from fastapi import Depends, FastAPI, Header, HTTPException
from typing_extensions import Annotated
async def verify_token(x_token: Annotated[str, Header()]):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def verify_key(x_key: Annota... | |
25,924 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/encoder/tutorial001.py | 20,22 | 1,24 | update_item | 22,24 | 22,24 | from datetime import datetime
from typing import Union
from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
fake_db = {}
class Item(BaseModel):
title: str
timestamp: datetime
description: Union[str, None] = None
app = FastAPI()
@app.put("/items/{id... | from datetime import datetime
from typing import Union
from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
fake_db = {}
class Item(BaseModel):
title: str
timestamp: datetime
description: Union[str, None] = None
app = FastAPI()
@app.put("/items/{id... | json_compatible_item_data = jsonable_encoder(item)
fake_db[id] = json_compatible_item_data
| json_compatible_item_data = jsonable_encoder(item)
fake_db[id] = json_compatible_item_data
| 6 | 123 | 36 | 159 | from datetime import datetime
from typing import Union
from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
fake_db = {}
class Item(BaseModel):
title: str
timestamp: datetime
description: Union[str, None] = None
app = FastAPI()
@app.put("/items/{id... | from datetime import datetime
from typing import Union
from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
fake_db = {}
class Item(BaseModel):
title: str
timestamp: datetime
description: Union[str, None] = None
app = FastAPI()
@app.put("/items/{id... | |
25,925 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/encoder/tutorial001_py310.py | 19,21 | 1,23 | update_item | 21,23 | 21,23 | from datetime import datetime
from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
fake_db = {}
class Item(BaseModel):
title: str
timestamp: datetime
description: str | None = None
app = FastAPI()
@app.put("/items/{id}")
def update_item(id: str, it... | from datetime import datetime
from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
fake_db = {}
class Item(BaseModel):
title: str
timestamp: datetime
description: str | None = None
app = FastAPI()
@app.put("/items/{id}")
def update_item(id: str, it... | json_compatible_item_data = jsonable_encoder(item)
fake_db[id] = json_compatible_item_data
| json_compatible_item_data = jsonable_encoder(item)
fake_db[id] = json_compatible_item_data
| 6 | 115 | 36 | 151 | from datetime import datetime
from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
fake_db = {}
class Item(BaseModel):
title: str
timestamp: datetime
description: str | None = None
app = FastAPI()
@app.put("/items/{id}")
def update_item(id: str, it... | from datetime import datetime
from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
fake_db = {}
class Item(BaseModel):
title: str
timestamp: datetime
description: str | None = None
app = FastAPI()
@app.put("/items/{id}")
def update_item(id: str, it... | |
25,926 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/events/tutorial001.py | 8,10 | 1,17 | startup_event | 10,14 | 10,14 | from fastapi import FastAPI
app = FastAPI()
items = {}
@app.on_event("startup")
async def startup_event():
FILL_FUNC_BODY@app.get("/items/{item_id}")
async def read_items(item_id: str):
return items[item_id]
| from fastapi import FastAPI
app = FastAPI()
items = {}
@app.on_event("startup")
async def startup_event():
FILL_FUNC_BODY@app.get("/items/{item_id}")
async def read_items(item_id: str):
return items[item_id]
| items["foo"] = {"name": "Fighters"}
items["bar"] = {"name": "Tenders"}
| items["foo"] = {"name": "Fighters"}
items["bar"] = {"name": "Tenders"}
| 8 | 84 | 34 | 118 | from fastapi import FastAPI
app = FastAPI()
items = {}
@app.on_event("startup")
async def startup_event():
FILL_FUNC_BODY@app.get("/items/{item_id}")
async def read_items(item_id: str):
return items[item_id]
| from fastapi import FastAPI
app = FastAPI()
items = {}
@app.on_event("startup")
async def startup_event():
FILL_FUNC_BODY@app.get("/items/{item_id}")
async def read_items(item_id: str):
return items[item_id]
| |
25,927 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/events/tutorial002.py | 6,8 | 1,15 | shutdown_event | 8,12 | 8,12 | from fastapi import FastAPI
app = FastAPI()
@app.on_event("shutdown")
def shutdown_event():
FILL_FUNC_BODY@app.get("/items/")
async def read_items():
return [{"name": "Foo"}]
| from fastapi import FastAPI
app = FastAPI()
@app.on_event("shutdown")
def shutdown_event():
FILL_FUNC_BODY@app.get("/items/")
async def read_items():
return [{"name": "Foo"}]
| with open("log.txt", mode="a") as log:
log.write("Application shutdown")
| with open("log.txt", mode="a") as log:
log.write("Application shutdown")
| 7 | 71 | 32 | 103 | from fastapi import FastAPI
app = FastAPI()
@app.on_event("shutdown")
def shutdown_event():
FILL_FUNC_BODY@app.get("/items/")
async def read_items():
return [{"name": "Foo"}]
| from fastapi import FastAPI
app = FastAPI()
@app.on_event("shutdown")
def shutdown_event():
FILL_FUNC_BODY@app.get("/items/")
async def read_items():
return [{"name": "Foo"}]
| |
25,928 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/events/tutorial003.py | 13,15 | 1,29 | lifespan | 15,22 | 15,22 | from contextlib import asynccontextmanager
from fastapi import FastAPI
def fake_answer_to_everything_ml_model(x: float):
return x * 42
ml_models = {}
@asynccontextmanager
async def lifespan(app: FastAPI):
FILL_FUNC_BODYapp = FastAPI(lifespan=lifespan)
@app.get("/predict")
async def predict(x: float):
r... | from contextlib import asynccontextmanager
from fastapi import FastAPI
def fake_answer_to_everything_ml_model(x: float):
return x * 42
ml_models = {}
@asynccontextmanager
async def lifespan(app: FastAPI):
FILL_FUNC_BODYapp = FastAPI(lifespan=lifespan)
@app.get("/predict")
async def predict(x: float):
r... | # Load the ML model
ml_models["answer_to_everything"] = fake_answer_to_everything_ml_model
yield
# Clean up the ML models and release the resources
ml_models.clear()
| # Load the ML model
ml_models["answer_to_everything"] = fake_answer_to_everything_ml_model
yield
# Clean up the ML models and release the resources
ml_models.clear()
| 20 | 142 | 65 | 207 | from contextlib import asynccontextmanager
from fastapi import FastAPI
def fake_answer_to_everything_ml_model(x: float):
return x * 42
ml_models = {}
@asynccontextmanager
async def lifespan(app: FastAPI):
FILL_FUNC_BODYapp = FastAPI(lifespan=lifespan)
@app.get("/predict")
async def predict(x: float):
r... | from contextlib import asynccontextmanager
from fastapi import FastAPI
def fake_answer_to_everything_ml_model(x: float):
return x * 42
ml_models = {}
@asynccontextmanager
async def lifespan(app: FastAPI):
FILL_FUNC_BODYapp = FastAPI(lifespan=lifespan)
@app.get("/predict")
async def predict(x: float):
r... | |
25,929 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extending_openapi/tutorial001.py | 12,13 | 1,30 | custom_openapi | 13,29 | 13,29 | from fastapi import FastAPI
from fastapi.openapi.utils import get_openapi
app = FastAPI()
@app.get("/items/")
async def read_items():
return [{"name": "Foo"}]
def custom_openapi():
FILL_FUNC_BODYapp.openapi = custom_openapi
| from fastapi import FastAPI
from fastapi.openapi.utils import get_openapi
app = FastAPI()
@app.get("/items/")
async def read_items():
return [{"name": "Foo"}]
def custom_openapi():
FILL_FUNC_BODYapp.openapi = custom_openapi
| if app.openapi_schema:
return app.openapi_schema
openapi_schema = get_openapi(
title="Custom title",
version="2.5.0",
summary="This is a very custom OpenAPI schema",
description="Here's a longer description of the custom **OpenAPI** schema",
routes=app.routes,
... | if app.openapi_schema:
return app.openapi_schema
openapi_schema = get_openapi(
title="Custom title",
version="2.5.0",
summary="This is a very custom OpenAPI schema",
description="Here's a longer description of the custom **OpenAPI** schema",
routes=app.routes,
... | 39 | 87 | 185 | 272 | from fastapi import FastAPI
from fastapi.openapi.utils import get_openapi
app = FastAPI()
@app.get("/items/")
async def read_items():
return [{"name": "Foo"}]
def custom_openapi():
FILL_FUNC_BODYapp.openapi = custom_openapi
| from fastapi import FastAPI
from fastapi.openapi.utils import get_openapi
app = FastAPI()
@app.get("/items/")
async def read_items():
return [{"name": "Foo"}]
def custom_openapi():
FILL_FUNC_BODYapp.openapi = custom_openapi
| |
25,930 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_data_types/tutorial001.py | 10,18 | 1,29 | read_items | 18,29 | 18,29 | from datetime import datetime, time, timedelta
from typing import Union
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: datetime = Body(),
end_datetime: datetime = Body(),
process_after: timedel... | from datetime import datetime, time, timedelta
from typing import Union
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: datetime = Body(),
end_datetime: datetime = Body(),
process_after: timedel... | start_process = start_datetime + process_after
duration = end_datetime - start_process
return {
"item_id": item_id,
"start_datetime": start_datetime,
"end_datetime": end_datetime,
"process_after": process_after,
"repeat_at": repeat_at,
"start_process": start_p... | start_process = start_datetime + process_after
duration = end_datetime - start_process
return {
"item_id": item_id,
"start_datetime": start_datetime,
"end_datetime": end_datetime,
"process_after": process_after,
"repeat_at": repeat_at,
"start_process": start_p... | 27 | 132 | 115 | 247 | from datetime import datetime, time, timedelta
from typing import Union
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: datetime = Body(),
end_datetime: datetime = Body(),
process_after: timedel... | from datetime import datetime, time, timedelta
from typing import Union
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: datetime = Body(),
end_datetime: datetime = Body(),
process_after: timedel... | |
25,931 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_data_types/tutorial001_an.py | 11,19 | 1,30 | read_items | 19,30 | 19,30 | from datetime import datetime, time, timedelta
from typing import Union
from uuid import UUID
from fastapi import Body, FastAPI
from typing_extensions import Annotated
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: Annotated[datetime, Body()],
end_datet... | from datetime import datetime, time, timedelta
from typing import Union
from uuid import UUID
from fastapi import Body, FastAPI
from typing_extensions import Annotated
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: Annotated[datetime, Body()],
end_datet... | start_process = start_datetime + process_after
duration = end_datetime - start_process
return {
"item_id": item_id,
"start_datetime": start_datetime,
"end_datetime": end_datetime,
"process_after": process_after,
"repeat_at": repeat_at,
"start_process": start_p... | start_process = start_datetime + process_after
duration = end_datetime - start_process
return {
"item_id": item_id,
"start_datetime": start_datetime,
"end_datetime": end_datetime,
"process_after": process_after,
"repeat_at": repeat_at,
"start_process": start_p... | 27 | 160 | 115 | 275 | from datetime import datetime, time, timedelta
from typing import Union
from uuid import UUID
from fastapi import Body, FastAPI
from typing_extensions import Annotated
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: Annotated[datetime, Body()],
end_datet... | from datetime import datetime, time, timedelta
from typing import Union
from uuid import UUID
from fastapi import Body, FastAPI
from typing_extensions import Annotated
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: Annotated[datetime, Body()],
end_datet... | |
25,932 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_data_types/tutorial001_an_py310.py | 10,18 | 1,29 | read_items | 18,29 | 18,29 | from datetime import datetime, time, timedelta
from typing import Annotated
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: Annotated[datetime, Body()],
end_datetime: Annotated[datetime, Body()],
... | from datetime import datetime, time, timedelta
from typing import Annotated
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: Annotated[datetime, Body()],
end_datetime: Annotated[datetime, Body()],
... | start_process = start_datetime + process_after
duration = end_datetime - start_process
return {
"item_id": item_id,
"start_datetime": start_datetime,
"end_datetime": end_datetime,
"process_after": process_after,
"repeat_at": repeat_at,
"start_process": start_p... | start_process = start_datetime + process_after
duration = end_datetime - start_process
return {
"item_id": item_id,
"start_datetime": start_datetime,
"end_datetime": end_datetime,
"process_after": process_after,
"repeat_at": repeat_at,
"start_process": start_p... | 27 | 150 | 115 | 265 | from datetime import datetime, time, timedelta
from typing import Annotated
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: Annotated[datetime, Body()],
end_datetime: Annotated[datetime, Body()],
... | from datetime import datetime, time, timedelta
from typing import Annotated
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: Annotated[datetime, Body()],
end_datetime: Annotated[datetime, Body()],
... | |
25,933 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_data_types/tutorial001_an_py39.py | 10,18 | 1,29 | read_items | 18,29 | 18,29 | from datetime import datetime, time, timedelta
from typing import Annotated, Union
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: Annotated[datetime, Body()],
end_datetime: Annotated[datetime, Body... | from datetime import datetime, time, timedelta
from typing import Annotated, Union
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: Annotated[datetime, Body()],
end_datetime: Annotated[datetime, Body... | start_process = start_datetime + process_after
duration = end_datetime - start_process
return {
"item_id": item_id,
"start_datetime": start_datetime,
"end_datetime": end_datetime,
"process_after": process_after,
"repeat_at": repeat_at,
"start_process": start_p... | start_process = start_datetime + process_after
duration = end_datetime - start_process
return {
"item_id": item_id,
"start_datetime": start_datetime,
"end_datetime": end_datetime,
"process_after": process_after,
"repeat_at": repeat_at,
"start_process": start_p... | 27 | 155 | 115 | 270 | from datetime import datetime, time, timedelta
from typing import Annotated, Union
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: Annotated[datetime, Body()],
end_datetime: Annotated[datetime, Body... | from datetime import datetime, time, timedelta
from typing import Annotated, Union
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: Annotated[datetime, Body()],
end_datetime: Annotated[datetime, Body... | |
25,934 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_data_types/tutorial001_py310.py | 9,17 | 1,28 | read_items | 17,28 | 17,28 | from datetime import datetime, time, timedelta
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: datetime = Body(),
end_datetime: datetime = Body(),
process_after: timedelta = Body(),
repeat_a... | from datetime import datetime, time, timedelta
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: datetime = Body(),
end_datetime: datetime = Body(),
process_after: timedelta = Body(),
repeat_a... | start_process = start_datetime + process_after
duration = end_datetime - start_process
return {
"item_id": item_id,
"start_datetime": start_datetime,
"end_datetime": end_datetime,
"process_after": process_after,
"repeat_at": repeat_at,
"start_process": start_p... | start_process = start_datetime + process_after
duration = end_datetime - start_process
return {
"item_id": item_id,
"start_datetime": start_datetime,
"end_datetime": end_datetime,
"process_after": process_after,
"repeat_at": repeat_at,
"start_process": start_p... | 27 | 124 | 115 | 239 | from datetime import datetime, time, timedelta
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: datetime = Body(),
end_datetime: datetime = Body(),
process_after: timedelta = Body(),
repeat_a... | from datetime import datetime, time, timedelta
from uuid import UUID
from fastapi import Body, FastAPI
app = FastAPI()
@app.put("/items/{item_id}")
async def read_items(
item_id: UUID,
start_datetime: datetime = Body(),
end_datetime: datetime = Body(),
process_after: timedelta = Body(),
repeat_a... | |
25,935 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_models/tutorial001.py | 40,42 | 1,44 | create_user | 42,44 | 42,44 | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserIn(BaseModel):
username: str
password: str
email: EmailStr
full_name: Union[str, None] = None
class UserOut(BaseModel):
username: str
email: EmailStr
full_name: Union... | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserIn(BaseModel):
username: str
password: str
email: EmailStr
full_name: Union[str, None] = None
class UserOut(BaseModel):
username: str
email: EmailStr
full_name: Union... | user_saved = fake_save_user(user_in)
return user_saved
| user_saved = fake_save_user(user_in)
return user_saved
| 5 | 305 | 26 | 331 | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserIn(BaseModel):
username: str
password: str
email: EmailStr
full_name: Union[str, None] = None
class UserOut(BaseModel):
username: str
email: EmailStr
full_name: Union... | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserIn(BaseModel):
username: str
password: str
email: EmailStr
full_name: Union[str, None] = None
class UserOut(BaseModel):
username: str
email: EmailStr
full_name: Union... | |
25,936 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_models/tutorial001_py310.py | 38,40 | 1,42 | create_user | 40,42 | 40,42 | from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserIn(BaseModel):
username: str
password: str
email: EmailStr
full_name: str | None = None
class UserOut(BaseModel):
username: str
email: EmailStr
full_name: str | None = None
class UserInDB(Ba... | from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserIn(BaseModel):
username: str
password: str
email: EmailStr
full_name: str | None = None
class UserOut(BaseModel):
username: str
email: EmailStr
full_name: str | None = None
class UserInDB(Ba... | user_saved = fake_save_user(user_in)
return user_saved
| user_saved = fake_save_user(user_in)
return user_saved
| 5 | 290 | 26 | 316 | from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserIn(BaseModel):
username: str
password: str
email: EmailStr
full_name: str | None = None
class UserOut(BaseModel):
username: str
email: EmailStr
full_name: str | None = None
class UserInDB(Ba... | from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserIn(BaseModel):
username: str
password: str
email: EmailStr
full_name: str | None = None
class UserOut(BaseModel):
username: str
email: EmailStr
full_name: str | None = None
class UserInDB(Ba... | |
25,937 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_models/tutorial002.py | 38,40 | 1,42 | create_user | 40,42 | 40,42 | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserBase(BaseModel):
username: str
email: EmailStr
full_name: Union[str, None] = None
class UserIn(UserBase):
password: str
class UserOut(UserBase):
pass
class UserInDB(UserB... | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserBase(BaseModel):
username: str
email: EmailStr
full_name: Union[str, None] = None
class UserIn(UserBase):
password: str
class UserOut(UserBase):
pass
class UserInDB(UserB... | user_saved = fake_save_user(user_in)
return user_saved
| user_saved = fake_save_user(user_in)
return user_saved
| 5 | 268 | 26 | 294 | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserBase(BaseModel):
username: str
email: EmailStr
full_name: Union[str, None] = None
class UserIn(UserBase):
password: str
class UserOut(UserBase):
pass
class UserInDB(UserB... | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserBase(BaseModel):
username: str
email: EmailStr
full_name: Union[str, None] = None
class UserIn(UserBase):
password: str
class UserOut(UserBase):
pass
class UserInDB(UserB... | |
25,938 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_models/tutorial002_py310.py | 29,30 | 1,40 | fake_save_user | 30,36 | 30,36 | from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserBase(BaseModel):
username: str
email: EmailStr
full_name: str | None = None
class UserIn(UserBase):
password: str
class UserOut(UserBase):
pass
class UserInDB(UserBase):
hashed_password: str
... | from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserBase(BaseModel):
username: str
email: EmailStr
full_name: str | None = None
class UserIn(UserBase):
password: str
class UserOut(UserBase):
pass
class UserInDB(UserBase):
hashed_password: str
... | hashed_password = fake_password_hasher(user_in.password)
user_in_db = UserInDB(**user_in.dict(), hashed_password=hashed_password)
print("User saved! ..not really")
return user_in_db
| hashed_password = fake_password_hasher(user_in.password)
user_in_db = UserInDB(**user_in.dict(), hashed_password=hashed_password)
print("User saved! ..not really")
return user_in_db
| 13 | 213 | 76 | 289 | from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserBase(BaseModel):
username: str
email: EmailStr
full_name: str | None = None
class UserIn(UserBase):
password: str
class UserOut(UserBase):
pass
class UserInDB(UserBase):
hashed_password: str
... | from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserBase(BaseModel):
username: str
email: EmailStr
full_name: str | None = None
class UserIn(UserBase):
password: str
class UserOut(UserBase):
pass
class UserInDB(UserBase):
hashed_password: str
... | |
25,939 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_models/tutorial003.py | 33,35 | 1,36 | read_item | 35,36 | 35,36 | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class BaseItem(BaseModel):
description: str
type: str
class CarItem(BaseItem):
type: str = "car"
class PlaneItem(BaseItem):
type: str = "plane"
size: int
items = {
"item1": {"description... | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class BaseItem(BaseModel):
description: str
type: str
class CarItem(BaseItem):
type: str = "car"
class PlaneItem(BaseItem):
type: str = "plane"
size: int
items = {
"item1": {"description... | return items[item_id]
| return items[item_id]
| 2 | 224 | 10 | 234 | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class BaseItem(BaseModel):
description: str
type: str
class CarItem(BaseItem):
type: str = "car"
class PlaneItem(BaseItem):
type: str = "plane"
size: int
items = {
"item1": {"description... | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class BaseItem(BaseModel):
description: str
type: str
class CarItem(BaseItem):
type: str = "car"
class PlaneItem(BaseItem):
type: str = "plane"
size: int
items = {
"item1": {"description... | |
25,940 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_models/tutorial003_py310.py | 33,35 | 1,36 | read_item | 35,36 | 35,36 | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class BaseItem(BaseModel):
description: str
type: str
class CarItem(BaseItem):
type: str = "car"
class PlaneItem(BaseItem):
type: str = "plane"
size: int
items = {
"item1": {"description... | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class BaseItem(BaseModel):
description: str
type: str
class CarItem(BaseItem):
type: str = "car"
class PlaneItem(BaseItem):
type: str = "plane"
size: int
items = {
"item1": {"description... | return items[item_id]
| return items[item_id]
| 2 | 224 | 10 | 234 | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class BaseItem(BaseModel):
description: str
type: str
class CarItem(BaseItem):
type: str = "car"
class PlaneItem(BaseItem):
type: str = "plane"
size: int
items = {
"item1": {"description... | from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class BaseItem(BaseModel):
description: str
type: str
class CarItem(BaseItem):
type: str = "car"
class PlaneItem(BaseItem):
type: str = "plane"
size: int
items = {
"item1": {"description... | |
25,941 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_models/tutorial004.py | 20,22 | 1,23 | read_items | 22,23 | 22,23 | from typing import List
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str
items = [
{"name": "Foo", "description": "There comes my hero"},
{"name": "Red", "description": "It's my aeroplane"},
]
@app.get("/items/", respons... | from typing import List
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str
items = [
{"name": "Foo", "description": "There comes my hero"},
{"name": "Red", "description": "It's my aeroplane"},
]
@app.get("/items/", respons... | return items
| return items
| 2 | 129 | 5 | 134 | from typing import List
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str
items = [
{"name": "Foo", "description": "There comes my hero"},
{"name": "Red", "description": "It's my aeroplane"},
]
@app.get("/items/", respons... | from typing import List
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str
items = [
{"name": "Foo", "description": "There comes my hero"},
{"name": "Red", "description": "It's my aeroplane"},
]
@app.get("/items/", respons... | |
25,942 | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi | /home/hieuvd/dung_repo/raw/stars_01/tiangolo_fastapi/fastapi/docs_src/extra_models/tutorial004_py39.py | 18,20 | 1,21 | read_items | 20,21 | 20,21 | from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str
items = [
{"name": "Foo", "description": "There comes my hero"},
{"name": "Red", "description": "It's my aeroplane"},
]
@app.get("/items/", response_model=list[Item])
async... | from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str
items = [
{"name": "Foo", "description": "There comes my hero"},
{"name": "Red", "description": "It's my aeroplane"},
]
@app.get("/items/", response_model=list[Item])
async... | return items
| return items
| 2 | 123 | 5 | 128 | from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str
items = [
{"name": "Foo", "description": "There comes my hero"},
{"name": "Red", "description": "It's my aeroplane"},
]
@app.get("/items/", response_model=list[Item])
async... | from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str
items = [
{"name": "Foo", "description": "There comes my hero"},
{"name": "Red", "description": "It's my aeroplane"},
]
@app.get("/items/", response_model=list[Item])
async... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.