Return the value which corresponds to the value. Parameters ----------- value: :class:`int` The value of the enum member to get. Returns ------- :class:`Enum` The corresponding member or a new instance of the enum if
(cls, value: int = 0)
| 164 | |
| 165 | @classmethod |
| 166 | def try_value(cls, value: int = 0) -> Self: |
| 167 | """Return the value which corresponds to the value. |
| 168 | |
| 169 | Parameters |
| 170 | ----------- |
| 171 | value: :class:`int` |
| 172 | The value of the enum member to get. |
| 173 | |
| 174 | Returns |
| 175 | ------- |
| 176 | :class:`Enum` |
| 177 | The corresponding member or a new instance of the enum if |
| 178 | ``value`` isn't actually a member. |
| 179 | """ |
| 180 | try: |
| 181 | return cls._value_map_[value] |
| 182 | except (KeyError, TypeError): |
| 183 | return cls.__new__(cls, name=None, value=value) |
| 184 | |
| 185 | @classmethod |
| 186 | def from_string(cls, name: str) -> Self: |