Coverage for docs_src / parameter_types / path / tutorial002_an_py310.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-03-26 21:46 +0000

1from pathlib import Path 1abcdefg

2from typing import Annotated 1abcdefg

3 

4import typer 1abcdefg

5 

6app = typer.Typer() 1abcdefg

7 

8 

9@app.command() 1abcdefg

10def main( 1abcdefg

11 config: Annotated[ 

12 Path, 

13 typer.Option( 

14 exists=True, 

15 file_okay=True, 

16 dir_okay=False, 

17 writable=False, 

18 readable=True, 

19 resolve_path=True, 

20 ), 

21 ], 

22): 

23 text = config.read_text() 1abcdefg

24 print(f"Config file contents: {text}") 1abcdefg

25 

26 

27if __name__ == "__main__": 1abcdefg

28 app() 1abcdefg