Skip to content

Commit

Permalink
remove: remove deprecated cells_to_jupy
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyoon committed Jul 13, 2024
1 parent 1e57296 commit 5900c1a
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions src/jupynium/ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,6 @@ def ipynb_language(ipynb):
return None


def cells_to_jupy(cell_types: list[str], texts: list[str]):
cell_types_previous = ["code"] + cell_types[:-1]

jupy: list[str] = []

for cell_type_previous, cell_type, text in zip(
cell_types_previous, cell_types, texts
):
if cell_type == "code":
if cell_type_previous == "code":
jupy.append("# %%")
else:
jupy.append('%%"""')
else:
if cell_type_previous == "code":
jupy.append('"""%%')
else:
jupy.append("# %%%")

for line in text.split("\n"):
if line.startswith("%"):
line = "# " + line
jupy.append(line)

return jupy


def cells_to_jupytext(
cell_types: Sequence[str], texts: Sequence[str], python: bool = True
):
Expand Down Expand Up @@ -91,18 +64,6 @@ def cells_to_jupytext(
return jupytext


def ipynb2jupy(ipynb):
"""
Deprecated. Use ipynb2jupytext instead.
"""
cell_types, texts = read_ipynb_texts(ipynb)
language = ipynb_language(ipynb)
if language is None or language == "python":
return cells_to_jupy(cell_types, texts)
else:
return cells_to_jupytext(cell_types, texts)


def ipynb2jupytext(ipynb, code_only=False):
cell_types, texts = read_ipynb_texts(ipynb, code_only=code_only)
language = ipynb_language(ipynb)
Expand Down

0 comments on commit 5900c1a

Please sign in to comment.