euporie.notebook.tabs.notebook
Contain the main class for a notebook file.
Functions
|
Deep copy operation on arbitrary Python objects. |
|
Get a command from the centralized command system by name. |
|
Assign key-bindings to commands based on a dictionary. |
|
Create a new code cell, without validation. |
|
Update the key-binding registry. |
|
Generate a random UUID. |
Classes
|
The main notebook container class. |
|
A container which renders its content once and caches the output. |
|
A kernel_tab cell element. |
|
Text on the clipboard. |
|
Turn any callable into a Filter. |
|
Wrapper around any other container that can change the visibility. |
|
Specified dimension (width/height) of a user control or window. |
|
Draw a horizontal or vertical line. |
|
A container which renders a stand-alone margin. |
|
|
|
A container which wraps mouse events to add a mouse handler. |
|
Interactive notebooks. |
|
Fill an area with a repeating background pattern. |
|
Margin displaying a scrollbar. |
|
A scrollable container which renders only the currently visible children. |
|
Several layouts, one stacked left/right of the other. |
A list-like sequence optimized for data accesses near its endpoints. |
|
|
Create a new function with partial application of the given arguments and keywords. |
- class euporie.notebook.tabs.notebook.Notebook(app: BaseApp, path: Path | None = None, kernel: BaseKernel | None = None, comms: dict[str, Comm] | None = None, use_kernel_history: bool = True, json: dict[str, Any] | None = None)
Bases:
BaseNotebookInteractive notebooks.
A tab which allows running and editing a notebook.
- add(index: int, source: str = '', **kwargs: Any) None
Create a new cell at a given index.
- Parameters:
index – The position at which to insert a new cell
source – The contents of the new cell
kwargs – Additional parameters for the cell
- bg_init = True
- change_kernel(msg: str | None = None, startup: bool = False) None
Prompt the user to select a new kernel.
- close(cb: Callable | None = None) None
Check if the user want to save an unsaved notebook, then close the file.
- Parameters:
cb – A callback to run if after closing the notebook.
- comm_open(content: dict, buffers: Sequence[bytes]) None
Register a new kernel Comm object in the notebook.
- container: AnyContainer
- copy(slice_: slice | None = None) None
Add a copy of the selected cells to the Notebook’s clipboard.
- property current_input: KernelInput
Return the currently active kernel input, if any.
- cut(slice_: slice | None = None) None
Remove cells from the notebook and them to the Notebook’s clipboard.
- default_callbacks: MsgCallbacks
- edit_mode = False
- file_extensions: ClassVar[dict[str, None]] = {'.R': None, '.Rmd': None, '.clj': None, '.coco': None, '.cpp': None, '.cs': None, '.do': None, '.fs': None, '.fsx': None, '.go': None, '.gp': None, '.groovy': None, '.hs': None, '.ipynb': None, '.java': None, '.jl': None, '.js': None, '.lgt': None, '.logtalk': None, '.lua': None, '.m': None, '.mac': None, '.markdown': None, '.md': None, '.ml': None, '.mnb': None, '.myst': None, '.mystnb': None, '.pro': None, '.ps1': None, '.py': None, '.q': None, '.qmd': None, '.r': None, '.resource': None, '.robot': None, '.rs': None, '.sage': None, '.sas': None, '.scala': None, '.scm': None, '.sh': None, '.sos': None, '.ss': None, '.tcl': None, '.ts': None, '.wolfram': None, '.xsh': None}
- get_cell_by_id(cell_id: str) Cell | None
Return a reference to the Cell container with a given cell id.
- init_kernel(kernel: BaseKernel | None = None, comms: dict[str, Comm] | None = None, use_kernel_history: bool = False, connection_file: Path | None = None) None
Defer loading kernel until after notebook file is loaded.
- kernel: BaseKernel
- property kernel_display_name: str
Return the display name of the kernel defined in the notebook JSON.
- property kernel_lang_file_ext: str
Return the display name of the kernel defined in the notebook JSON.
- load_container() AnyContainer
Trigger loading of the main notebook container.
- mode() str
Return a symbol representing the current mode.
^: Notebook mode>: Navigation modeI: Insert modev: Visual mode
- Returns:
A character representing the current mode
- move(n: int, slice_: slice | None = None) None
Move a slice of cells up or down.
- Parameters:
slice – A slice describing the cell indices to move
n – The amount to move them by
- new_output_default(output_json: dict[str, Any], own: bool) None
Add a new output without a cell to the currently selected cell.
- paste(index: int | None = None) None
Append the contents of the Notebook’s clipboard below the current cell.
- refresh(slice_: slice | None = None, scroll: bool = True) None
Refresh the rendered contents of this notebook.
- reports: WeakKeyDictionary[LspClient, Report]
- run_cell(cell: Cell, wait: bool = False, callback: Callable[..., None] | None = None) None
Run a cell.
- Parameters:
cell – The rendered cell to run. If
None, runs the currently selected cell.wait – If
True, blocks until cell execution is finishedcallback – Function to run after completion
- run_selected_cells(advance: bool = False, insert: bool = False) None
Run the currently selected cells.
- Parameters:
advance – If True, move to next cell. If True and at the last cell, create a new cell at the end of the notebook.
insert – If True, add a new empty cell below the current cell and select it.
- select(index: int, extend: bool = False, position: int | None = None, scroll: bool = True) None
Select a cell or adds it to the selection.
- Parameters:
index – The index of the cell to select
extend – If true, the selection will be extended to include the cell
position – An optional cursor position index to apply to the cell input
scroll – Whether to scroll the page
- set_next_input(text: str, replace: bool = False) None
Handle
set_next_inputpayloads, e.g.%loadmagic.
- suggester: AutoSuggest