# tf.compat.v1.flags.EnumParser

<br />

Parser of a string enum value (a string value from a given set).

Inherits From: [`ArgumentParser`](https://www.tensorflow.org/versions/r2.1/api_docs/python/tf/compat/v1/flags/ArgumentParser)

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.app.flags.EnumParser`](https://www.tensorflow.org/api_docs/python/tf/compat/v1/flags/EnumParser)

<br />

    tf.compat.v1.flags.EnumParser(
        enum_values, case_sensitive=True
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `enum_values` | \[str\], a non-empty list of string values in the enum. |
| `case_sensitive` | bool, whether or not the enum is to be case-sensitive. |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | When enum_values is empty. |

<br />

## Methods

### `flag_type`

    flag_type()

See base class.

### `parse`

    parse(
        argument
    )

Determines validity of argument and returns the correct element of enum.

<br />

<br />

<br />

| Args ||
|---|---|
| `argument` | str, the supplied flag value. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| The first matching element from enum_values. ||

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | Raised when argument didn't match anything in enum. |

<br />

## Class Variables

- `syntactic_help = ''`