Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from .draft04 import CodeGeneratorDraft04, JSON_TYPE_TO_PYTHON_TYPE
from .exceptions import JsonSchemaDefinitionException
from .generator import enforce_list
class CodeGeneratorDraft06(CodeGeneratorDraft04):
FORMAT_REGEXS = dict(CodeGeneratorDraft04.FORMAT_REGEXS, **{
'json-pointer': r'^(/(([^/~])|(~[01]))*)*\Z',
'uri-reference': r'^(\w+:(\/?\/?))?[^#\\\s]*(#[^\\\s]*)?\Z',
'uri-template': (
r'^(?:(?:[^\x00-\x20\"\'<>%\\^`{|}]|%[0-9a-f]{2})|'
r'\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+'
r'(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+'
r'(?::[1-9][0-9]{0,3}|\*)?)*\})*\Z'
),
})
def __init__(self, definition, resolver=None, formats={}):
super().__init__(definition, resolver, formats)
self._json_keywords_to_function.update((
('exclusiveMinimum', self.generate_exclusive_minimum),
('exclusiveMaximum', self.generate_exclusive_maximum),
('propertyNames', self.generate_property_names),