"""In general, users should expect :obj:`validate_pyproject.errors.ValidationError`from :obj:`validate_pyproject.api.Validator.__call__`.Note that ``validate-pyproject`` derives most of its exceptions from:mod:`fastjsonschema`, so it might make sense to also have a look on:obj:`fastjsonschema.JsonSchemaException`,:obj:`fastjsonschema.JsonSchemaValueException` and:obj:`fastjsonschema.JsonSchemaDefinitionException`.)"""fromtextwrapimportdedentfromfastjsonschemaimport(JsonSchemaDefinitionExceptionas_JsonSchemaDefinitionException,)from.error_reportingimportValidationErrorclassURLMissingTool(RuntimeError):_DESC="""\ The '--tool' option requires a tool name. Correct form is '--tool <tool-name>={url}', with an optional '#json/pointer' at the end. """__doc__=_DESCdef__init__(self,url:str):msg=dedent(self._DESC).strip()msg=msg.format(url=url)super().__init__(msg)
[docs]classInvalidSchemaVersion(_JsonSchemaDefinitionException):_DESC="""\ All schemas used in the validator should be specified using the same version \ as the toplevel schema ({version!r}). Schema for {name!r} has version {given!r}. """__doc__=_DESCdef__init__(self,name:str,given_version:str,required_version:str):msg=dedent(self._DESC).strip()msg=msg.format(name=name,version=required_version,given=given_version)super().__init__(msg)
[docs]classSchemaMissingId(_JsonSchemaDefinitionException):_DESC="""\ All schemas used in the validator MUST define a unique toplevel `"$id"`. No `"$id"` was found for schema associated with {reference!r}. """__doc__=_DESCdef__init__(self,reference:str):msg=dedent(self._DESC).strip()super().__init__(msg.format(reference=reference))
[docs]classSchemaWithDuplicatedId(_JsonSchemaDefinitionException):_DESC="""\ All schemas used in the validator MUST define a unique toplevel `"$id"`. `$id = {schema_id!r}` was found at least twice. """__doc__=_DESCdef__init__(self,schema_id:str):msg=dedent(self._DESC).strip()super().__init__(msg.format(schema_id=schema_id))