MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / _walk

Function _walk

Scripts/Developer Base/Tree Explorer.py:413–440  ·  view source on GitHub ↗
(cur: Path, depth: int, prefix: str)

Source from the content-addressed store, hash-verified

411 lines.append(colorize(str(path), root_mode, no_color))
412
413 def _walk(cur: Path, depth: int, prefix: str) -> None:
414 if max_depth != -1 and depth > max_depth:
415 return
416
417 need_sizes = show_size or sort_by_size
418 ents = scan_entries(
419 cur,
420 dirs_only=dirs_only,
421 include_hidden=include_hidden,
422 need_sizes=need_sizes,
423 sort_by_size=sort_by_size,
424 follow_symlinks=follow_symlinks,
425 ignore=ignore,
426 only=only,
427 )
428
429 for idx, e in enumerate(ents):
430 last = (idx == len(ents) - 1)
431 branch = "└── " if last else "├── "
432 next_prefix = prefix + (" " if last else "│ ")
433
434 label = colorize(e.name, e.mode, no_color)
435 if show_size:
436 label += f" [{format_size(e.total_size)}]"
437 lines.append(prefix + branch + label)
438
439 if e.is_dir:
440 _walk(e.path, depth + 1, next_prefix)
441
442 if path.is_dir():
443 _walk(path, 1, "")

Callers 4

build_tree_textFunction · 0.70
build_jsonFunction · 0.70
list_top_largest_filesFunction · 0.70
iter_pathsFunction · 0.70

Calls 7

scan_entriesFunction · 0.70
colorizeFunction · 0.70
format_sizeFunction · 0.70
file_valueFunction · 0.70
safe_lstatFunction · 0.70
match_anyFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected