Skip to content
Merged
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
9 changes: 5 additions & 4 deletions code_review_graph/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,10 @@ def parse_bytes(self, path: Path, source: bytes) -> tuple[list[NodeInfo], list[E
if language == "notebook":
return self._parse_notebook(path, source)

# Databricks .py notebook exports
if language == "python" and source.startswith(
b"# Databricks notebook source\n",
# Databricks .py notebook exports (handle both Unix and Windows line endings)
if language == "python" and (
source.startswith(b"# Databricks notebook source\n") or
source.startswith(b"# Databricks notebook source\r\n")
):
return self._parse_databricks_py_notebook(path, source)

Expand Down Expand Up @@ -715,7 +716,7 @@ def _parse_databricks_py_notebook(
self, path: Path, source: bytes,
) -> tuple[list[NodeInfo], list[EdgeInfo]]:
"""Parse a Databricks .py notebook export."""
text = source.decode("utf-8", errors="replace")
text = source.decode("utf-8", errors="replace").replace("\r", "")

# Strip the header line
lines = text.split("\n")
Expand Down
Loading