Skip to content

Commit

Permalink
print debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Mar 21, 2024
1 parent 93193f4 commit bd6d608
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/black/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,13 +760,16 @@ def get_sources(

# Compare the logic here to the logic in `gen_python_files`.
if is_stdin or path.is_file():
print("a", path, root)
if resolves_outside_root_or_cannot_stat(path, root, report):
if verbose:
out(f'Skipping invalid source: "{path}"', fg="red")
continue
print("e", path, root)

root_relative_path = best_effort_relative_path(path, root).as_posix()
root_relative_path = "/" + root_relative_path
print("f", root_relative_path)

# Hard-exclude any files that matches the `--force-exclude` regex.
if path_is_excluded(root_relative_path, force_exclude):
Expand Down
3 changes: 3 additions & 0 deletions src/black/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ def resolves_outside_root_or_cannot_stat(
Returns whether the path is a symbolic link that points outside the
root directory. Also returns True if we failed to resolve the path.
"""
print("b", path, root)
try:
if sys.version_info < (3, 8, 6):
path = path.absolute() # https://bugs.python.org/issue33660
Expand All @@ -276,12 +277,14 @@ def resolves_outside_root_or_cannot_stat(
if report:
report.path_ignored(path, f"cannot be read because {e}")
return True
print("c", resolved_path, root)
try:
resolved_path.relative_to(root)
except ValueError:
if report:
report.path_ignored(path, f"is a symbolic link that points outside {root}")
return True
print("d")
return False


Expand Down

0 comments on commit bd6d608

Please sign in to comment.