Repository navigation
Expand file tree
/
Copy pathtoolkit.json
More file actions
39 lines (39 loc) · 2.77 KB
/
Copy pathtoolkit.json
File metadata and controls
39 lines (39 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
"parse_log": {
"name": "parse_log",
"description": "Parses a messy log file into structured JSON",
"code": "def parse_log(text: str) -> dict:\n return {\"status\": \"success\", \"parsed\": text.strip()}",
"signature": "def parse_log(text: str) -> dict:",
"verified": true,
"test_cases": [
"def test_returns_dict():\n result = parse_log(\"2024-01-01 ERROR something went wrong\")\n assert isinstance(result, dict), \"parse_log must return a dict\"",
"def test_has_status_key():\n result = parse_log(\"INFO server started\")\n assert \"status\" in result, \"result dict must contain a 'status' key\"",
"def test_has_parsed_key():\n result = parse_log(\"WARN disk usage at 90%\")\n assert \"parsed\" in result, \"result dict must contain a 'parsed' key\"",
"def test_empty_string():\n result = parse_log(\"\")\n assert isinstance(result, dict), \"must handle empty input gracefully\"",
"def test_whitespace_stripped():\n result = parse_log(\" ERROR trailing spaces \")\n assert result[\"parsed\"] == \"ERROR trailing spaces\", \"leading/trailing whitespace must be stripped\"",
"def test_multiline_input():\n log = \"ERROR line one\\nINFO line two\\nDEBUG line three\"\n result = parse_log(log)\n assert isinstance(result, dict), \"must handle multi-line logs\""
],
"usage_count": 4,
"reuse_count": 3,
"created_at": "2026-08-10T14:01:02.765669+00:00",
"last_used_at": "2026-08-10T14:01:21.192861+00:00"
},
"compute_sha256": {
"name": "compute_sha256",
"description": "Computes the SHA256 hash of a given string",
"code": "import hashlib\ndef compute_sha256(text: str) -> str:\n return hashlib.sha256(text.encode()).hexdigest()",
"signature": "def compute_sha256(text: str) -> str:",
"verified": true,
"test_cases": [
"def test_returns_string():\n result = compute_sha256(\"hello\")\n assert isinstance(result, str), \"must return a string\"",
"def test_known_hash():\n expected = \"2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824\"\n assert compute_sha256(\"hello\") == expected, \"hash of 'hello' must match known value\"",
"def test_fixed_length():\n result = compute_sha256(\"any input here\")\n assert len(result) == 64, \"SHA256 hex digest must always be 64 chars\"",
"def test_empty_string():\n result = compute_sha256(\"\")\n assert len(result) == 64, \"must handle empty string\"",
"def test_different_inputs_differ():\n assert compute_sha256(\"foo\") != compute_sha256(\"bar\"), \"different inputs must produce different hashes\""
],
"usage_count": 2,
"reuse_count": 1,
"created_at": "2026-08-10T14:01:02.845689+00:00",
"last_used_at": "2026-08-10T14:01:21.200912+00:00"
}
}