MCPcopy Create free account
hub / github.com/idank/explainshell / _estimate_manpage_size

Function _estimate_manpage_size

explainshell/caching_store.py:62–84  ·  view source on GitHub ↗
(manpage: ParsedManpage)

Source from the content-addressed store, hash-verified

60
61
62def _estimate_manpage_size(manpage: ParsedManpage) -> int:
63 total = 256
64 total += _estimate_text_size(manpage.source)
65 total += _estimate_text_size(manpage.name)
66 total += _estimate_text_size(manpage.synopsis)
67 total += _estimate_value_size(manpage.aliases)
68 total += _estimate_value_size(manpage.subcommands)
69 total += _estimate_value_size(manpage.nested_cmd)
70 total += _estimate_text_size(manpage.extractor)
71 if manpage.extraction_meta is not None:
72 total += _estimate_value_size(manpage.extraction_meta.model_dump())
73
74 for option in manpage.options:
75 total += 192
76 total += _estimate_text_size(option.text)
77 total += _estimate_value_size(option.short)
78 total += _estimate_value_size(option.long)
79 total += _estimate_value_size(option.has_argument)
80 total += _estimate_value_size(option.positional)
81 total += _estimate_value_size(option.nested_cmd)
82 total += _estimate_value_size(option.meta)
83
84 return total
85
86
87def _estimate_cache_value_size(value: _CacheValue) -> int:

Callers 1

Calls 2

_estimate_text_sizeFunction · 0.85
_estimate_value_sizeFunction · 0.85

Tested by

no test coverage detected