Metadata
Metadata wrapper functions for cleaning notebook metadata.
clear(read_path, write_path=None, notebook_metadata_keep=(), cell_metadata_keep=(), cell_fields_keep=(), check=False, verbose=False, overwrite=False, **kwargs)
Clear Jupyter Notebook metadata.
Clear metadata (at notebook and cell level) and write clean notebook. By default, remove all metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
read_path
|
Path
|
Path of notebook file with metadata to be cleaned |
required |
write_path
|
Optional[Path]
|
Path of notebook file with metadata to be cleaned |
None
|
notebook_metadata_keep
|
Sequence[str]
|
Notebook metadata fields to keep |
()
|
cell_metadata_keep
|
Sequence[str]
|
Cell metadata fields to keep |
()
|
cell_fields_keep
|
Sequence[str]
|
Cell fields to keep |
()
|
check
|
bool
|
Don't write any files, check whether there is unwanted metadata |
False
|
verbose
|
bool
|
Log written files |
False
|
overwrite
|
bool
|
Whether to overwrite files (if exists) |
False
|
kwargs
|
Any
|
Additional keyword arguments to pass to
|
{}
|
Returns:
| Type | Description |
|---|---|
bool
|
Whether notebooks are equal |
Source code in databooks/metadata.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
clear_all(read_paths, write_paths, *, progress_callback=lambda: None, **clear_kwargs)
Clear metadata for multiple notebooks at notebooks and cell level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
read_paths
|
List[Path]
|
Paths of notebook to remove metadata |
required |
write_paths
|
List[Path]
|
Paths of where to write cleaned notebooks |
required |
progress_callback
|
Callable[[], None]
|
Callback function to report progress |
lambda: None
|
clear_kwargs
|
Any
|
Keyword arguments to be passed to |
{}
|
Returns:
| Type | Description |
|---|---|
List[bool]
|
Whether the notebooks contained or not unwanted metadata |
Source code in databooks/metadata.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |