From f12b6d1bd97fc5de7d5e4a1a412540cc7d783444 Mon Sep 17 00:00:00 2001 From: Antonio Ossa Guerra Date: Sun, 6 Nov 2022 18:31:20 -0300 Subject: [PATCH] Small refactor to improve code readability These changes are small improvements to improve code readability: rename a variable to a more descriptive name (from `exclude_is_None` to `using_default_exclude`), use a better syntax to include the type annotation for `gitignore` variable (from typing comment to Python-style typing annotation) Signed-off-by: Antonio Ossa Guerra --- src/black/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/black/__init__.py b/src/black/__init__.py index 8de16cefea4..2d07cf31f61 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -628,9 +628,9 @@ def get_sources( sources: Set[Path] = set() root = ctx.obj["root"] - exclude_is_None = exclude is None + using_default_exclude = exclude is None exclude = re_compile_maybe_verbose(DEFAULT_EXCLUDES) if exclude is None else exclude - gitignore = None # type: Optional[PathSpec] + gitignore: Optional[PathSpec] = None root_gitignore = get_gitignore(root) for s in src: @@ -666,7 +666,7 @@ def get_sources( sources.add(p) elif p.is_dir(): - if exclude_is_None: + if using_default_exclude: p_gitignore = get_gitignore(p) # No need to use p's gitignore if it is identical to root's gitignore # (i.e. root and p point to the same directory).