nbautoexport.clean
¶
find_files_to_clean(directory, config)
¶
Given path to a notebooks directory watched by nbautoexport, find all files that are not expected exports by current nbautoexport configuration and existing notebooks, or other expected Jupyter or nbautoexport files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory |
Path
|
notebooks directory to find files to clean up |
required |
Returns:
Type | Description |
---|---|
List[Path]
|
List[Path]: list of files to clean up |
Source code in /home/runner/work/nbautoexport/nbautoexport/nbautoexport/clean.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
get_expected_exports(notebooks, config)
¶
Given an iterable of Jupyter notebooks, return list of paths of files that nbautoexport would be expected to export to given this configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
notebooks |
Iterable[JupyterNotebooks]
|
iterable of notebooks |
required |
Returns:
Type | Description |
---|---|
List[Path]
|
List[Path]: list of expected nbautoexport output files, relative to notebook files |
Source code in /home/runner/work/nbautoexport/nbautoexport/nbautoexport/clean.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
get_extension(notebook, export_format)
¶
Given a notebook and export format, return expected export file extension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
notebook |
JupyterNotebook
|
notebook to determine extension for |
required |
export_format |
str
|
export format name |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
file extension, e.g., '.py' |
Source code in /home/runner/work/nbautoexport/nbautoexport/nbautoexport/clean.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
globs(directory, patterns)
¶
Generator that yields paths matching glob-style patterns relative to directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory |
Path
|
a directory |
required |
patterns |
Iterable[str]
|
glob-style patterns relative to directory |
required |
Yields:
Name | Type | Description |
---|---|---|
Path |
Iterable[Path]
|
paths matching provided patterns relative to directory |
Source code in /home/runner/work/nbautoexport/nbautoexport/nbautoexport/clean.py
92 93 94 95 96 97 98 99 100 101 102 103 |
|
notebook_exports_generator(notebook, export_format, organize_by)
¶
Generator that yields paths of expected exports for a notebook given an export_format and an organize_by setting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
notebook |
JupyterNotebook
|
notebook to get export paths for |
required |
export_format |
ExportFormat
|
export format |
required |
organize_by |
OrganizeBy
|
type of subfolder approach |
required |
Yields:
Name | Type | Description |
---|---|---|
Path |
Iterable[Path]
|
expected export paths given notebook and configuration options |
Source code in /home/runner/work/nbautoexport/nbautoexport/nbautoexport/clean.py
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 |
|