Coverage for docs_src / dependencies / tutorial001_02_an_py310.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-04-06 01:24 +0000

1from typing import Annotated 1abcdefg

2 

3from fastapi import Depends, FastAPI 1abcdefg

4 

5app = FastAPI() 1abcdefg

6 

7 

8async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100): 1abcdefg

9 return {"q": q, "skip": skip, "limit": limit} 1hijklmnopqrstuvwx

10 

11 

12CommonsDep = Annotated[dict, Depends(common_parameters)] 1abcdefg

13 

14 

15@app.get("/items/") 1abcdefg

16async def read_items(commons: CommonsDep): 1abcdefg

17 return commons 1hijkmnopqrtuvw

18 

19 

20@app.get("/users/") 1abcdefg

21async def read_users(commons: CommonsDep): 1abcdefg

22 return commons 1lysx