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/nodes.py | src/_pytest/nodes.py | 687 | runtest | def | function | def runtest(self) -> None:
raise NotImplementedError("runtest must be implemented by Item subclass")
def add_report_section(self, when: str, key: str, content: str) -> None:
"""Add a new report section, similar to what's done internally to add
stdout and stderr captured output::
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nodes.py | src/_pytest/nodes.py | 690 | add_report_section | def | function | def add_report_section(self, when: str, key: str, content: str) -> None:
"""Add a new report section, similar to what's done internally to add
stdout and stderr captured output::
item.add_report_section("call", "stdout", "report section contents")
:param str when:
O... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nodes.py | src/_pytest/nodes.py | 707 | reportinfo | def | function | def reportinfo(self) -> Tuple[Union["os.PathLike[str]", str], Optional[int], str]:
return self.path, None, ""
@cached_property
def location(self) -> Tuple[str, Optional[int], str]:
location = self.reportinfo()
path = absolutepath(os.fspath(location[0]))
relfspath = self.sess... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nodes.py | src/_pytest/nodes.py | 711 | location | def | function | def location(self) -> Tuple[str, Optional[int], str]:
location = self.reportinfo()
path = absolutepath(os.fspath(location[0]))
relfspath = self.session._node_location_to_relpath(path)
assert type(location[2]) is str
return (relfspath, location[1], location[2])
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nodes.py | src/_pytest/nodes.py | 712 | reportinfo | ref | function | location = self.reportinfo()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nodes.py | src/_pytest/nodes.py | 713 | absolutepath | ref | function | path = absolutepath(os.fspath(location[0]))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nodes.py | src/_pytest/nodes.py | 714 | _node_location_to_relpath | ref | function | relfspath = self.session._node_location_to_relpath(path)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nose.py | src/_pytest/nose.py | 8 | hookimpl | ref | function | @hookimpl(trylast=True)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nose.py | src/_pytest/nose.py | 9 | pytest_runtest_setup | def | function | def pytest_runtest_setup(item: Item) -> None:
if not isinstance(item, Function):
return
# Don't do nose style setup/teardown on direct unittest style classes.
if isinstance(item, TestCaseFunction):
return
# Capture the narrowed type of item for the teardown closure,
# see https://gi... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nose.py | src/_pytest/nose.py | 20 | call_optional | ref | function | call_optional(func.obj, "setup")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nose.py | src/_pytest/nose.py | 21 | addfinalizer | ref | function | func.addfinalizer(lambda: call_optional(func.obj, "teardown"))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nose.py | src/_pytest/nose.py | 21 | call_optional | ref | function | func.addfinalizer(lambda: call_optional(func.obj, "teardown"))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nose.py | src/_pytest/nose.py | 29 | call_optional | def | function | def call_optional(obj: object, name: str) -> bool:
method = getattr(obj, name, None)
if method is None:
return _False
is_fixture = getfixturemarker(method) is not None
if is_fixture:
return _False
if not callable(method):
return _False
# If there are any problems allow th... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nose.py | src/_pytest/nose.py | 33 | getfixturemarker | ref | function | is_fixture = getfixturemarker(method) is not None
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/nose.py | src/_pytest/nose.py | 40 | method | ref | function | method()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 27 | OutcomeException | def | class | __init__ __repr__ |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 53 | Skipped | def | class | __init__ |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 73 | Failed | def | class | |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 79 | Exit | def | class | __init__ |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 97 | _WithException | def | class | |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 102 | _with_exception | def | function | def _with_exception(exception_type: _ET) -> Callable[[_F], _WithException[_F, _ET]]:
def decorate(func: _F) -> _WithException[_F, _ET]:
func_with_exception = cast(_WithException[_F, _ET], func)
func_with_exception.Exception = exception_type
return func_with_exception
return decorate
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 103 | decorate | def | function | def decorate(func: _F) -> _WithException[_F, _ET]:
func_with_exception = cast(_WithException[_F, _ET], func)
func_with_exception.Exception = exception_type
return func_with_exception
return decorate
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 114 | _with_exception | ref | function | @_with_exception(Exit)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 134 | UsageError | ref | function | raise UsageError(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 139 | UsageError | ref | function | raise UsageError("exit() requires a reason argument")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 142 | Exit | ref | function | raise Exit(reason, returncode)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 145 | _with_exception | ref | function | @_with_exception(Skipped)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 146 | skip | def | function | def skip(
reason: str = "", *, allow_module_level: bool = _False, msg: Optional[str] = None
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 173 | _resolve_msg_to_reason | ref | function | reason = _resolve_msg_to_reason("skip", reason, msg)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 174 | Skipped | ref | function | raise Skipped(msg=reason, allow_module_level=allow_module_level)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 177 | _with_exception | ref | function | @_with_exception(Failed)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 178 | fail | def | function | def fail(
reason: str = "", pytrace: bool = _True, msg: Optional[str] = None
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 194 | _resolve_msg_to_reason | ref | function | reason = _resolve_msg_to_reason("fail", reason, msg)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 195 | Failed | ref | function | raise Failed(msg=reason, pytrace=pytrace)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 198 | _resolve_msg_to_reason | def | function | def _resolve_msg_to_reason(
func_name: str, reason: str, msg: Optional[str] = None
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 227 | UsageError | ref | function | raise UsageError(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 235 | XFailed | def | class | |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 239 | _with_exception | ref | function | @_with_exception(XFailed)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 240 | xfail | def | function | def xfail(reason: str = "") -> "NoReturn":
"""Imperatively xfail an executing test or setup function with the given reason.
This function should be called only during testing (setup, call or teardown).
.. note::
It is better to use the :ref:`pytest.mark.xfail ref` marker when
possible to d... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 251 | XFailed | ref | function | raise XFailed(reason)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 254 | importorskip | def | function | def importorskip(
modname: str, minversion: Optional[str] = None, reason: Optional[str] = None
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 291 | Skipped | ref | function | raise Skipped(reason, allow_module_level=True) from None
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/outcomes.py | src/_pytest/outcomes.py | 301 | Skipped | ref | function | raise Skipped(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 17 | pytest_addoption | def | function | def pytest_addoption(parser: Parser) -> None:
group = parser.getgroup("terminal reporting")
group._addoption(
"--pastebin",
metavar="mode",
action="store",
dest="pastebin",
default=None,
choices=["failed", "all"],
help="send failed|all info to bpaste.net p... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 18 | getgroup | ref | function | group = parser.getgroup("terminal reporting")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 19 | _addoption | ref | function | group._addoption(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 30 | hookimpl | ref | function | @pytest.hookimpl(trylast=True)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 31 | pytest_configure | def | function | def pytest_configure(config: Config) -> None:
if config.option.pastebin == "all":
tr = config.pluginmanager.getplugin("terminalreporter")
# If no terminal reporter plugin is present, nothing we can do here;
# this can happen when this function executes in a worker node
# when using p... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 33 | getplugin | ref | function | tr = config.pluginmanager.getplugin("terminalreporter")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 42 | tee_write | def | function | def tee_write(s, **kwargs):
oldwrite(s, **kwargs)
if isinstance(s, str):
s = s.encode("utf-8")
config.stash[pastebinfile_key].write(s)
tr._tw.write = tee_write
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 43 | oldwrite | ref | function | oldwrite(s, **kwargs)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 51 | pytest_unconfigure | def | function | def pytest_unconfigure(config: Config) -> None:
if pastebinfile_key in config.stash:
pastebinfile = config.stash[pastebinfile_key]
# Get terminal contents and delete file.
pastebinfile.seek(0)
sessionlog = pastebinfile.read()
pastebinfile.close()
del config.stash[past... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 60 | getplugin | ref | function | tr = config.pluginmanager.getplugin("terminalreporter")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 63 | write_sep | ref | function | tr.write_sep("=", "Sending information to Paste Service")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 64 | create_new_paste | ref | function | pastebinurl = create_new_paste(sessionlog)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 65 | write_line | ref | function | tr.write_line("pastebin session-log: %s\n" % pastebinurl)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 68 | create_new_paste | def | function | def create_new_paste(contents: Union[str, bytes]) -> str:
"""Create a new paste using the bpaste.net service.
:contents: Paste contents string.
:returns: URL to the pasted contents, or an error message.
"""
import re
from urllib.request import urlopen
from urllib.parse import urlencode
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 82 | decode | ref | function | urlopen(url, data=urlencode(params).encode("ascii")).read().decode("utf-8")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 88 | group | ref | function | return f"{url}/show/{m.group(1)}"
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 93 | pytest_terminal_summary | def | function | def pytest_terminal_summary(terminalreporter: TerminalReporter) -> None:
if terminalreporter.config.option.pastebin != "failed":
return
if "failed" in terminalreporter.stats:
terminalreporter.write_sep("=", "Sending information to Paste Service")
for rep in terminalreporter.stats["failed... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 97 | write_sep | ref | function | terminalreporter.write_sep("=", "Sending information to Paste Service")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 102 | _getfailureheadline | ref | function | msg = terminalreporter._getfailureheadline(rep)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 104 | create_terminal_writer | ref | function | tw = create_terminal_writer(terminalreporter.config, file)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 105 | toterminal | ref | function | rep.toterminal(tw)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 108 | create_new_paste | ref | function | pastebinurl = create_new_paste(s)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pastebin.py | src/_pytest/pastebin.py | 109 | write_line | ref | function | terminalreporter.write_line(f"{msg} --> {pastebinurl}")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 54 | _ignore_error | def | function | def _ignore_error(exception):
return (
getattr(exception, "errno", None) in _IGNORED_ERRORS
or getattr(exception, "winerror", None) in _IGNORED_WINERRORS
)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 61 | get_lock_path | def | function | def get_lock_path(path: _AnyPurePath) -> _AnyPurePath:
return path.joinpath(".lock")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 62 | joinpath | ref | function | return path.joinpath(".lock")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 65 | on_rm_rf_error | def | function | def on_rm_rf_error(func, path: str, exc, *, start_path: Path) -> bool:
"""Handle known read-only errors during rmtree.
The returned value is used only by our own tests.
"""
exctype, excvalue = exc[:2]
# Another process removed the file in the middle of the "rm_rf" (xdist for example).
# More c... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 79 | PytestWarning | ref | function | PytestWarning(f"(rm_rf) error removing {path}\n{exctype}: {excvalue}")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 86 | PytestWarning | ref | function | PytestWarning(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 97 | chmod_rw | def | function | def chmod_rw(p: str) -> None:
mode = os.stat(p).st_mode
os.chmod(p, mode | stat.S_IRUSR | stat.S_IWUSR)
# For files, we need to recursively go upwards in the directories to
# ensure they all are also writable.
p = Path(path)
if p.is_file():
for parent in p.parents:
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 103 | Path | ref | function | p = Path(path)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 104 | is_file | ref | function | if p.is_file():
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 106 | chmod_rw | ref | function | chmod_rw(str(parent))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 110 | chmod_rw | ref | function | chmod_rw(str(path))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 112 | func | ref | function | func(path)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 116 | ensure_extended_length_path | def | function | def ensure_extended_length_path(path: Path) -> Path:
"""Get the extended-length version of a path (Windows).
On Windows, by default, the maximum length of a path (MAX_PATH) is 260
characters, and operations on paths longer than that fail. But it is possible
to overcome this by converting the path to "e... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 129 | resolve | ref | function | path = path.resolve()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 130 | Path | ref | function | path = Path(get_extended_length_path_str(str(path)))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 130 | get_extended_length_path_str | ref | function | path = Path(get_extended_length_path_str(str(path)))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 134 | get_extended_length_path_str | def | function | def get_extended_length_path_str(path: str) -> str:
"""Convert a path to a Windows extended length path."""
long_path_prefix = "\\\\?\\"
unc_long_path_prefix = "\\\\?\\UNC\\"
if path.startswith((long_path_prefix, unc_long_path_prefix)):
return path
# UNC
if path.startswith("\\\\"):
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 146 | rm_rf | def | function | def rm_rf(path: Path) -> None:
"""Remove the path contents recursively, even if some elements
are read-only."""
path = ensure_extended_length_path(path)
onerror = partial(on_rm_rf_error, start_path=path)
shutil.rmtree(str(path), onerror=onerror)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 149 | ensure_extended_length_path | ref | function | path = ensure_extended_length_path(path)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 154 | find_prefixed | def | function | def find_prefixed(root: Path, prefix: str) -> Iterator[Path]:
"""Find all elements in root that begin with the prefix, case insensitive."""
l_prefix = prefix.lower()
for x in root.iterdir():
if x.name.lower().startswith(l_prefix):
yield x
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 157 | iterdir | ref | function | for x in root.iterdir():
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 162 | extract_suffixes | def | function | def extract_suffixes(iter: Iterable[PurePath], prefix: str) -> Iterator[str]:
"""Return the parts of the paths following the prefix.
:param iter: Iterator over path names.
:param prefix: Expected prefix of the path names.
"""
p_len = len(prefix)
for p in iter:
yield p.name[p_len:]
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 173 | find_suffixes | def | function | def find_suffixes(root: Path, prefix: str) -> Iterator[str]:
"""Combine find_prefixes and extract_suffixes."""
return extract_suffixes(find_prefixed(root, prefix), prefix)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 175 | extract_suffixes | ref | function | return extract_suffixes(find_prefixed(root, prefix), prefix)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 175 | find_prefixed | ref | function | return extract_suffixes(find_prefixed(root, prefix), prefix)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 178 | parse_num | def | function | def parse_num(maybe_num) -> int:
"""Parse number path suffixes, returns -1 on error."""
try:
return int(maybe_num)
except ValueError:
return -1
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 186 | _force_symlink | def | function | def _force_symlink(
root: Path, target: Union[str, PurePath], link_to: Union[str, Path]
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 197 | joinpath | ref | function | current_symlink = root.joinpath(target)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 203 | symlink_to | ref | function | current_symlink.symlink_to(link_to)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 208 | make_numbered_dir | def | function | def make_numbered_dir(root: Path, prefix: str, mode: int = 0o700) -> Path:
"""Create a directory with an increased number as suffix for the given prefix."""
for i in range(10):
# try up to 10 times to create the folder
max_existing = max(map(parse_num, find_suffixes(root, prefix)), default=-1)
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 212 | find_suffixes | ref | function | max_existing = max(map(parse_num, find_suffixes(root, prefix)), default=-1)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 214 | joinpath | ref | function | new_path = root.joinpath(f"{prefix}{new_number}")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 220 | _force_symlink | ref | function | _force_symlink(root, prefix + "current", new_path)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/pathlib.py | src/_pytest/pathlib.py | 229 | create_cleanup_lock | def | function | def create_cleanup_lock(p: Path) -> Path:
"""Create a lock to prevent premature folder cleanup."""
lock_path = get_lock_path(p)
try:
fd = os.open(str(lock_path), os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o644)
except FileExistsError as e:
raise OSError(f"cannot create lockfile in {p}") from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.