Like _idval_from_value(), but fails if the type is not supported.
(self, val: object, idx: int)
| 1055 | return None |
| 1056 | |
| 1057 | def _idval_from_value_required(self, val: object, idx: int) -> str: |
| 1058 | """Like _idval_from_value(), but fails if the type is not supported.""" |
| 1059 | id = self._idval_from_value(val) |
| 1060 | if id is not None: |
| 1061 | return id |
| 1062 | |
| 1063 | # Fail. |
| 1064 | prefix = self._make_error_prefix() |
| 1065 | msg = ( |
| 1066 | f"{prefix}ids contains unsupported value {saferepr(val)} (type: {type(val)!r}) at index {idx}. " |
| 1067 | "Supported types are: str, bytes, int, float, complex, bool, enum, regex or anything with a __name__." |
| 1068 | ) |
| 1069 | fail(msg, pytrace=False) |
| 1070 | |
| 1071 | @staticmethod |
| 1072 | def _idval_from_argname(argname: str, idx: int) -> str: |
no test coverage detected