Skip to content

Commit

Permalink
Fix import issues: Add missing functions and correct class names
Browse files Browse the repository at this point in the history
Co-authored-by: AF-Warsame <201992579+AF-Warsame@users.noreply.github.com>
  • Loading branch information
2 people authored and copilot-swe-agent[bot] committed Sep 27, 2025
1 parent f386165 commit 727ada6
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
Binary file modified src/acmecli/__pycache__/hf_handler.cpython-312.pyc
Binary file not shown.
Binary file modified src/acmecli/__pycache__/reporter.cpython-312.pyc
Binary file not shown.
8 changes: 7 additions & 1 deletion src/acmecli/github_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
return {}


def fetch_github_metadata(url: str) -> Dict[str, Any]:
"""Module-level function to fetch GitHub metadata."""
handler = GitHubHandler()
return handler.fetch_meta(url)
8 changes: 7 additions & 1 deletion src/acmecli/hf_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
return {}


def fetch_hf_metadata(url: str) -> dict:
"""Module-level function to fetch HuggingFace metadata."""
handler = HFHandler()
return handler.fetch_meta(url)
8 changes: 8 additions & 0 deletions src/acmecli/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
9 changes: 8 additions & 1 deletion src/acmecli/scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
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))
6 changes: 3 additions & 3 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 727ada6

Please sign in to comment.