Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _factory(definition, handlers, formats={}):
resolver = RefResolver.from_schema(definition, handlers=handlers)
code_generator = _get_code_generator_class(definition)(definition, resolver=resolver, formats=formats)
return resolver, code_generator
self._variables = set()
self._indent = 0
self._indent_last_line = None
self._variable = None
self._variable_name = None
self._root_definition = definition
self._definition = None
# map schema URIs to validation function names for functions
# that are not yet generated, but need to be generated
self._needed_validation_functions = {}
# validation function names that are already done
self._validation_functions_done = set()
if resolver is None:
resolver = RefResolver.from_schema(definition)
self._resolver = resolver
# add main function to `self._needed_validation_functions`
self._needed_validation_functions[self._resolver.get_uri()] = self._resolver.get_scope_name()
self._json_keywords_to_function = OrderedDict()