From 6098d27e14534c4c1ccf5bcfd7a220b266156a70 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 27 Sep 2025 22:39:31 +0000 Subject: [PATCH 1/3] Initial plan From f386165c982692c46bbc1e1de5d37a0e97473ce4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 27 Sep 2025 22:44:01 +0000 Subject: [PATCH 2/3] Initial analysis: Identified test import issues Co-authored-by: AF-Warsame <201992579+AF-Warsame@users.noreply.github.com> --- src/acmecli.egg-info/SOURCES.txt | 7 +++++++ .../__pycache__/__init__.cpython-312.pyc | Bin 150 -> 148 bytes src/acmecli/__pycache__/types.cpython-312.pyc | Bin 4206 -> 4204 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 810 -> 808 bytes .../metrics/__pycache__/base.cpython-312.pyc | Bin 381 -> 379 bytes .../license_metric.cpython-312.pyc | Bin 2892 -> 2890 bytes 6 files changed, 7 insertions(+) diff --git a/src/acmecli.egg-info/SOURCES.txt b/src/acmecli.egg-info/SOURCES.txt index ee8a4d8..ca89eb3 100644 --- a/src/acmecli.egg-info/SOURCES.txt +++ b/src/acmecli.egg-info/SOURCES.txt @@ -25,12 +25,19 @@ src/acmecli/metrics/performance_claims_metric.py src/acmecli/metrics/ramp_up_metric.py src/acmecli/metrics/size_metric.py tests/test_bus_factor_metric.py +tests/test_cache.py +tests/test_cli_integration.py tests/test_cli_metric.py tests/test_code_quality_metric.py tests/test_dataset_and_code_metric.py tests/test_dataset_quality_metric.py +tests/test_github_handler.py +tests/test_hf_downloads_metric.py +tests/test_hf_handler.py tests/test_license_metric.py tests/test_logging_env.py tests/test_performance_claims_metric.py tests/test_ramp_up_metric.py +tests/test_reporter.py +tests/test_scoring.py tests/test_size_metric.py \ No newline at end of file diff --git a/src/acmecli/__pycache__/__init__.cpython-312.pyc b/src/acmecli/__pycache__/__init__.cpython-312.pyc index b37694937a17b566430efc7df46f28451a18fee7..4eddde4a5377dfee548c31a628946d8233c173fe 100644 GIT binary patch delta 64 zcmbQnIE9h>G%qg~0}$LyzcG>9SkqWPBR@A)zo;}XFSSU&JijPgza+J|1VR)SCF>_9 O=cXp-Wa>}M)CB;Eg%za$ delta 66 zcmbQjIE|6}G%qg~0}yQ7dUPVUv9_tJRZMtdQE_5!s(P`4TYgSTYEf~FOKO>}qqDDT UOmR_iOk#3wYI06y%*1qE0H1Od!THCT$~EtC;Y_qTy;#95KPM%%s5r(YwM^I1 s+1E9uxF|U$F*!FiIVUqFH?^cFGr2e>K0Y%qvm`!Vub}eQG&rK~U%1kcSpZKjE0M)7+)&Kwi delta 76 zcmey(^p}bEG%qg~0}vRQ-N=ZW$h*zh($y*^Jh7-aF*jAcSivnnCndG0IL0NlOxMxb e*EOcNC^;rEIX5*qCo?8DwWKIBxj1Ixmv#WTTpKz7 diff --git a/src/acmecli/metrics/__pycache__/license_metric.cpython-312.pyc b/src/acmecli/metrics/__pycache__/license_metric.cpython-312.pyc index 29e722aa8f7735de29ebc46128d816b024149229..288f16048dc1c0d3d96513830632a07ce0e93301 100644 GIT binary patch delta 77 zcmX>jc1n!*G%qg~0}$Lyzmeg*k#`A;p`(6Aer~FMQE6UYYLR|lc1Dc%G%qg~0}!;j+{mcf$h(Ba*xA)8COomII59U>y;#95KPM%%s5r(YwM^I1 h+1E9uxF|U$F*!FiIVUqFH?^cFGr2fs^COlFHUJ7+8 Date: Sat, 27 Sep 2025 22:53:06 +0000 Subject: [PATCH 3/3] 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