Path.suffix
Path.suffix(...)Description
Documentation for Path.suffix.
Real-World Examples
Practical code examples showing how Path.suffix is used in real projects.
def load_configs_from_disk(input_dir: Path) -> Iterator[ConfigFile]:
"""Load configs from disk cache."""
for filepath in input_dir.glob("*.lua"):
if filepath.name.endswith(".meta"):
continue
meta_path = filepath.with_suffix(".lua.meta")
content = filepath.read_text(encoding="utf-8")
# Parse metadata if exists
meta = {}
if meta_path.exists():
for line in meta_path.read_text().splitlines():
if "=" in line:
k, v = line.split("=", 1)
meta[k] = v
parts = filepath.stem.split("__", 1)
owner = parts[0] if len(parts) > 1 else "unknown"
name = parts[1] if len(parts) > 1 else filepath.stem
yield ConfigFile(
repo=RepoInfo(
owner=owner,
name=name,
url=meta.get("url", ""),
is_truncated = value == "..."
is_last = (i == len(sorted_items) - 1)
connector = "└── " if is_last else "├── "
next_prefix = prefix + (" " if is_last else "│ ")
suffix = "/" if is_directory or is_truncated else ""
lines.append(f"{prefix}{connector}{key}{suffix}")
if is_directory and value:
build_lines(value, next_prefix)
root_name = f"📦 {owner}/{name}/tree/{branch}/{subpath}" if subpath else f"📦 {owner}/{name}/tree/{bran...
lines.append(root_name)
build_lines(tree_dict)
return lines
tree_lines = format_tree(paths, max_depth)
chunks = []
current_chunk = []
current_len = 0
for line in tree_lines:
if len(line) > MAX_CONTENT_CHARS: