Utilities Module
The utilities module provides helper functions for detecting and classifying magic commands in cell content.
Functions
Utility functions for magic command detection.
get_line_magics_cached()
cached
Return cached set of all registered line magic names.
Returns:
| Type | Description |
|---|---|
FrozenSet[str]
|
Frozen set of magic command names (without % prefix). |
Source code in jumper_wrapper_kernel/utilities.py
9 10 11 12 13 14 15 16 17 | |
is_known_line_magic(line, line_magics)
Check if a line starts with a known magic command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
str
|
Single line of code to check. |
required |
line_magics
|
frozenset
|
Set of known magic names (without % prefix). |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if line starts with % |
Source code in jumper_wrapper_kernel/utilities.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
is_pure_line_magic_cell(raw_cell)
A pure line-magic cell = each non-empty line is either:
- starts with %
Source code in jumper_wrapper_kernel/utilities.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
is_local_magic_cell(raw_cell, local_magics)
Check if cell contains only local magic commands (and comments/empty lines). Returns True if all non-empty, non-comment lines are local magics.
Source code in jumper_wrapper_kernel/utilities.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |