Coverage for docs_src/extra_data_types/tutorial001_an_py310.py: 100%
10 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
1from datetime import datetime, time, timedelta 1abc
2from typing import Annotated 1abc
3from uuid import UUID 1abc
5from fastapi import Body, FastAPI 1abc
7app = FastAPI() 1abc
10@app.put("/items/{item_id}") 1abc
11async def read_items( 1abc
12 item_id: UUID,
13 start_datetime: Annotated[datetime, Body()],
14 end_datetime: Annotated[datetime, Body()],
15 process_after: Annotated[timedelta, Body()],
16 repeat_at: Annotated[time | None, Body()] = None,
17):
18 start_process = start_datetime + process_after 1abc
19 duration = end_datetime - start_process 1abc
20 return { 1abc
21 "item_id": item_id,
22 "start_datetime": start_datetime,
23 "end_datetime": end_datetime,
24 "process_after": process_after,
25 "repeat_at": repeat_at,
26 "start_process": start_process,
27 "duration": duration,
28 }