(handler, name, spec_dict, resource_dir)
return d
Load a KernelSpec by name and return the REST API model
Load a KernelSpec by name and return the REST API model
Load a KernelSpec by name and return the REST API model
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
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