Coverage for docs_src/parameter_types/datetime/tutorial002_an.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-12-19 20:29 +0000

1from datetime import datetime 1abcdefghi

2 

3import typer 1abcdefghi

4from typing_extensions import Annotated 1abcdefghi

5 

6app = typer.Typer() 1abcdefghi

7 

8 

9@app.command() 1abcdefghi

10def main( 1abcdefghi

11 launch_date: Annotated[ 

12 datetime, 

13 typer.Argument( 

14 formats=["%Y-%m-%d", "%Y-%m-%dT%H:%M:%S", "%Y-%m-%d %H:%M:%S", "%m/%d/%Y"] 

15 ), 

16 ], 

17): 

18 print(f"Launch will be at: {launch_date}") 1abcdefghi

19 

20 

21if __name__ == "__main__": 1abcdefghi

22 app() 1abcdefghi