Spaces:
Runtime error
Runtime error
Download codedog_demo/github_utils.py from codedog-ai/codedog-demo: direct link, hf CLI and curl.
- Browser
- Download file 422 Bytes
-
https://huggingface.co/spaces/codedog-ai/codedog-demo/resolve/main/codedog_demo/github_utils.py
- Command line
-
hf download hf://spaces/codedog-ai/codedog-demo/codedog_demo/github_utils.py
-
curl -L -o github_utils.py https://huggingface.co/spaces/codedog-ai/codedog-demo/resolve/main/codedog_demo/github_utils.py
422 Bytes
| from typing import Tuple | |
| def parse_github_pr_url(url: str) -> Tuple[str, int]: | |
| # Input = https://github.com/codedog-ai/codedog/pull/11 | |
| # Output = codedog-ai/codedog, 11 | |
| if not url: | |
| return ("", 0) | |
| try: | |
| parts = url.split("/") | |
| owner_repo = parts[3] + "/" + parts[4] | |
| pr_number = int(parts[-1]) | |
| except Exception: | |
| return ("", 0) | |
| return (owner_repo, pr_number) | |