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

7 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-02-09 12:36 +0000

1from datetime import datetime 1abcdefgh

2from typing import Annotated 1abcdefgh

3 

4import typer 1abcdefgh

5 

6app = typer.Typer() 1abcdefgh

7 

8 

9@app.command() 1abcdefgh

10def main( 1abcdefgh

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}") 1abcdefgh

19 

20 

21if __name__ == "__main__": 1abcdefgh

22 app() 1abcdefgh