MCPcopy Index your code
hub / github.com/python/cpython / skip_until

Function skip_until

Lib/tomllib/_parser.py:315–334  ·  view source on GitHub ↗
(
    src: str,
    pos: Pos,
    expect: str,
    *,
    error_on: frozenset[str],
    error_on_eof: bool,
)

Source from the content-addressed store, hash-verified

313
314
315def skip_until(
316 src: str,
317 pos: Pos,
318 expect: str,
319 *,
320 error_on: frozenset[str],
321 error_on_eof: bool,
322) -> Pos:
323 try:
324 new_pos = src.index(expect, pos)
325 except ValueError:
326 new_pos = len(src)
327 if error_on_eof:
328 raise TOMLDecodeError(f"Expected {expect!r}", src, new_pos) from None
329
330 if not error_on.isdisjoint(src[pos:new_pos]):
331 while src[pos] not in error_on:
332 pos += 1
333 raise TOMLDecodeError(f"Found invalid character {src[pos]!r}", src, pos)
334 return new_pos
335
336
337def skip_comment(src: str, pos: Pos) -> Pos:

Callers 3

skip_commentFunction · 0.85
parse_literal_strFunction · 0.85
parse_multiline_strFunction · 0.85

Calls 3

TOMLDecodeErrorClass · 0.85
indexMethod · 0.45
isdisjointMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…