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

11 statements  

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

1from enum import Enum 1abcdefgh

2from typing import Annotated 1abcdefgh

3 

4import typer 1abcdefgh

5 

6 

7class NeuralNetwork(str, Enum): 1abcdefgh

8 simple = "simple" 1abcdefgh

9 conv = "conv" 1abcdefgh

10 lstm = "lstm" 1abcdefgh

11 

12 

13app = typer.Typer() 1abcdefgh

14 

15 

16@app.command() 1abcdefgh

17def main( 1abcdefgh

18 network: Annotated[ 

19 NeuralNetwork, typer.Option(case_sensitive=False) 

20 ] = NeuralNetwork.simple, 

21): 

22 print(f"Training neural network of type: {network.value}") 1abcdefgh

23 

24 

25if __name__ == "__main__": 1abcdefgh

26 app() 1abcdefgh