77from copy import deepcopy
88from io import BytesIO
99
10- from jsonschema import Draft4Validator , draft4_format_checker
10+ from jsonschema import Draft4Validator
1111from jsonschema .exceptions import ValidationError as JsonSchemaError
1212
1313from ...exceptions import ValidationError
1414from ...schema import DEFAULT_FILE_MODE
1515from ...utils import evaluate_vars , merge_config
1616
17+ format_checker = Draft4Validator .FORMAT_CHECKER
1718_host_name_re = re .compile (r"^[A-Za-z0-9][A-Za-z0-9\.\-]{1,255}$" )
1819
1920
@@ -126,15 +127,15 @@ def _deduplicate_files(self):
126127 files_dict [file ['path' ]] = file
127128 self .config ['files' ] = list (files_dict .values ())
128129
129- @draft4_format_checker .checks ('cidr' , AssertionError )
130+ @format_checker .checks ('cidr' , AssertionError )
130131 def _cidr_notation (value ):
131132 try :
132133 ipaddress .ip_network (value )
133134 except ValueError as e :
134135 assert False , str (e )
135136 return True
136137
137- @draft4_format_checker .checks ('hostname' , JsonSchemaError )
138+ @format_checker .checks ('hostname' , JsonSchemaError )
138139 def _is_hostname (value ):
139140 """
140141 The hostname validation has been taken from jsonschema~=3.2.0
@@ -154,7 +155,7 @@ def _is_hostname(value):
154155
155156 def validate (self ):
156157 try :
157- Draft4Validator (self .schema , format_checker = draft4_format_checker ).validate (
158+ Draft4Validator (self .schema , format_checker = format_checker ).validate (
158159 self .config
159160 )
160161 except JsonSchemaError as e :
0 commit comments