parameters: (handler, name, spec_dict, resource_dir)
return_statement: return d
docstring: Load a KernelSpec by name and return the REST API model
docstring_summary: Load a KernelSpec by name and return the REST API model
docstring_tokens: Load a KernelSpec by name and return the REST API model
function: def kernelspec_model(handler, name, spec_dict, resource_dir):
      """Load a KernelSpec by name and return the REST API model"""
      d = {
          'name': name,
          'spec': spec_dict,
          'resources': {}
      }
  
      # Add resource files if they exist
      for resource in ['kernel.js', 'kernel.css']:
          if os.path.exists(pjoin(resource_dir, resource)):
              d['resources'][resource] = url_path_join(
                  handler.base_url,
                  'kernelspecs',
                  name,
                  resource
              )
      for logo_file in glob.glob(pjoin(resource_dir, 'logo-*')):
          fname = os.path.basename(logo_file)
          no_ext, _ = os.path.splitext(fname)
          d['resources'][no_ext] = url_path_join(
              handler.base_url,
              'kernelspecs',
              name,
              fname
          )
      return d
function_tokens: def kernelspec_model ( handler , name , spec_dict , resource_dir ) : d = { 'name' : name , 'spec' : spec_dict , 'resources' : { } } # Add resource files if they exist for resource in [ 'kernel.js' , 'kernel.css' ] : if os . path . exists ( pjoin ( resource_dir , resource ) ) : d [ 'resources' ] [ resource ] = url_path_join ( handler . base_url , 'kernelspecs' , name , resource ) for logo_file in glob . glob ( pjoin ( resource_dir , 'logo-*' ) ) : fname = os . path . basename ( logo_file ) no_ext , _ = os . path . splitext ( fname ) d [ 'resources' ] [ no_ext ] = url_path_join ( handler . base_url , 'kernelspecs' , name , fname ) return d