-
Notifications
You must be signed in to change notification settings - Fork 1k
Make gitingest.com parsable , notebook now supports output and some metadata #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@IsNoobgrammer Why do you want to make |
|
|
||
|
|
||
| def _read_file_content(file_path: Path) -> str: | ||
| def _read_file_content(file_path: Path , parse_notebook_output: bool = True) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the point of passing on the parse_notebook_output argument to the _read_file_content function if it is not ever used in the codebase. Instead, wait with this until we implement support for not including the notebook output.
| "bitbucket.org", | ||
| "gitea.com", | ||
| "codeberg.org", | ||
| "gitingest.com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the need for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the need for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see. Don't see why people would do this, but makes sense to cover it. Could you make a separate PR for adding gitingest.com, as well as adding it and the missing gitea.com and codeberg.org to the test cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup I noticed that some people did that so why not :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IsNoobgrammer Will you make a separate PR for adding gitingest.com, as well as adding it and the missing gitea.com and codeberg.org to the test cases, or should I go ahead and do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IsNoobgrammer I went ahead and created a PR: #134.
| # Extract Output from cell | ||
| if parse_notebook_output and (("outputs" in cell) and (cell["outputs"] != [])): | ||
| sample_output="" | ||
| for output in cell["outputs"]: | ||
| if output["output_type"] == "stream" and output["text"] != []: | ||
| sample_output += "".join(output["text"]) + "\n" | ||
| elif (output["output_type"] in ["execute_result","display_data"]) and ("data" in output) and ("text/plain" in output["data"]): | ||
| sample_output += "".join(output["data"]["text/plain"]) + "\n" | ||
| elif (output["output_type"]=="error" and ("evalue" in output) ): | ||
| sample_output += f"{output.get("ename","Error")} : " + "".join(output["evalue"]) + "\n" | ||
| str_ += f'\n# Output:\n"""{sample_output}"""\n' | ||
|
|
||
| # Add Cell Info | ||
| cell_count+=1 | ||
| str_ = f"# Cell {cell_count} ; Type : ({cell_type})\n" + str_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have already implemented this quite neatly – will make the PR in a moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have already implemented this quite neatly – will make the PR in a moment.
No problem , I will close this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, should have been clearer.
| "https://gitea.com/user/repo", | ||
| "https://codeberg.com/user/repo", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good! Please make a separate PR for this.
| "http://gitlab.com/user/repo", | ||
| "http://bitbucket.org/user/repo", | ||
| "https://gitingest.com/user/repo", | ||
| "http://gitea.com/user/repo", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good! Please make a separate PR for this (as seen in my other comment). You can include codeberg.com here as well.
This PR works on issue 126 and issue 119
Where earlier URL consisting
gitingest.com/user/repowere not parsedEarlier Jupyter Notebook's only
sourcewas parsedoutputfor various categories to make it pack more contextExample
@cyclotruc
@filipchristiansen (needs to update test-cases for notebook)