Skip to content

Commit 300b095

Browse files
authored
Merge pull request #1022 from DanielNoord/error-str
Add annotations for `_Error`
2 parents c16cced + dfb65eb commit 300b095

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

jsonschema/exceptions.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from collections import defaultdict, deque
77
from pprint import pformat
88
from textwrap import dedent, indent
9+
from typing import ClassVar
910
import heapq
1011
import itertools
1112

@@ -20,9 +21,13 @@
2021

2122

2223
class _Error(Exception):
24+
25+
_word_for_schema_in_error_message: ClassVar[str]
26+
_word_for_instance_in_error_message: ClassVar[str]
27+
2328
def __init__(
2429
self,
25-
message,
30+
message: str,
2631
validator=_unset,
2732
path=(),
2833
cause=None,
@@ -328,6 +333,7 @@ def by_relevance(weak=WEAK_MATCHES, strong=STRONG_MATCHES):
328333
a collection of validation keywords to consider to be
329334
"strong"
330335
"""
336+
331337
def relevance(error):
332338
validator = error.validator
333339
return (
@@ -336,6 +342,7 @@ def relevance(error):
336342
validator in strong,
337343
not error._matches_type(),
338344
)
345+
339346
return relevance
340347

341348

0 commit comments

Comments
 (0)