Conflicts
Functions to resolve any git conflicts between notebooks.
conflict2nb(conflict_file, *, meta_first=True, cells_first=None, cell_fields_ignore=('id', 'execution_count'), ignore_none=True, verbose=False)
Merge diffs from conflicts and return valid a notebook.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conflict_file
|
ConflictFile
|
A |
required |
meta_first
|
bool
|
Whether to keep the metadata of the first or last notebook |
True
|
cells_first
|
Optional[bool]
|
Whether to keep the cells of the first or last notebook |
None
|
ignore_none
|
bool
|
Keep all metadata fields even if it's included in only one notebook |
True
|
cell_fields_ignore
|
Sequence[str]
|
Fields to remove before comparing notebooks - i.e.: cell IDs or execution counts may not want to be considered |
('id', 'execution_count')
|
verbose
|
bool
|
Log written files and metadata conflicts |
False
|
Returns:
| Type | Description |
|---|---|
JupyterNotebook
|
Resolved conflicts as a |
Source code in databooks/conflicts.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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
conflicts2nbs(conflict_files, *, progress_callback=lambda: None, **conflict2nb_kwargs)
Get notebooks from conflicts.
Wrap databooks.conflicts.conflict2nb to write notebooks to list of
databooks.git_utils.ConflictFile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conflict_files
|
List[ConflictFile]
|
Files with source conflict files and one-liner git logs |
required |
progress_callback
|
Callable[[], None]
|
Callback function to report progress |
lambda: None
|
conflict2nb_kwargs
|
Any
|
Keyword arguments to be passed to
|
{}
|
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in databooks/conflicts.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
path2conflicts(nb_paths, repo=None)
Get the difference model from the path based on the git conflict information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nb_paths
|
List[Path]
|
Path to file with conflicts (must be notebook paths) |
required |
repo
|
Optional[Repo]
|
The git repo to look for conflicts |
None
|
Returns:
| Type | Description |
|---|---|
List[ConflictFile]
|
Generator of |
Source code in databooks/conflicts.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |