File tree Expand file tree Collapse file tree 3 files changed +8
-12
lines changed Expand file tree Collapse file tree 3 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -55,14 +55,6 @@ def load_schema(name):
5555 return json .loads (data .decode ("utf-8" ))
5656
5757
58- def indent (string , times = 1 ):
59- """
60- A dumb version of `textwrap.indent` from Python 3.3.
61- """
62-
63- return "\n " .join (" " * (4 * times ) + line for line in string .splitlines ())
64-
65-
6658def format_as_index (indices ):
6759 """
6860 Construct a single string containing indexing operations for the indices.
Original file line number Diff line number Diff line change @@ -80,10 +80,10 @@ def __str__(self):
8080 self .validator ,
8181 self ._word_for_schema_in_error_message ,
8282 _utils .format_as_index (list (self .relative_schema_path )[:- 1 ]),
83- _utils .indent (pschema ),
83+ textwrap .indent (pschema , " " ),
8484 self ._word_for_instance_in_error_message ,
8585 _utils .format_as_index (self .relative_path ),
86- _utils .indent (pinstance ),
86+ textwrap .indent (pinstance , " " ),
8787 )
8888
8989 @classmethod
@@ -195,7 +195,11 @@ def __str__(self):
195195 While checking instance:
196196 %s
197197 """ .rstrip ()
198- ) % (self .type , _utils .indent (pschema ), _utils .indent (pinstance ))
198+ ) % (
199+ self .type ,
200+ textwrap .indent (pschema , " " ),
201+ textwrap .indent (pinstance , " " ),
202+ )
199203
200204
201205class FormatError (Exception ):
Original file line number Diff line number Diff line change 1010
1111from jsonschema import ValidationError , _validators
1212from jsonschema ._types import TypeChecker
13- from jsonschema .exceptions import UndefinedTypeCheck
13+ from jsonschema .exceptions import UndefinedTypeCheck , UnknownType
1414from jsonschema .validators import Draft4Validator , extend
1515
1616
You can’t perform that action at this time.
0 commit comments