[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2026-07-08 06:21:40 +00:00
commit 3bb40e47fe
2 changed files with 4 additions and 13 deletions

View file

@ -457,12 +457,7 @@ def main():
# `-r`-only cell no-ops (has_target stays False) and an attached
# `-c`/`-e`/`-P` value bypasses _KEEP. Split the 2-char flag from its
# value and reuse the separated-form handling.
if (
len(tok) > 2
and tok[0] == "-"
and tok[1] != "-"
and tok[:2] in _ATTACHED_SHORT_FLAGS
):
if len(tok) > 2 and tok[0] == "-" and tok[1] != "-" and tok[:2] in _ATTACHED_SHORT_FLAGS:
_sflag, _sval = tok[:2], tok[2:]
if _sflag in _REQ_FILE_FLAGS:
_req_path, _req_rec, _req_drp = _filter_requirements_file(_sval)

View file

@ -225,8 +225,7 @@ def test_index_url_value_flag_kept_verbatim(shim):
def test_editable_protected_in_requirements_file_dropped(shim, tmp_path):
req = tmp_path / "reqs.txt"
req.write_text(
"-e git+https://github.com/unslothai/unsloth.git#egg=unsloth\n"
"snac==1.2.0\n",
"-e git+https://github.com/unslothai/unsloth.git#egg=unsloth\nsnac==1.2.0\n",
encoding = "utf-8",
)
execd, _ = _run(shim, "pip", ["-r", str(req)])
@ -239,8 +238,7 @@ def test_editable_protected_in_requirements_file_dropped(shim, tmp_path):
def test_editable_attached_protected_in_requirements_file_dropped(shim, tmp_path):
req = tmp_path / "reqs.txt"
req.write_text(
"-egit+https://github.com/unslothai/unsloth.git#egg=unsloth\n"
"snac==1.2.0\n",
"-egit+https://github.com/unslothai/unsloth.git#egg=unsloth\nsnac==1.2.0\n",
encoding = "utf-8",
)
execd, _ = _run(shim, "pip", ["-r", str(req)])
@ -255,9 +253,7 @@ def test_editable_unprotected_in_requirements_file_kept(shim, tmp_path):
# (torch dropped); only protected editables are stripped.
req = tmp_path / "reqs.txt"
req.write_text(
"-e ./localpkg\n"
"torch==2.11.0\n"
"snac==1.2.0\n",
"-e ./localpkg\ntorch==2.11.0\nsnac==1.2.0\n",
encoding = "utf-8",
)
execd, _ = _run(shim, "pip", ["-r", str(req)])