# foley.eval.clip_checks

The per-clip scorers `foley.generate` can run on each stored clip: one table (#277).

Each [`ClipCheck`](#foley.eval.clip_checks.ClipCheck) is a model that scores one clip on its own (no reference set,
no prompt), run in its own interpreter: Audiobox Aesthetics (`aesthetics=`,
[`foley.eval.aesthetics`](foley.eval.aesthetics.html.md#module-foley.eval.aesthetics)) and PAM (`pam=`, [`foley.eval.pam`](foley.eval.pam.html.md#module-foley.eval.pam)). `generate`
resolves the ones asked for before it spends anything, then records each verdict in
`qc[name]` and a note, the same way for all of them: a record, never a quarantine,
`unchecked` with a scrubbed reason when it cannot run. A new scorer is a row here
plus its keyword on `generate` (and `foley.generate`), which hands it to the table.

```pycon
>>> sorted(clip_checks())
['aesthetics', 'pam']
>>> resolve_clip_scorers({"aesthetics": None, "pam": False})
{}
```

### Functions

| [`clip_checks`](#foley.eval.clip_checks.clip_checks)()                 | The per-clip scorers, by `generate` keyword (imported on use: none is loaded unless asked for).   |
|--------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| [`resolve_clip_scorers`](#foley.eval.clip_checks.resolve_clip_scorers)(options) | `{name: scorer}` for each option asked for (`None` and `False` are not).                          |

### Classes

| [`ClipCheck`](#foley.eval.clip_checks.ClipCheck)(name, resolve, verdict, note_for, ...)   | One per-clip scorer `generate` can run.   |
|-----------------------------------------------------------------------------------------------------|-------------------------------------------|

### *class* foley.eval.clip_checks.ClipCheck(name, resolve, verdict, note_for, duplicate_note)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

One per-clip scorer `generate` can run.

#### name

The `generate` keyword, and the `qc` key its verdict is stored under.

* **Type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

#### resolve

`option -> scorer | None`; raises for a bad value or a missing
interpreter (so before anything is paid for).

* **Type:**
  [`Callable`](https://docs.python.org/3/library/typing.html#typing.Callable)

#### verdict

`(audio_bytes, *, scorer) -> dict`; never raises.

* **Type:**
  [`Callable`](https://docs.python.org/3/library/typing.html#typing.Callable)

#### note_for

`verdict -> str | None`, the candidate note.

* **Type:**
  [`Callable`](https://docs.python.org/3/library/typing.html#typing.Callable)[[[`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)], [`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]]

#### duplicate_note

The note when a duplicate’s stored twin already has a verdict.

* **Type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### foley.eval.clip_checks.clip_checks()

The per-clip scorers, by `generate` keyword (imported on use: none is loaded
unless asked for).

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`ClipCheck`](#foley.eval.clip_checks.ClipCheck)]

### foley.eval.clip_checks.resolve_clip_scorers(options)

`{name: scorer}` for each option asked for (`None` and `False` are not).

* **Raises:**
  * [**KeyError**](https://docs.python.org/3/builtins/exceptions.html#KeyError) – For a name that is not a [`clip_checks()`](#foley.eval.clip_checks.clip_checks) row.
  * [**FileNotFoundError**](https://docs.python.org/3/builtins/exceptions.html#FileNotFoundError)**,** [**TypeError**](https://docs.python.org/3/builtins/exceptions.html#TypeError) – As the check’s `resolve` does.
* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`object`](https://docs.python.org/3/builtins/functions.html#object)]
