Repository: psf/black
File: src/black/__init__.py (Python)

Code before:

            normalized_path = "/" + normalized_path
            # Hard-exclude any files that matches the `--force-exclude` regex.
            if force_exclude:
                force_exclude_match = force_exclude.search(normalized_path)
            else:
                force_exclude_match = None
            if force_exclude_match and force_exclude_match.group(0):
                report.path_ignored(p, "matches the --force-exclude regular expression")
                continue

            if is_stdin:
                p = Path(f"{STDIN_PLACEHOLDER}{str(p)}")

            if p.suffix == ".ipynb" and not jupyter_dependencies_are_installed(
                verbose=verbose, quiet=quiet
            ):
                continue

            sources.add(p)
        elif p.is_dir():
            if exclude is None:
                exclude = re_compile_maybe_verbose(DEFAULT_EXCLUDES)
                gitignore = get_gitignore(root)
                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).
                if gitignore != p_gitignore:
                    gitignore += p_gitignore
            else:
                gitignore = None
            sources.update(
                gen_python_files(
                    p.iterdir(),
                    ctx.obj["root"],
                    include,
                    exclude,
                    extend_exclude,
                    force_exclude,
                    report,
                    gitignore,
                    verbose=verbose,
                    quiet=quiet,
                )
            )
        elif s == "-":
            sources.add(p)
        else:
            err(f"invalid path: {s}")
    return sources


Review comment (suggestion):
```suggestion
            if using_default_exclude:
```

Code after:
        if is_stdin or p.is_file():
            normalized_path = normalize_path_maybe_ignore(p, ctx.obj["root"], report)
            if normalized_path is None:
                continue

            normalized_path = "/" + normalized_path
            # Hard-exclude any files that matches the `--force-exclude` regex.
            if force_exclude:
                force_exclude_match = force_exclude.search(normalized_path)
            else:
                force_exclude_match = None
            if force_exclude_match and force_exclude_match.group(0):
                report.path_ignored(p, "matches the --force-exclude regular expression")
                continue

            if is_stdin:
                p = Path(f"{STDIN_PLACEHOLDER}{str(p)}")

            if p.suffix == ".ipynb" and not jupyter_dependencies_are_installed(
                verbose=verbose, quiet=quiet
            ):
                continue

            sources.add(p)
        elif p.is_dir():
            if exclude_is_None:
                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).
                if root_gitignore == p_gitignore:
                    gitignore = root_gitignore
                else:
                    gitignore = root_gitignore + p_gitignore
            sources.update(
                gen_python_files(
                    p.iterdir(),
                    ctx.obj["root"],
                    include,
                    exclude,
                    extend_exclude,
                    force_exclude,
                    report,
                    gitignore,
                    verbose=verbose,
                    quiet=quiet,
                )
            )
        elif s == "-":
            sources.add(p)
        else:
            err(f"invalid path: {s}")