DVPPython Studio
Module 2: Make editorial decisions / Build 4 of 4

Add a QC command

Route inspect and validate, print a complete JSON report and expose useful exit codes.

Runs on your computer · 55–80 minutes · no paid services

Download practice filesFiles, commands & notes

Without JavaScript, use the step links and keep your files on your computer.

One useful idea

argparse subparsers separate inspect from validate. Both require --width, --codec, --seconds and --model. The optional --missing list names which of the five supplied observations are False; unspecified names are True. This is fixture input, not automatic video detection.

Compute all three results before printing one JSON object. Inspect reports any valid request and returns 0. Validate enforces this classroom acceptance policy: delivery pass, recognized model and score at least 80. A completed refusal returns 1 with the full evidence report; malformed arguments or refused values use parser.error, return 2 and print no partial JSON.

Keep main(argv=None) testable and use the __main__ guard. Your command imports your practice functions; a green reference run is not your local-project evidence. JSON key order and whitespace can vary without changing its meaning. No command in this kit changes files or calls a provider.

Refresh first: CLI inputs and main guard, Risk reasons, Known versus unknown, Heuristic scores.

Trace a finished example

python -X utf8 qc_cli.py validate --width 1920 --codec h264 --seconds 600 --model "Google Veo" --missing action
# JSON report: pass, known veo, heuristic 75, failed action
# Exit status 1: completed classroom refusal, not a crash

The metadata passes, the alias is known, but action removes 25 points and leaves 75 below the classroom threshold 80. Validate returns 1 while preserving the complete JSON report. Inspect on the same request returns 0.

The finished implementation is in qc_tools.py and qc_cli.py. Reading it is guided practice, not independent evidence.

Predict a threshold

Known model, passing metadata, only setting missing: status?

Compare your answer · self-reviewed

Validate returns 0 at score 80. The threshold is inclusive, though it is only this classroom policy.

Find the error lie

Why not catch every exception and return 0?

Compare your answer · self-reviewed

That hides implementation/infrastructure failures as success. Catch expected validation errors, show useful errors and preserve nonzero status.

Recall the boundary

Should importing practice_cli print a report?

Compare your answer · self-reviewed

No. Tests need to import and call main with explicit arguments. Run terminal behavior only under the __main__ guard.

Change it, then build your own

One controlled change

Run --help, then inspect/validate for the same missing-action request. Check the process exit immediately. Then try --seconds nan; it must produce no JSON report.

Your independent task

Implement main(argv=None) in practice_cli.py. Use inspect/validate subparsers, required typed options and --missing with choices from WEIGHTS. Call your three practice functions, catch expected TypeError/ValueError with parser.error, then print exactly delivery/model/adherence as JSON. Inspect returns 0. Validate returns 1 if delivery is not pass, model unknown or score <80; otherwise 0. Keep the __main__ guard and help phrase never changes files.

What success looks like

Five CLI test methods pass. Then all 16 module methods pass with --target practice --build all. Invalid requests exit 2 with useful stderr and empty stdout; completed refusals exit 1 with their report.

Hint 1 · a question

List inputs, three returned reports and the two command policies before writing argparse code.

Hint 2 · a concept cue

Use required subparsers and typed options; build all results in a try block, then serialize once.

Hint 3 · a localized example

refused = delivery["verdict"] != "pass" or not model["known"] or adherence["score"] < 80. Decide status from command and refused, without replacing the report.

Need the complete worked solution?

Open qc_tools.py and qc_cli.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 every validate exits 0, check all three acceptance conditions. If valid JSON appears before an error, move presentation after validation. If practice tests exercise reference functions, repair your imports.

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

Run your own CLI for a new model label, 1919px/601s metadata, and a known-provider request missing camera/style. Save inspect and validate commands, JSON and exits in your README. Explain reasons, original evidence, rubric limits and one rule you would change for another delivery contract.

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

You have a tested read-only QC increment, not the completed Asset Intelligence portfolio. Keep Module 1 and Module 2 files; collection processing and integration come next.

Module 2 checkpoint

Five questions, followed by the separate practical task above. JavaScript loads the scored questions; the build, files and hints remain available without it.