(path: Path, depth: int)
| 209 | files = [] |
| 210 | |
| 211 | def walk(path: Path, depth: int): |
| 212 | if depth > max_depth or should_exclude(path): |
| 213 | return |
| 214 | try: |
| 215 | for item in sorted(path.iterdir()): |
| 216 | if should_exclude(item): |
| 217 | continue |
| 218 | rel_path = item.relative_to(Path.cwd()) |
| 219 | files.append(str(rel_path)) |
| 220 | if item.is_dir(): |
| 221 | walk(item, depth + 1) |
| 222 | except (PermissionError, OSError): |
| 223 | pass |
| 224 | |
| 225 | walk(Path.cwd(), 0) |
| 226 | return files[:TREE_LIMIT] |
no test coverage detected