diff --git a/src/acmecli/__pycache__/hf_handler.cpython-312.pyc b/src/acmecli/__pycache__/hf_handler.cpython-312.pyc index a584f9c..5497865 100644 Binary files a/src/acmecli/__pycache__/hf_handler.cpython-312.pyc and b/src/acmecli/__pycache__/hf_handler.cpython-312.pyc differ diff --git a/src/acmecli/__pycache__/reporter.cpython-312.pyc b/src/acmecli/__pycache__/reporter.cpython-312.pyc index 365fe81..7a1e729 100644 Binary files a/src/acmecli/__pycache__/reporter.cpython-312.pyc and b/src/acmecli/__pycache__/reporter.cpython-312.pyc differ diff --git a/src/acmecli/github_handler.py b/src/acmecli/github_handler.py index 0f35b87..f3e4832 100644 --- a/src/acmecli/github_handler.py +++ b/src/acmecli/github_handler.py @@ -92,4 +92,10 @@ def fetch_meta(self, url: str) -> Dict[str, Any]: return {} except Exception as e: logging.error(f"Failed to fetch metadata for {url}: {e}") - return {} \ No newline at end of file + return {} + + +def fetch_github_metadata(url: str) -> Dict[str, Any]: + """Module-level function to fetch GitHub metadata.""" + handler = GitHubHandler() + return handler.fetch_meta(url) \ No newline at end of file diff --git a/src/acmecli/hf_handler.py b/src/acmecli/hf_handler.py index 1b61111..432712e 100644 --- a/src/acmecli/hf_handler.py +++ b/src/acmecli/hf_handler.py @@ -23,4 +23,10 @@ def fetch_meta(self, url: str) -> dict: return meta except Exception as e: logging.error(f"Failed to fetch metadata for {url}: {e}") - return {} \ No newline at end of file + return {} + + +def fetch_hf_metadata(url: str) -> dict: + """Module-level function to fetch HuggingFace metadata.""" + handler = HFHandler() + return handler.fetch_meta(url) \ No newline at end of file diff --git a/src/acmecli/reporter.py b/src/acmecli/reporter.py index a881795..88bdb5f 100644 --- a/src/acmecli/reporter.py +++ b/src/acmecli/reporter.py @@ -4,3 +4,11 @@ def write_ndjson(row: ReportRow) -> None: print(json.dumps(asdict(row), ensure_ascii=False)) + + +class Reporter: + """Simple reporter class for formatting data.""" + + def format(self, data: dict) -> str: + """Format data as JSON string.""" + return json.dumps(data, ensure_ascii=False) diff --git a/src/acmecli/scoring.py b/src/acmecli/scoring.py index b020d9e..c5141d4 100644 --- a/src/acmecli/scoring.py +++ b/src/acmecli/scoring.py @@ -32,4 +32,11 @@ def compute_net_score(results: dict): net_score += metric_value * weight latency_ms = int((time.perf_counter() - t0) * 1000) - return net_score, latency_ms \ No newline at end of file + return net_score, latency_ms + + +def compute_netscore(scores, weights): + """Simple wrapper function for testing - computes weighted sum of scores.""" + if len(scores) != len(weights): + return 0.0 + return sum(score * weight for score, weight in zip(scores, weights)) \ No newline at end of file diff --git a/tests/test_cache.py b/tests/test_cache.py index 6b20f52..3fc39a2 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -1,10 +1,10 @@ -from acmecli.cache import SimpleCache +from acmecli.cache import InMemoryCache def test_cache_set_get(): - cache = SimpleCache() + cache = InMemoryCache() cache.set("foo", "bar") assert cache.get("foo") == "bar" def test_cache_miss(): - cache = SimpleCache() + cache = InMemoryCache() assert cache.get("missing") is None \ No newline at end of file