From 44cfd6c312195824122a58285d761ff1a7ba4ad8 Mon Sep 17 00:00:00 2001 From: Shivansh-007 Date: Tue, 2 Nov 2021 10:05:00 +0530 Subject: [PATCH] Document the new return value in docstring --- src/black/__init__.py | 8 +++++++- src/black/files.py | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/black/__init__.py b/src/black/__init__.py index 9b251200a91..143f6c4a686 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -508,7 +508,13 @@ def get_sources( report: "Report", stdin_filename: Optional[str], ) -> Tuple[Set[Path], Path]: - """Compute the set of files to be formatted.""" + """ + Compute the set of files to be formatted. + + Returns a tuple, with the first element as a set of paths which are to be + checked/formatted by black, and the second element as the project root + found out by black. + """ root, method = find_project_root(src) if verbose: diff --git a/src/black/files.py b/src/black/files.py index 7e39f96d9d4..b7a8723c47b 100644 --- a/src/black/files.py +++ b/src/black/files.py @@ -38,6 +38,11 @@ def find_project_root(srcs: Sequence[str]) -> Tuple[Path, Optional[str]]: If no directory in the tree contains a marker that would specify it's the project root, the root of the file system is returned. + + Returns a tuple with the first element as the project root path and the + second element as a string which describes the method by which black + found out the project root (None, if `None` of the registered method + was used). """ if not srcs: srcs = [str(Path.cwd().resolve())]