Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeBase64EncodedPng(s string) (image.Image, error)
- func DupBytes(src []byte) []byte
- func LoadSchema(schema []byte) (*jsonschema.Schema, error)
- func LoadSchemaFromFile(filePath string) (*jsonschema.Schema, error)
- func PassesNBConvert(nbPath, jupyterConvertPath string) (string, bool)
- func PathRelativeToTest(t *testing.T, relPath ...string) string
- func ProduceNotebookPaths(ctx context.Context, rootDir string, bufSize int) <-chan string
- func TempDir(t *testing.T) (string, func())
- type Cell
- type KernelSpec
- type LanguageInfo
- type MetaData
- type Notebook
- type Options
- type Output
- type StringMap
Constants ¶
View Source
const ( CellTypeMarkdown = "markdown" CellTypeRaw = "raw" CellTypeCode = "code" )
View Source
const OutputTypeDisplayData = "display_data"
View Source
const OutputTypeError = "error"
View Source
const OutputTypeExecuteResult = "execute_result"
View Source
const OutputTypeStream = "stream"
View Source
const V4 = 4
Variables ¶
View Source
var DefaultOpts = &Options{ ValidateAgainst: nil, Version: V4, }
View Source
var ErrMissingCellsKey = errors.New("missing `cells` key")
View Source
var KeyNotFound = errors.New("key not found")
Functions ¶
func LoadSchema ¶
func LoadSchema(schema []byte) (*jsonschema.Schema, error)
func LoadSchemaFromFile ¶
func LoadSchemaFromFile(filePath string) (*jsonschema.Schema, error)
func PassesNBConvert ¶
func ProduceNotebookPaths ¶
I wrote this to analyze a large collection of Jupyter notebooks cloned from github as repositories.
Types ¶
type Cell ¶
type Cell struct { Type string `json:"cell_type"` // MUST BE integer or null in JSON. // Renamed from 'prompt_number' in 4.0; TODO: Test ExecutionCount int `json:"execution_count"` // Renamed from `input` in nbformat: 4.0; TODO: Test Source []string `json:"source"` Outputs []Output `json:"outputs"` MetaData StringMap `json:"metadata"` Raw []byte `json:"-"` }
func (*Cell) UnmarshalJSON ¶
type KernelSpec ¶
type LanguageInfo ¶
type MetaData ¶
type MetaData struct { LanguageInfo KernelSpec Extra StringMap Raw []byte `json:"-"` }
func (*MetaData) UnmarshalJSON ¶
type Notebook ¶
type Notebook struct { VersionMajor int `json:"nbformat"` VersionMinor int `json:"minor"` MetaData MetaData `json:"metadata"` Cells []Cell `json:"cells"` Raw []byte `json:"-"` }
TODO: Do any notebooks put any other keys at the top level?
func (*Notebook) ClearAllRaw ¶
func (nb *Notebook) ClearAllRaw()
func (*Notebook) ClearRawCells ¶
func (nb *Notebook) ClearRawCells()
type Options ¶
type Options struct { ValidateAgainst *jsonschema.Schema Version int DiscardRaw bool }
type Output ¶
type Output struct { // All fields *must* have an output_type. Type string `json:"output_type"` // Renamed from stream in 4.0 Name string `json:"name"` Text []string `json:"text"` // in display data Metadata StringMap Data StringMap // in execute result; used to be pyout / prompt_number ExecutionCount int `json:"execute_count"` // In errors EName string `json:"ename"` EValue string `json:"evalue"` Traceback []string `json:"traceback"` }
func (*Output) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.