1.5 KiB
1.5 KiB
Counter Utility - Verified Artifact
Source: Extracted from Python 3.15.1 documentation via web_extract
URL: https://docs.python.org/3/library/collections.html
Tool Used: web_extract (verified tool)
What This Artifact Does
A Python utility that provides Counter-based functionality extracted from real Python documentation:
count_words(text)- Counts word occurrences in text using Countercount_items(items)- Counts hashable items in a list using Countermost_common(counter, n)- Returns n most frequent itemscounter_to_dict(counter)- Converts Counter to regular dictextract_counter_description(doc_content)- Parses documentation to extract Counter info
Verification Results
- 4/4 tests passed
- Word counting: Verified
'the'appears 3 times,'fox'appears 2 times - Missing key handling: Counter returns 0 for missing keys (not KeyError)
- Counter operations: Addition, intersection, union all verified
- Documentation extraction: Parses web-extracted content correctly
Evidence Chain
web_extractfetched Python collections documentation (5820 chars head + 1914 chars tail, 16320 total)- Full content saved to:
/root/.hermes/profiles/spark/cache/web/docs.python.org-4b36d233d1.md - Utility parses and uses Counter from Python stdlib
- All functionality executed and verified via
--demoflag
Files
/root/.hermes/wizard-outputs/spark/counter_util.py- Main utility/root/.hermes/wizard-outputs/spark/test_counter_util.py- Test suite