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

8 statements  

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

1from pathlib import Path 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 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() 1abcdefgh

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

25 

26 

27if __name__ == "__main__": 1abcdefgh

28 app() 1abcdefgh