MCPcopy
hub / github.com/PyCQA/isort / suffixed_err

Function suffixed_err

isort/_vendored/tomli/_parser.py:632–646  ·  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

630
631
632def suffixed_err(src: str, pos: Pos, msg: str) -> TOMLDecodeError:
633 """Return a `TOMLDecodeError` where error message is suffixed with
634 coordinates in source."""
635
636 def coord_repr(src: str, pos: Pos) -> str:
637 if pos >= len(src):
638 return "end of document"
639 line = src.count("\n", 0, pos) + 1
640 if line == 1:
641 column = pos + 1
642 else:
643 column = pos - src.rindex("\n", 0, pos)
644 return f"line {line}, column {column}"
645
646 return TOMLDecodeError(f"{msg} (at {coord_repr(src, pos)})")
647
648
649def is_unicode_scalar_value(codepoint: int) -> bool:

Callers 13

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

Calls 2

TOMLDecodeErrorClass · 0.85
coord_reprFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…