original_docstring: Generate a schema wrapper at the given path.
docstring: Generate a schema wrapper at the given path.
docstring_tokens: Generate a schema wrapper at the given path .
code: def generate_vega_schema_wrapper(schema_file):
      """Generate a schema wrapper at the given path."""
      # TODO: generate simple tests for each wrapper
      basename = 'VegaSchema'
  
      with open(schema_file, encoding='utf8') as f:
          rootschema = json.load(f)
      contents = [HEADER,
                  "from altair.utils.schemapi import SchemaBase, Undefined",
                  LOAD_SCHEMA.format(schemafile='vega-schema.json')]
      contents.append(BASE_SCHEMA.format(basename=basename))
      contents.append(schema_class('Root', schema=rootschema, basename=basename,
                                   schemarepr=CodeSnippet('load_schema()')))
      for deflist in ['defs', 'refs']:
          for name in rootschema[deflist]:
              defschema = {'$ref': '#/{0}/{1}'.format(deflist, name)}
              defschema_repr = {'$ref': '#/{0}/{1}'.format(deflist,name)}
              contents.append(schema_class(get_valid_identifier(name),
                                           schema=defschema, schemarepr=defschema_repr,
                                           rootschema=rootschema, basename=basename,
                                           rootschemarepr=CodeSnippet("Root._schema")))
      contents.append('')  # end with newline
      return '\n'.join(contents)
code_tokens: def generate_vega_schema_wrapper ( schema_file ) : basename = 'VegaSchema' with open ( schema_file , encoding = 'utf8' ) as f : rootschema = json . load ( f ) contents = [ HEADER , "from altair.utils.schemapi import SchemaBase, Undefined" , LOAD_SCHEMA . format ( schemafile = 'vega-schema.json' ) ] contents . append ( BASE_SCHEMA . format ( basename = basename ) ) contents . append ( schema_class ( 'Root' , schema = rootschema , basename = basename , schemarepr = CodeSnippet ( 'load_schema()' ) ) ) for deflist in [ 'defs' , 'refs' ] : for name in rootschema [ deflist ] : defschema = { '$ref' : '#/{0}/{1}' . format ( deflist , name ) } defschema_repr = { '$ref' : '#/{0}/{1}' . format ( deflist , name ) } contents . append ( schema_class ( get_valid_identifier ( name ) , schema = defschema , schemarepr = defschema_repr , rootschema = rootschema , basename = basename , rootschemarepr = CodeSnippet ( "Root._schema" ) ) ) contents . append ( '' ) return '\n' . join ( contents )
short_docstring: Generate a schema wrapper at the given path.
short_docstring_tokens: Generate a schema wrapper at the given path .
comment: """Generate a schema wrapper at the given path."""$SEP$# TODO: generate simple tests for each wrapper$SEP$# end with newline