diff --git a/docker/unsloth_pip_shim.py b/docker/unsloth_pip_shim.py index 39f0fdebab..9d64b7f726 100644 --- a/docker/unsloth_pip_shim.py +++ b/docker/unsloth_pip_shim.py @@ -279,7 +279,6 @@ def _local_project_name(token): if os.path.isfile(_pyproject): try: import tomllib - with open(_pyproject, "rb") as f: _name = (tomllib.load(f).get("project") or {}).get("name") if _name: diff --git a/tests/python/test_unsloth_nb_pip_magic.py b/tests/python/test_unsloth_nb_pip_magic.py index 6d4483d638..3e6b3b975a 100644 --- a/tests/python/test_unsloth_nb_pip_magic.py +++ b/tests/python/test_unsloth_nb_pip_magic.py @@ -43,10 +43,7 @@ def test_sys_executable_braces_spaced_rewritten(): def test_absolute_interpreter_path_rewritten(): - assert ( - _rewrite("!/opt/unsloth-venv/bin/python -m pip install peft\n") - == "!pip install peft\n" - ) + assert _rewrite("!/opt/unsloth-venv/bin/python -m pip install peft\n") == "!pip install peft\n" def test_absolute_interpreter_versioned_path_rewritten(): @@ -54,10 +51,7 @@ def test_absolute_interpreter_versioned_path_rewritten(): def test_quoted_interpreter_path_rewritten(): - assert ( - _rewrite('!"/opt/unsloth venv/bin/python" -m pip install peft') - == "!pip install peft" - ) + assert _rewrite('!"/opt/unsloth venv/bin/python" -m pip install peft') == "!pip install peft" def test_indent_preserved(): diff --git a/tests/python/test_unsloth_pip_shim.py b/tests/python/test_unsloth_pip_shim.py index 0620e88928..639afafaaf 100644 --- a/tests/python/test_unsloth_pip_shim.py +++ b/tests/python/test_unsloth_pip_shim.py @@ -663,9 +663,7 @@ def test_uv_exact_flag_stripped(shim): def _make_local_project(tmp_path, dirname, project_name): proj = tmp_path / dirname proj.mkdir() - (proj / "pyproject.toml").write_text( - f'[project]\nname = "{project_name}"\nversion = "1.0"\n' - ) + (proj / "pyproject.toml").write_text(f'[project]\nname = "{project_name}"\nversion = "1.0"\n') return str(proj)