fname stringlengths 63 176 | rel_fname stringclasses 706
values | line int64 -1 4.5k | name stringlengths 1 81 | kind stringclasses 2
values | category stringclasses 2
values | info stringlengths 0 77.9k ⌀ |
|---|---|---|---|---|---|---|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,155 | toterminal | def | function | def toterminal(self, tw: TerminalWriter) -> None:
raise NotImplementedError()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,163 | line | ref | function | tw.line(f":{self.lineno}: {msg}")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,167 | ReprLocals | def | class | toterminal |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,170 | toterminal | def | function | def toterminal(self, tw: TerminalWriter, indent="") -> None:
for line in self.lines:
tw.line(indent + line)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,172 | line | ref | function | tw.line(indent + line)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,176 | ReprFuncArgs | def | class | toterminal |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,179 | toterminal | def | function | def toterminal(self, tw: TerminalWriter) -> None:
raise NotImplementedError()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,186 | line | ref | function | tw.line(linesofar)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,194 | line | ref | function | tw.line(linesofar)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,195 | line | ref | function | tw.line("")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,198 | getfslineno | def | function | def getfslineno(obj: object) -> Tuple[Union[str, Path], int]:
"""Return source location (path, lineno) for the given object.
If the source cannot be determined return ("", -1).
The line number is 0-based.
"""
# xxx let decorators etc specify a sane ordering
# NOTE: this used to be done in _pyt... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,208 | get_real_func | ref | function | obj = get_real_func(obj)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,213 | from_function | ref | function | code = Code.from_function(obj)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,220 | absolutepath | ref | function | fspath = fn and absolutepath(fn) or ""
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/code.py | src/_pytest/_code/code.py | 1,244 | filter_traceback | def | function | def filter_traceback(entry: TracebackEntry) -> bool:
"""Return _True if a TracebackEntry instance should be included in tracebacks.
We hide traceback entries of:
* dynamically generated code (no code to show up for it);
* internal traceback from pytest or its internal libraries, py and pluggy.
"""... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 16 | Source | def | class | __init__ __eq__ __getitem__ __getitem__ __getitem__ __iter__ __len__ strip indent getstatement getstatementrange deindent __str__ |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 28 | deindent | ref | function | self.lines = deindent(x.rstrip("\n") for x in obj)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 30 | deindent | ref | function | self.lines = deindent(obj.split("\n"))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 33 | getrawcode | ref | function | rawcode = getrawcode(obj)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 37 | deindent | ref | function | self.lines = deindent(src.split("\n"))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 61 | Source | ref | function | newsource = Source()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 78 | Source | ref | function | source = Source()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 85 | Source | ref | function | newsource = Source()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 89 | getstatement | def | function | def getstatement(self, lineno: int) -> "Source":
"""Return Source statement which contains the given linenumber
(counted from 0)."""
start, end = self.getstatementrange(lineno)
return self[start:end]
def getstatementrange(self, lineno: int) -> Tuple[int, int]:
"""Return ... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 92 | getstatementrange | ref | function | start, end = self.getstatementrange(lineno)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 95 | getstatementrange | def | function | def getstatementrange(self, lineno: int) -> Tuple[int, int]:
"""Return (start, end) tuple which spans the minimal statement region
which containing the given lineno."""
if not (0 <= lineno < len(self)):
raise IndexError("lineno out of range")
ast, start, end = getstatemen... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 100 | getstatementrange_ast | ref | function | ast, start, end = getstatementrange_ast(lineno, self)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 103 | deindent | def | function | def deindent(self) -> "Source":
"""Return a new Source object deindented."""
newsource = Source()
newsource.lines[:] = deindent(self.lines)
return newsource
def __str__(self) -> str:
return "\n".join(self.lines)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 105 | Source | ref | function | newsource = Source()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 106 | deindent | ref | function | newsource.lines[:] = deindent(self.lines)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 123 | Source | ref | function | source = Source()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 128 | getrawcode | def | function | null |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 137 | getrawcode | ref | function | return getrawcode(call, trycall=False)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 141 | deindent | def | function | def deindent(lines: Iterable[str]) -> List[str]:
return textwrap.dedent("\n".join(lines)).splitlines()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 145 | get_statement_startend2 | def | function | def get_statement_startend2(lineno: int, node: ast.AST) -> Tuple[int, Optional[int]]:
# Flatten all statements and except handlers into one lineno-list.
# AST's line numbers start indexing at 1.
values: List[int] = []
for x in ast.walk(node):
if isinstance(x, (ast.stmt, ast.ExceptHandler)):
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 167 | getstatementrange_ast | def | function | def getstatementrange_ast(
lineno: int,
source: Source,
assertion: bool = _False,
astnode: Optional[ast.AST] = None,
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 181 | get_statement_startend2 | ref | function | start, end = get_statement_startend2(lineno, astnode)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_code/source.py | src/_pytest/_code/source.py | 198 | tokeneater | ref | function | block_finder.tokeneater(*tok)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 8 | _try_repr_or_str | def | function | def _try_repr_or_str(obj: object) -> str:
try:
return repr(obj)
except (KeyboardInterrupt, SystemExit):
raise
except BaseException:
return f'{type(obj).__name__}("{obj}")'
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 17 | _format_repr_exception | def | function | def _format_repr_exception(exc: BaseException, obj: object) -> str:
try:
exc_info = _try_repr_or_str(exc)
except (KeyboardInterrupt, SystemExit):
raise
except BaseException as exc:
exc_info = f"unpresentable exception ({_try_repr_or_str(exc)})"
return "<[{} raised in repr()] {} o... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 19 | _try_repr_or_str | ref | function | exc_info = _try_repr_or_str(exc)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 23 | _try_repr_or_str | ref | function | exc_info = f"unpresentable exception ({_try_repr_or_str(exc)})"
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 29 | _ellipsize | def | function | def _ellipsize(s: str, maxsize: int) -> str:
if len(s) > maxsize:
i = max(0, (maxsize - 3) // 2)
j = max(0, maxsize - 3 - i)
return s[:i] + "..." + s[len(s) - j :]
return s
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 37 | SafeRepr | def | class | __init__ repr repr_instance |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 63 | _format_repr_exception | ref | function | s = _format_repr_exception(exc, x)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 65 | _ellipsize | ref | function | s = _ellipsize(s, self.maxsize)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 68 | repr_instance | def | function | def repr_instance(self, x: object, level: int) -> str:
try:
s = repr(x)
except (KeyboardInterrupt, SystemExit):
raise
except BaseException as exc:
s = _format_repr_exception(exc, x)
if self.maxsize is not None:
s = _ellipsize(s, self.ma... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 74 | _format_repr_exception | ref | function | s = _format_repr_exception(exc, x)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 76 | _ellipsize | ref | function | s = _ellipsize(s, self.maxsize)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 80 | safeformat | def | function | def safeformat(obj: object) -> str:
"""Return a pretty printed string for the given object.
Failing __repr__ functions of user instances will be represented
with a short exception info.
"""
try:
return pprint.pformat(obj)
except Exception as exc:
return _format_repr_exception(ex... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 89 | _format_repr_exception | ref | function | return _format_repr_exception(exc, obj)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 106 | SafeRepr | ref | function | return SafeRepr(maxsize).repr(obj)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 109 | AlwaysDispatchingPrettyPrinter | def | class | _format |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 112 | _format | def | function | def _format(
self,
object: object,
stream: IO[str],
indent: int,
allowance: int,
context: Dict[int, Any],
level: int,
) -> None:
# Type ignored because _dispatch is private.
p = self._dispatch.get(type(object).__repr__, None) # type: ignor... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 127 | _format | ref | function | super()._format( # type: ignore[misc]
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 138 | p | ref | function | p(self, object, stream, indent, allowance, context, level + 1)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 142 | _pformat_dispatch | def | function | def _pformat_dispatch(
object: object,
indent: int = 1,
width: int = 80,
depth: Optional[int] = None,
*,
compact: bool = _False,
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/saferepr.py | src/_pytest/_io/saferepr.py | 150 | AlwaysDispatchingPrettyPrinter | ref | function | return AlwaysDispatchingPrettyPrinter(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 15 | get_terminal_width | def | function | def get_terminal_width() -> int:
width, _ = shutil.get_terminal_size(fallback=(80, 24))
# The Windows get_terminal_size may be bogus, let's sanify a bit.
if width < 40:
width = 80
return width
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 25 | should_do_markup | def | function | def should_do_markup(file: TextIO) -> bool:
if os.environ.get("PY_COLORS") == "1":
return _True
if os.environ.get("PY_COLORS") == "0":
return _False
if "NO_COLOR" in os.environ:
return _False
if "FORCE_COLOR" in os.environ:
return _True
return (
hasattr(file, ... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 40 | TerminalWriter | def | class | __init__ fullwidth fullwidth width_of_current_line markup sep write line flush _write_source _highlight |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 73 | AnsiToWin32 | ref | function | file = colorama.AnsiToWin32(file).stream
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 76 | should_do_markup | ref | function | self.hasmarkup = should_do_markup(file)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 82 | fullwidth | def | function | def fullwidth(self) -> int:
if self._terminal_width is not None:
return self._terminal_width
return get_terminal_width()
@fullwidth.setter
def fullwidth(self, value: int) -> None:
self._terminal_width = value
@property
def width_of_current_line(self) -> int:
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 85 | get_terminal_width | ref | function | return get_terminal_width()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 88 | fullwidth | def | function | def fullwidth(self, value: int) -> None:
self._terminal_width = value
@property
def width_of_current_line(self) -> int:
"""Return an estimate of the width so far in the current line."""
return wcswidth(self._current_line)
def markup(self, text: str, **markup: bool) -> str:
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 92 | width_of_current_line | def | function | def width_of_current_line(self) -> int:
"""Return an estimate of the width so far in the current line."""
return wcswidth(self._current_line)
def markup(self, text: str, **markup: bool) -> str:
for name in markup:
if name not in self._esctable:
raise ValueErr... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 94 | wcswidth | ref | function | return wcswidth(self._current_line)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 96 | markup | def | function | def markup(self, text: str, **markup: bool) -> str:
for name in markup:
if name not in self._esctable:
raise ValueError(f"unknown markup: {name!r}")
if self.hasmarkup:
esc = [self._esctable[name] for name, on in markup.items() if on]
if esc:
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 106 | sep | def | function | def sep(
self,
sepchar: str,
title: Optional[str] = None,
fullwidth: Optional[int] = None,
**markup: bool,
) -> None:
if fullwidth is None:
fullwidth = self.fullwidth
# The goal is to have the line be as long as possible
# under the con... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 141 | line | ref | function | self.line(line, **markup)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 151 | markup | ref | function | msg = self.markup(msg, **markup)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 162 | decode | ref | function | msg = msg.encode("unicode-escape").decode("ascii")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 168 | line | def | function | def line(self, s: str = "", **markup: bool) -> None:
self.write(s, **markup)
self.write("\n")
def flush(self) -> None:
self._file.flush()
def _write_source(self, lines: Sequence[str], indents: Sequence[str] = ()) -> None:
"""Write lines of source code possibly highlighted.
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 175 | _write_source | def | function | def _write_source(self, lines: Sequence[str], indents: Sequence[str] = ()) -> None:
"""Write lines of source code possibly highlighted.
Keeping this private for now because the API is clunky. We should discuss how
to evolve the terminal writer so we can have more precise color support, for ... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 191 | _highlight | ref | function | new_lines = self._highlight(source).splitlines()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 193 | line | ref | function | self.line(indent + new_line)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 195 | _highlight | def | function | def _highlight(self, source: str) -> str:
"""Highlight the given source code if we have markup support."""
from _pytest.config.exceptions import UsageError
if not self.hasmarkup or not self.code_highlight:
return source
try:
from pygments.formatters.terminal ... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 220 | UsageError | ref | function | raise UsageError(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/terminalwriter.py | src/_pytest/_io/terminalwriter.py | 227 | UsageError | ref | function | raise UsageError(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/wcwidth.py | src/_pytest/_io/wcwidth.py | 5 | wcwidth | def | function | def wcwidth(c: str) -> int:
"""Determine how many columns are needed to display a character in a terminal.
Returns -1 if the character is not printable.
Returns 0, 1 or 2 for other characters.
"""
o = ord(c)
# ASCII fast path.
if 0x20 <= o < 0x07F:
return 1
# Some Cf/Zp/Zl cha... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/wcwidth.py | src/_pytest/_io/wcwidth.py | 43 | wcswidth | def | function | def wcswidth(s: str) -> int:
"""Determine how many columns are needed to display a string in a terminal.
Returns -1 if the string contains non-printable characters.
"""
width = 0
for c in unicodedata.normalize("NFC", s):
wc = wcwidth(c)
if wc < 0:
return -1
width... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/_io/wcwidth.py | src/_pytest/_io/wcwidth.py | 50 | wcwidth | ref | function | wc = wcwidth(c)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 21 | pytest_addoption | def | function | def pytest_addoption(parser: Parser) -> None:
group = parser.getgroup("debugconfig")
group.addoption(
"--assert",
action="store",
dest="assertmode",
choices=("rewrite", "plain"),
default="rewrite",
metavar="MODE",
help=(
"Control assertion debu... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 22 | getgroup | ref | function | group = parser.getgroup("debugconfig")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 23 | addoption | ref | function | group.addoption(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 37 | addini | ref | function | parser.addini(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 46 | register_assert_rewrite | def | function | def register_assert_rewrite(*names: str) -> None:
"""Register one or more module names to be rewritten on import.
This function will make sure that this module or all modules inside
the package will get their assert statements rewritten.
Thus you should make sure to call this before the module is
a... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 68 | DummyRewriteHook | ref | function | importhook = DummyRewriteHook() # type: ignore
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 69 | mark_rewrite | ref | function | importhook.mark_rewrite(*names)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 72 | DummyRewriteHook | def | class | mark_rewrite |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 75 | mark_rewrite | def | function | def mark_rewrite(self, *names: str) -> None:
pass
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 79 | AssertionState | def | class | __init__ |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 88 | install_importhook | def | function | def install_importhook(config: Config) -> rewrite.AssertionRewritingHook:
"""Try to install the rewrite hook, raise SystemError if it fails."""
config.stash[assertstate_key] = AssertionState(config, "rewrite")
config.stash[assertstate_key].hook = hook = rewrite.AssertionRewritingHook(config)
sys.meta_pa... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 90 | AssertionState | ref | function | config.stash[assertstate_key] = AssertionState(config, "rewrite")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 91 | AssertionRewritingHook | ref | function | config.stash[assertstate_key].hook = hook = rewrite.AssertionRewritingHook(config)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 93 | trace | ref | function | config.stash[assertstate_key].trace("installed rewrite import hook")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 95 | undo | def | function | def undo() -> None:
hook = config.stash[assertstate_key].hook
if hook is not None and hook in sys.meta_path:
sys.meta_path.remove(hook)
config.add_cleanup(undo)
return hook
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 100 | add_cleanup | ref | function | config.add_cleanup(undo)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/assertion/__init__.py | src/_pytest/assertion/__init__.py | 104 | pytest_collection | def | function | def pytest_collection(session: "Session") -> None:
# This hook is only called when test modules are collected
# so for example not in the managing process of pytest-xdist
# (which does not collect test modules).
assertstate = session.config.stash.get(assertstate_key, None)
if assertstate:
if... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.