Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
436,252 changes: 436,252 additions & 0 deletions docs/foraging/Fish/Fish_test.ipynb

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions docs/foraging/Fish/clean_ipynb_conflicts.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think this file should be in the PR

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import sys

def resolve_git_conflicts(ipynb_path, output_path=None):
if output_path is None:
output_path = ipynb_path # Overwrite in place if no output path is given

with open(ipynb_path, 'r', encoding='utf-8') as f:
lines = f.readlines()

cleaned_lines = []
in_conflict = False
keep_lines = False

for line in lines:
if line.startswith("<<<<<<<"):
in_conflict = True
keep_lines = False
continue
elif line.startswith("======="):
keep_lines = True # Start keeping the bottom version
continue
elif line.startswith(">>>>>>>"):
in_conflict = False
keep_lines = False
continue

if not in_conflict or keep_lines:
cleaned_lines.append(line)

with open(output_path, 'w', encoding='utf-8') as f:
f.writelines(cleaned_lines)

print(f"Conflicts resolved. Clean file saved to: {output_path}")

# Example usage:
# resolve_git_conflicts("path/to/notebook.ipynb")

if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python clean_ipynb_conflicts.py notebook.ipynb [output.ipynb]")
else:
resolve_git_conflicts(sys.argv[1], sys.argv[2] if len(sys.argv) > 2 else None)
Loading