Skip to content

Commit

Permalink
Small refactor to improve code readability
Browse files Browse the repository at this point in the history
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 <aaossa@uc.cl>
  • Loading branch information
aaossa committed Nov 6, 2022
1 parent 320f582 commit f12b6d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/black/__init__.py
Expand Up @@ -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:
Expand Down Expand Up @@ -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).
Expand Down

0 comments on commit f12b6d1

Please sign in to comment.