MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / suffixed_err

Function suffixed_err

tools/python-3.11.9-amd64/Lib/tomllib/_parser.py:652–666  ·  view source on GitHub ↗

Return a `TOMLDecodeError` where error message is suffixed with coordinates in source.

(src: str, pos: Pos, msg: str)

Source from the content-addressed store, hash-verified

650
651
652def suffixed_err(src: str, pos: Pos, msg: str) -> TOMLDecodeError:
653 """Return a `TOMLDecodeError` where error message is suffixed with
654 coordinates in source."""
655
656 def coord_repr(src: str, pos: Pos) -> str:
657 if pos >= len(src):
658 return "end of document"
659 line = src.count("\n", 0, pos) + 1
660 if line == 1:
661 column = pos + 1
662 else:
663 column = pos - src.rindex("\n", 0, pos)
664 return f"line {line}, column {column}"
665
666 return TOMLDecodeError(f"{msg} (at {coord_repr(src, pos)})")
667
668
669def is_unicode_scalar_value(codepoint: int) -> bool:

Callers 13

loadsFunction · 0.70
skip_untilFunction · 0.70
create_dict_ruleFunction · 0.70
create_list_ruleFunction · 0.70
key_value_ruleFunction · 0.70
parse_key_value_pairFunction · 0.70
parse_key_partFunction · 0.70
parse_arrayFunction · 0.70
parse_inline_tableFunction · 0.70
parse_basic_str_escapeFunction · 0.70
parse_hex_charFunction · 0.70
parse_basic_strFunction · 0.70

Calls 2

TOMLDecodeErrorClass · 0.70
coord_reprFunction · 0.70

Tested by

no test coverage detected