qrunch.common.misc

Miscellaneous common utility functions.

Functions

to_enum(value, enum)

Coerce literal to the specified enum type.

to_enum(value: str | T, enum: type[T]) → T

Coerce literal to the specified enum type.

Parameters:
  • value (str | T) – Either an enum member, its underlying value string, or its member name.

  • enum (type[T]) – The enum type to coerce the value into.

Return type:

T