Path.replace
Path.replace(...)Description
Documentation for Path.replace.
Real-World Examples
Practical code examples showing how Path.replace is used in real projects.
content = data.get("content", "")
encoding = data.get("encoding", "")
if encoding == "base64" and content:
return base64.b64decode(content).decode(
"utf-8", errors="replace"
)
return content
else:
logger.warning(
f"Could not get README for {repo_full_name}: {response.status_code}"
)
return ""
except Exception:
logger.exception(f"Error getting README for {repo_full_name}")
return ""
def _get_recent_issues(
self, repo_full_name: str, limit: int = 5
) -> List[Dict[str, Any]]:
"""
Get recent issues for a repository.
Args:
return items[:num_repos] # Ensure we don't return more than requested
def _parse_gh_url(self, gh_url: str) -> tuple[str, str]:
"""Parse a GitHub URL into owner, repo, and path."""
# Remove the protocol part if present
gh_url = gh_url.replace("https://", "").replace("http://", "")
# Split by '/' and take the last two parts
parts = gh_url.split("/")
if len(parts) < 2:
raise ValueError("Invalid GitHub URL")
owner = parts[-2]
repo = parts[-1]
return owner, repo
def _get_file_name_from_zip_name(self, zip_name: str) -> str:
zip_name = zip_name.split("/")
root_dir = zip_name[0]
return "-".join(root_dir.split("-")[1:-1]) + "/" + "/".join(zip_name[1:])
async def _raise_for_status(
self, owner: str, repo: str, response: aiohttp.ClientResponse
):
if response.status == 404:
raise GitHubNotFoundError(owner, repo)