From b1e4435882caa93e179318bc4d976995a0d2d70c Mon Sep 17 00:00:00 2001 From: Antti Kaihola <13725+akaihola@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:44:53 +0200 Subject: [PATCH] Adapt to new `darkgraylib.find_project_root()` - needs hashable input sequence of paths - doesn't return method of finding the root --- src/darker/__main__.py | 4 ++-- src/darker/files.py | 6 ++---- src/darker/import_sorting.py | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/darker/__main__.py b/src/darker/__main__.py index a894cfc39..3af26d35a 100644 --- a/src/darker/__main__.py +++ b/src/darker/__main__.py @@ -34,8 +34,8 @@ from darker.import_sorting import apply_isort, isort from darker.utils import debug_dump, glob_any from darker.verification import ASTVerifier, BinarySearch, NotEquivalentError -from darkgraylib.black_compat import find_project_root from darkgraylib.config import show_config_if_debug +from darkgraylib.files import find_project_root from darkgraylib.git import ( PRE_COMMIT_FROM_TO_REFS, STDIN, @@ -564,7 +564,7 @@ def main( # pylint: disable=too-many-locals,too-many-branches,too-many-statemen # In other modes, only reformat files which have been modified. if git_is_repository(root): # Get the modified files only. - repo_root = find_project_root([str(root)]) + repo_root = find_project_root((str(root),)) changed_files = { (repo_root / file).relative_to(root) for file in git_get_modified_python_files(paths, revrange, repo_root) diff --git a/src/darker/files.py b/src/darker/files.py index ea42418a5..cc00f7fec 100644 --- a/src/darker/files.py +++ b/src/darker/files.py @@ -5,11 +5,9 @@ from darkgraylib.files import find_project_root -def find_pyproject_toml( - path_search_start: Tuple[str, ...], stdin_filename: Optional[str] = None -) -> Optional[str]: +def find_pyproject_toml(path_search_start: Tuple[str, ...]) -> Optional[str]: """Find the absolute filepath to a pyproject.toml if it exists""" - path_project_root, _ = find_project_root(path_search_start, stdin_filename) + path_project_root = find_project_root(path_search_start) path_pyproject_toml = path_project_root / "pyproject.toml" if path_pyproject_toml.is_file(): return str(path_pyproject_toml) diff --git a/src/darker/import_sorting.py b/src/darker/import_sorting.py index 7239dd3ec..bcf284a60 100644 --- a/src/darker/import_sorting.py +++ b/src/darker/import_sorting.py @@ -8,7 +8,7 @@ from darker.exceptions import IncompatiblePackageError, MissingPackageError from darker.git import EditedLinenumsDiffer from darker.utils import glob_any -from darkgraylib.black_compat import find_project_root +from darkgraylib.files import find_project_root from darkgraylib.utils import DiffChunk, TextDocument try: