|
| str | with_line_numbers (str s, typing.Optional[int] start_line=None, typing.Optional[int] end_line=None, bool expand_tabs=True, str eol_mark="|", typing.Optional[str] mark_spaces=None, typing.Optional[str] mark_control=None) |
| |
namespace class for classes useful in writing unit tests
◆ with_line_numbers()
| str pip._vendor.pyparsing.testing.pyparsing_test.with_line_numbers |
( |
str |
s, |
|
|
typing.Optional[int] |
start_line = None, |
|
|
typing.Optional[int] |
end_line = None, |
|
|
bool |
expand_tabs = True, |
|
|
str |
eol_mark = "|", |
|
|
typing.Optional[str] |
mark_spaces = None, |
|
|
typing.Optional[str] |
mark_control = None |
|
) |
| |
|
static |
Helpful method for debugging a parser - prints a string with line and column numbers.
(Line and column numbers are 1-based.)
:param s: tuple(bool, str - string to be printed with line and column numbers
:param start_line: int - (optional) starting line number in s to print (default=1)
:param end_line: int - (optional) ending line number in s to print (default=len(s))
:param expand_tabs: bool - (optional) expand tabs to spaces, to match the pyparsing default
:param eol_mark: str - (optional) string to mark the end of lines, helps visualize trailing spaces (default="|")
:param mark_spaces: str - (optional) special character to display in place of spaces
:param mark_control: str - (optional) convert non-printing control characters to a placeholding
character; valid values:
- "unicode" - replaces control chars with Unicode symbols, such as "␍" and "␊"
- any single character string - replace control characters with given string
- None (default) - string is displayed as-is
:return: str - input string with leading line numbers and column number headers
The documentation for this class was generated from the following file:
- docs/help/help-venv/lib/python3.12/site-packages/pip/_vendor/pyparsing/testing.py