From 3dc353b79ceea42deb02ec5702f419591e34971c Mon Sep 17 00:00:00 2001 From: David Hotham Date: Sun, 17 Jul 2022 21:02:00 +0100 Subject: [PATCH 1/3] remove unused list_to_shell_command --- src/poetry/core/utils/_compat.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/poetry/core/utils/_compat.py b/src/poetry/core/utils/_compat.py index 81fa320c9..7b3f59e73 100644 --- a/src/poetry/core/utils/_compat.py +++ b/src/poetry/core/utils/_compat.py @@ -4,13 +4,3 @@ WINDOWS = sys.platform == "win32" - - -def list_to_shell_command(cmd: list[str]) -> str: - executable = cmd[0] - - if " " in executable: - executable = f'"{executable}"' - cmd[0] = executable - - return " ".join(cmd) From cecfcc9696fcfb801cab77f818be3bda10f8c610 Mon Sep 17 00:00:00 2001 From: David Hotham Date: Sun, 17 Jul 2022 21:06:28 +0100 Subject: [PATCH 2/3] remove unused merge_dicts --- src/poetry/core/utils/helpers.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/poetry/core/utils/helpers.py b/src/poetry/core/utils/helpers.py index e538017bc..6f1e96152 100644 --- a/src/poetry/core/utils/helpers.py +++ b/src/poetry/core/utils/helpers.py @@ -7,7 +7,6 @@ import tempfile import unicodedata -from collections.abc import Mapping from contextlib import contextmanager from pathlib import Path from typing import Any @@ -100,14 +99,6 @@ def safe_rmtree(path: str | Path) -> None: shutil.rmtree(path, onerror=_on_rm_error) -def merge_dicts(d1: dict[Any, Any], d2: dict[Any, Any]) -> None: - for k in d2.keys(): - if k in d1 and isinstance(d1[k], dict) and isinstance(d2[k], Mapping): - merge_dicts(d1[k], d2[k]) - else: - d1[k] = d2[k] - - def readme_content_type(path: str | Path) -> str: suffix = Path(path).suffix if suffix == ".rst": From a13048833a7742f1d6c95341d585085b10fead9b Mon Sep 17 00:00:00 2001 From: David Hotham Date: Sun, 17 Jul 2022 21:10:31 +0100 Subject: [PATCH 3/3] typecheck parse_requires --- src/poetry/core/utils/helpers.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/poetry/core/utils/helpers.py b/src/poetry/core/utils/helpers.py index 6f1e96152..cc7a28447 100644 --- a/src/poetry/core/utils/helpers.py +++ b/src/poetry/core/utils/helpers.py @@ -11,7 +11,6 @@ from pathlib import Path from typing import Any from typing import Iterator -from typing import no_type_check from poetry.core.version.pep440 import PEP440Version @@ -42,7 +41,6 @@ def temporary_directory(*args: Any, **kwargs: Any) -> Iterator[str]: safe_rmtree(name) -@no_type_check def parse_requires(requires: str) -> list[str]: lines = requires.split("\n") @@ -61,7 +59,7 @@ def parse_requires(requires: str) -> list[str]: # extras or conditional dependencies marker = line.lstrip("[").rstrip("]") if ":" not in marker: - extra, marker = marker, None + extra, marker = marker, "" else: extra, marker = marker.split(":")