-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_80.py
More file actions
39 lines (27 loc) · 796 Bytes
/
Copy pathexample_80.py
File metadata and controls
39 lines (27 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from enum import Enum
import typer
from typing_extensions import Annotated
"""See https://typer.tiangolo.com/tutorial/parameter-types/enum/"""
"""
CLI options - Enum Choices
Case Sensitive
You can make an `Enum` (choice) CLI parameter case-insensitive with the
`case_sensitive` parameter
"""
class NeuralNetwork(str, Enum):
simple = "simple"
conv = "conv"
lstm = "lstm"
def main(
network: Annotated[
NeuralNetwork, typer.Option(case_sensitive=False)
] = NeuralNetwork.simple,
):
"""
These Enum values are now case insensitive. Hence these both work:
python example_80.py --network CONV
python example_80.py --network LsTm
"""
print(f"Training neural network of type: {network.value}")
if __name__ == "__main__":
typer.run(main)