Skip to content

Commit

Permalink
Adapt to new darkgraylib.find_project_root()
Browse files Browse the repository at this point in the history
- needs hashable input sequence of paths
- doesn't return method of finding the root
  • Loading branch information
akaihola committed Mar 8, 2024
1 parent 5181d04 commit b1e4435
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/darker/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions src/darker/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/darker/import_sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b1e4435

Please sign in to comment.