TRF019

A processor TypedDict must not define _defaults; ship them on the hub in processor_config.json.

   
Default Enabled
Scope Models added on or after 2026-06-20
Source mlinter/trf019.py
Show in terminal mlinter --rule TRF019

What it does

Flags a non-empty _defaults on *ProcessorKwargs TypedDicts in processing_*.py. Models released before the cutoff date are grandfathered.

Why is this bad?

Hardcoded _defaults scatter processor configuration across Python source, are awkward to override from config, and bloat the code. In processor_config.json on the hub they travel with the checkpoint and can be updated without a code change.

Example

 class Gemma4ProcessorKwargs(ProcessingKwargs, total=False):
-    _defaults = {
-        "text_kwargs": {"padding": False},
-        "images_kwargs": {"return_tensors": "pt"},
-    }
     images_kwargs: Gemma4ImageProcessorKwargs

Suppressing this rule

Add a # trf-ignore: TRF019 comment on the flagged line or the line directly above it. See Suppressing rules for whole-file directives and when a suppression is the wrong answer.