mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-26 19:38:52 -06:00
refactor: index source lines once per file
core.lines.LineIndex answers the line of an offset by binary search. mame_parser and fbneo_parser counted the newlines before each match, O(n) per set, and csharp_source kept its own copy of the index. arcade_parent_importer reads a profile's repository slug through core.upstream.parse_repo and refuses a source that is not on GitHub, the only forge its fetches reach.
This commit is contained in:
1 parent
c63c2f369e
commit
facebef9e5
5 files changed
+83
-6
No files matched your search
@@ -55,6 +55,7 @@ from core.artifacts import write_if_changed
|
||||
from model.profiles import load_emulator_profiles
|
||||
from core.cli import run_cli
|
||||
from core.hashing import compute_hashes
|
||||
from core.upstream import parse_repo
|
||||
from .base_scraper import download
|
||||
from .listxml import Opener, attrs, iter_elements, open_listxml, rom_members
|
||||
from .romset_dat_importer import (
|
||||
@@ -935,10 +936,11 @@ def _dat_cross_check(
|
||||
|
||||
|
||||
def _repo_slug(url: str) -> str:
|
||||
parts = [p for p in urllib.parse.urlsplit(url).path.split("/") if p]
|
||||
if len(parts) < 2:
|
||||
raise ValueError(f"not a repository URL: {url}")
|
||||
return f"{parts[0]}/{parts[1].removesuffix('.git')}"
|
||||
"""owner/name of the GitHub repository a profile's source names."""
|
||||
repo = parse_repo(url)
|
||||
if repo is None or repo.family != "github":
|
||||
raise ValueError(f"not a GitHub repository URL: {url}")
|
||||
return repo.slug
|
||||
|
||||
|
||||
def fetch_repo_file(slug: str, commit: str, path: str, cache_dir: Path) -> tuple[Path, str]:
|
||||
|
||||
Reference in new issue
Block a user