validate_enum_arg

tfsnippet.utils.validate_enum_arg(arg_name, arg_value, choices, nullable=False)

Validate the value of a enumeration argument.

Parameters:
  • arg_name – Name of the argument.
  • arg_value – Value of the argument.
  • choices – Valid choices of the argument value.
  • nullable – Whether or not the argument can be None?
Returns:

The validated argument value.

Raises:

ValueError – If arg_value is not valid.