-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
The six media constraint classes in constraints.py (ImageConstraint, ImagesConstraint, VideoConstraint, VideosConstraint, AudioConstraint, AudiosConstraint) contain nearly identical validation logic (~186 lines), differing only in artifact type, MIME enum, and label string.
Proposal: Introduce two private base classes (_MediaConstraint, _MediaListConstraint) to centralize the shared validation. Each public class becomes a thin subclass with typed __call__ signatures preserved for get_constraint_input_type introspection compatibility.
- Zero public API changes (same class names, constructors, error messages)
- All existing tests pass unchanged
- Net reduction of ~80 lines
- Adding a new media type becomes 2 thin subclasses instead of 2 copy-paste blocks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request