From 727ada6c2a3f7443d17b378134d48c2c954e6a69 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 27 Sep 2025 22:53:06 +0000 Subject: [PATCH] Fix import issues: Add missing functions and correct class names Co-authored-by: AF-Warsame <201992579+AF-Warsame@users.noreply.github.com> --- .../__pycache__/hf_handler.cpython-312.pyc | Bin 1716 -> 2016 bytes .../__pycache__/reporter.cpython-312.pyc | Bin 544 -> 1040 bytes src/acmecli/github_handler.py | 8 +++++++- src/acmecli/hf_handler.py | 8 +++++++- src/acmecli/reporter.py | 8 ++++++++ src/acmecli/scoring.py | 9 ++++++++- tests/test_cache.py | 6 +++--- 7 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/acmecli/__pycache__/hf_handler.cpython-312.pyc b/src/acmecli/__pycache__/hf_handler.cpython-312.pyc index a584f9c4f8d093120ec7065d441620c005edcf7a..549786558a4f0c3c8af9f0da00071d514f3309d3 100644 GIT binary patch delta 455 zcmdnO`+%SKG%qg~0}zO0-pKerkynz@VxqdHbP7uKB#f<)s$sm**E{>zAY!mq3W(qGbKVx)={x{KI=L^31DAShr4(jffV0!U0}D1pnZhAOCKtYORosXzlY46C7PgBdg#t4w_J zQ%ZAEb#qe7Qgam2O7oISGV}8kO7a!bQcIFE6zV-n)6+Ba(%ll1Qx$SkOA=EOOA_@o znTl9|<`$^}2_PHf#9QnciFqkGsYS(1K%Rm^kqSsq5Nt|(Mp`^fZ;?JwTo#CnrGP{O z!xKL7?(7El8{9(Ixn(bM%g#u?%&l~RMX5*!D6PpRT_g&mi$H22R%(J+S|CDyasivH zl>v|m@=&n`kodsN$jEq`f&VrG-**-Z{Zd}8F&WG)f~nouMK sB3LGOvdgOL0-20JTnv)An>6FHGx7G^AMwqG}J7%_r5o8-uJ%uW}m#XT3?&ZI#OpX__6g8 z&s%MLf4+9DZJ>LITQkI0J{kHMp+R*QJN5aK5BOj~@Qu4&cPoj63*$Hz;O->w%uR(% z3n#&MJwFnD7`Pxt38Vr#qus2r13@ZS%(rC{gS~i-*Rel8d1gwL!h0mp0CO}jI3AeX z5QLkeG9;YLh*GaO)y#UdY&Kc%2hk`LwCqm((36r56VMiUX&S^&Dfd#ZlMxM2Qxg7i z85JT#l$pwouA-?{PqEJGv;BWrkwPyp$DfVzH~PpiC+9YDrCf!2l0N7^+@vxErQF$o z6-9ImXefYY9%n>~a0sjFBDDgg&{B|9hts^##4gwC6gz0H)a9?xFMIXvD|R%eHbe^po@siBak8^$wAO{X2g&6f9lu)S$8Wf-hdNOER3-k)AH!?yq&T f80t1qmD7JLFE5Vqh0{j}* delta 178 zcmbQhv4Dl|G%qg~0}yQ7dNgAL!$dv_Mw5x^rYx0=nj8~L7Bgy2mSD7SGj+9!2~R94 zPRvbJFII5N&q+xwDvohUEz@;$_H~UZE=rC`OwLVB&dH1^N-fAQDoHKUE2zB1Q(lx= zk{X|vl2x3aSHw4Y3ZoW_CR-8r 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