Coverage for docs_src/parameter_types/number/tutorial002_an.py: 100%
8 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-12-19 20:29 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-12-19 20:29 +0000
1import typer 1abcdefghi
2from typing_extensions import Annotated 1abcdefghi
4app = typer.Typer() 1abcdefghi
7@app.command() 1abcdefghi
8def main( 1abcdefghi
9 id: Annotated[int, typer.Argument(min=0, max=1000)],
10 rank: Annotated[int, typer.Option(max=10, clamp=True)] = 0,
11 score: Annotated[float, typer.Option(min=0, max=100, clamp=True)] = 0,
12):
13 print(f"ID is {id}") 1abcdefghi
14 print(f"--rank is {rank}") 1abcdefghi
15 print(f"--score is {score}") 1abcdefghi
18if __name__ == "__main__": 1abcdefghi
19 app() 1abcdefghi