One useful idea
A directory inventory is a collection of facts about files, not an analysis of video contents. The kit contains tiny text files with media suffixes; they are not playable clips. Path.iterdir yields entries in a directory. A recursive helper visits accepted subdirectories; an iterative list of pending directories can do the same job.
Choose the policy before the loop: include real .mp4/.mov/.mkv/.webm files, comparing suffixes with casefold. Skip symbolic links and temporary names at every depth: a leading dot/tilde, a .tmp/.part ending or a .tmp./.part. segment. Refuse a link root, missing root or file root; do not turn unreadable input into an empty successful inventory.
Return exact relative POSIX paths, lowercase suffixes and actual stat byte sizes, then sort case-sensitively by path. Do not sort absolute machine-specific paths. No files change; no codec, duration or quality is inferred. This is a repeatable traversal of unchanged fixtures, not a transactional snapshot or a hostile-filesystem security sandbox.
Refresh first: Path values versus writes, Loops and lists.
Trace a finished example
python -X utf8 demo.py --build 1
# Four records: Café.mkv, Harbour.MP4, camera/detail.mov, editor,notes.webm
# Each has path, extension and its actual filesystem byte size.The root is checked, ignored entries and links are skipped, nested camera is visited and accepted file facts are collected. Sorting the relative strings places the four paths in a repeatable order. The ignored info.txt is not a media record.
The finished implementation is in collection_tools.py. Reading it is guided practice, not independent evidence.
Predict the filter
Does an uppercase .MP4 suffix belong in the inventory?
Compare your answer · self-reviewed
Yes. Compare its casefolded suffix, but retain the original path text as evidence.
Find the hidden traversal bug
Why skip a .hidden directory before walking it?
Compare your answer · self-reviewed
Filtering only final files would still include its nested clips. Apply the directory policy before recursion.
Explain the limit
Does a .mov suffix prove the file contains a valid video?
Compare your answer · self-reviewed
No. It is a naming filter; the supplied fixture is text. Decoding and trusted metadata inspection are later concerns.
Change it, then build your own
One controlled change
Copy one fixture into a new nested directory you control, change its suffix case, then add notes.txt and a hidden folder. Predict which paths survive before running your function.
Your independent task
Implement inventory_media(root) in practice.py. Accept nonempty str/Path for an existing real directory, reject root links, recursively skip the declared temporary/link entries, and include actual files with the four supported suffixes. Return exactly path/extension/bytes records sorted by exact relative POSIX path. Expose invalid-root and filesystem errors. Do not write or rename files.
What success looks like
Four inventory test methods pass on changed owned folders, mixed-case/nested names, real byte sizes, empty/ignored entries, simulated links and exposed I/O failures. The downloaded four paths alone are not the contract.
Hint 1 · a question
Separate root validation, traversal, filtering, fact collection and final sorting. Which stages perform reads?
Hint 2 · a concept cue
For each entry: skip names/links first, recurse into an accepted directory, otherwise include supported real files. Keep base separate from the current directory.
Hint 3 · a localized example
A record can use entry.relative_to(base).as_posix(), entry.suffix.casefold() and entry.stat().st_size. Sort by row["path"] after traversal; do not hardcode fixture names.
Need the complete worked solution?
Open collection_tools.py from the kit. Trace it, close it, then try fresh inputs in your own files. Treat the attempt as guided; seeing the solution does not award a practical pass.
Course help is guidance, not independent evidence. With JavaScript, opening help records guidance locally; otherwise note it in your README. Reset does not erase that history.
Repair a failed check
If paths differ by computer, return relative_to(base).as_posix(), not the absolute root. If suffix case fails, casefold only the suffix. If hidden clips appear, skip directories before visiting them. An error is not an empty list.
NotImplementedError means a practice stub is still unfinished. Read the failing test name and the last error line. Change one behavior, rerun that build, then rerun all implemented builds.
Show it works on new inputs
Create a different temporary five-entry fixture, including nested and ignored files. Inventory twice without changing it, compare ordered records and verify the source files remain unchanged. Explain one error that must not be disguised as success.
Self-review: name the input, result, refused case and reason. Your local test output and explanation are separate from a quiz score; this page does not certify a pass.
Keep the idea
A sorted inventory makes file facts reproducible enough to review. Naming and byte size are evidence with explicit limits, not media validation.