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

11 statements  

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

1from enum import StrEnum 1abcdefghij

2from typing import Annotated 1abcdefghij

3 

4import typer 1abcdefghij

5 

6 

7class NeuralNetwork(StrEnum): 1abcdefghij

8 simple = "simple" 1abcdefghij

9 conv = "conv" 1abcdefghij

10 lstm = "lstm" 1abcdefghij

11 

12 

13app = typer.Typer() 1abcdefghij

14 

15 

16@app.command() 1abcdefghij

17def main( 1abcdefghij

18 network: Annotated[ 

19 NeuralNetwork, typer.Option(case_sensitive=False) 

20 ] = NeuralNetwork.simple, 

21): 

22 print(f"Training neural network of type: {network}") 1abcdefghij

23 

24 

25if __name__ == "__main__": 1abcdefghij

26 app() 1abcdefghij