Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_code_generator_class(schema):
# Schema in from draft-06 can be just the boolean value.
if isinstance(schema, dict):
schema_version = schema.get('$schema', '')
if 'draft-04' in schema_version:
return CodeGeneratorDraft04
if 'draft-06' in schema_version:
return CodeGeneratorDraft06
return CodeGeneratorDraft07