-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,7 +140,7 @@ def _is_text_file(file_path: Path) -> bool: | |
| return False | ||
|
|
||
|
|
||
| def _read_file_content(file_path: Path) -> str: | ||
| def _read_file_content(file_path: Path , parse_notebook_output: bool = True) -> str: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see the point of passing on the |
||
| """ | ||
| Read the content of a file. | ||
|
|
||
|
|
@@ -152,6 +152,8 @@ def _read_file_content(file_path: Path) -> str: | |
| ---------- | ||
| file_path : Path | ||
| The path to the file to read. | ||
| parse_output_notebook : bool | ||
| Whether to parse the output of the notebook-cells. | ||
|
|
||
| Returns | ||
| ------- | ||
|
|
@@ -160,7 +162,7 @@ def _read_file_content(file_path: Path) -> str: | |
| """ | ||
| try: | ||
| if file_path.suffix == ".ipynb": | ||
| return process_notebook(file_path) | ||
| return process_notebook(file_path, parse_notebook_output) | ||
|
|
||
| with open(file_path, encoding="utf-8", errors="ignore") as f: | ||
| return f.read() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
| "bitbucket.org", | ||
| "gitea.com", | ||
| "codeberg.org", | ||
| "gitingest.com" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the need for this?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup I noticed that some people did that so why not :)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @IsNoobgrammer Will you make a separate PR for adding
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @IsNoobgrammer I went ahead and created a PR: #134. |
||
| ] | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,9 @@ async def test_parse_url_valid_https() -> None: | |
| "https://github.com/user/repo", | ||
| "https://gitlab.com/user/repo", | ||
| "https://bitbucket.org/user/repo", | ||
| "https://gitea.com/user/repo", | ||
| "https://codeberg.com/user/repo", | ||
|
Comment on lines
+20
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is good! Please make a separate PR for this. |
||
| "https://gitingest.com/user/repo", | ||
| ] | ||
| for url in test_cases: | ||
| result = await _parse_repo_source(url) | ||
|
|
@@ -34,6 +37,8 @@ async def test_parse_url_valid_http() -> None: | |
| "http://github.com/user/repo", | ||
| "http://gitlab.com/user/repo", | ||
| "http://bitbucket.org/user/repo", | ||
| "https://gitingest.com/user/repo", | ||
| "http://gitea.com/user/repo", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| ] | ||
| for url in test_cases: | ||
| result = await _parse_repo_source(url) | ||
|
|
||
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.
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.