/
Doggich
/
CodeRepresentation
Обзор
Документация
Войти
/
Doggich
/
CodeRepresentation
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/modules/gitURLParser.py
26 строк
711 B
Doggich
refactoring: script structure
10 янв 2026, 19:23
10 янв 2026, 19:23
6336d86
Код
Авторство
О чём код?
from urllib.parse import urlparse def parse_github_url(url): """ Parse a GitHub URL to extract owner and repository name. Args: url (str): GitHub repository URL (e.g., https://github.com/owner/repo) Returns: tuple: (owner, repo) extracted from the URL """ # Remove trailing slash if present url = url.rstrip('/') # Parse the URL parsed = urlparse(url) # Extract path components path_parts = parsed.path.strip('/').split('/') if len(path_parts) < 2: raise ValueError("Invalid GitHub URL format. Expected: https://github.com/owner/repo") # Return owner and repo return path_parts[0], path_parts[1]