MCPcopy Index your code
hub / github.com/chidiwilliams/buzz / parse_enum_option

Function parse_enum_option

buzz/cli.py:243–249  ·  view source on GitHub ↗
(
    option: QCommandLineOption, parser: QCommandLineParser, enum_class: typing.Type[T]
)

Source from the content-addressed store, hash-verified

241
242
243def parse_enum_option(
244 option: QCommandLineOption, parser: QCommandLineParser, enum_class: typing.Type[T]
245) -> T:
246 try:
247 return enum_class(parser.value(option))
248 except ValueError:
249 raise CommandLineError(f"Invalid value for --{option.names()[-1]} option.")
250
251
252def join_values(enum_class: typing.Type[enum.Enum]) -> str:

Callers 1

parseFunction · 0.85

Calls 2

CommandLineErrorClass · 0.85
valueMethod · 0.80

Tested by

no test coverage detected