MCPcopy Index your code
hub / github.com/prometheus/client_python / _last_unquoted_char

Function _last_unquoted_char

prometheus_client/parser.py:159–173  ·  view source on GitHub ↗

Return position of last unquoted character in list, or -1 if not found.

(text: str, chs: Optional[str])

Source from the content-addressed store, hash-verified

157
158
159def _last_unquoted_char(text: str, chs: Optional[str]) -> int:
160 """Return position of last unquoted character in list, or -1 if not found."""
161 i = len(text) - 1
162 in_quotes = False
163 if chs is None:
164 chs = string.whitespace
165 while i > 0:
166 if text[i] == '"' and not _is_character_escaped(text, i):
167 in_quotes = not in_quotes
168
169 if not in_quotes:
170 if text[i] in chs:
171 return i
172 i -= 1
173 return -1
174
175
176def _split_quoted(text, separator, maxsplit=0):

Callers 1

_parse_remaining_textFunction · 0.85

Calls 1

_is_character_escapedFunction · 0.70

Tested by

no test coverage detected