MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / _effective_char_limit

Function _effective_char_limit

src/codegraphcontext/server.py:96–103  ·  view source on GitHub ↗

Return the effective character budget from both config knobs. Picks the stricter (smallest) non-zero value. Returns 0 when both are zero, meaning no limit is active.

(max_tokens: int, max_chars_direct: int)

Source from the content-addressed store, hash-verified

94
95
96def _effective_char_limit(max_tokens: int, max_chars_direct: int) -> int:
97 """Return the effective character budget from both config knobs.
98
99 Picks the stricter (smallest) non-zero value. Returns 0 when both
100 are zero, meaning no limit is active.
101 """
102 candidates = [c for c in (max_tokens * _CHARS_PER_TOKEN, max_chars_direct) if c > 0]
103 return min(candidates) if candidates else 0
104
105
106def _limit_source_label(max_tokens: int, max_chars_direct: int, effective: int) -> str:

Calls

no outgoing calls