def expecting_but_found(self, expecting, found=None): raise YAMLValidationError( expecting, found if found is not None else "found {0}".format(self.found()), self, )
def validate_scalar(self, chunk: YAMLChunk) -> typing.List[int]: match = self.REGEX.fullmatch(chunk.contents) if match is None: raise YAMLValidationError(self._matching_message, "found non-matching string", chunk) return [int(group) for group in match.group(1, 2, 3)]