MCPcopy Index your code
hub / github.com/dbcli/mycli / _normalize_token_value

Function _normalize_token_value

mycli/packages/completion_engine.py:91–104  ·  view source on GitHub ↗
(token: str | Token | None)

Source from the content-addressed store, hash-verified

89
90
91def _normalize_token_value(token: str | Token | None) -> str | None:
92 if isinstance(token, str):
93 return token.lower()
94 if isinstance(token, Comparison):
95 # If 'token' is a Comparison type such as
96 # 'select * FROM abc a JOIN def d ON a.id = d.'. Then calling
97 # token.value on the comparison type will only return the lhs of the
98 # comparison. In this case a.id. So we need to do token.tokens to get
99 # both sides of the comparison and pick the last token out of that
100 # list.
101 return token.tokens[-1].value.lower()
102 if token is None:
103 return None
104 return token.value.lower()
105
106
107def _build_suggest_context(

Calls

no outgoing calls