| 170 | |
| 171 | |
| 172 | def read_data_from_file(file_name: Path) -> Tuple[str, str]: |
| 173 | with open(file_name, "r", encoding="utf8") as test: |
| 174 | lines = test.readlines() |
| 175 | _input: List[str] = [] |
| 176 | _output: List[str] = [] |
| 177 | result = _input |
| 178 | for line in lines: |
| 179 | line = line.replace(EMPTY_LINE, "") |
| 180 | if line.rstrip() == "# output": |
| 181 | result = _output |
| 182 | continue |
| 183 | |
| 184 | result.append(line) |
| 185 | if _input and not _output: |
| 186 | # If there's no output marker, treat the entire file as already pre-formatted. |
| 187 | _output = _input[:] |
| 188 | return "".join(_input).strip() + "\n", "".join(_output).strip() + "\n" |
| 189 | |
| 190 | |
| 191 | def read_jupyter_notebook(subdir_name: str, name: str, data: bool = True) -> str: |