Add typing for condition values.

Review Request #14264 — Created Dec. 11, 2024 and updated — Latest diff uploaded

Information

Djblets
release-5.x

Reviewers

This updates djblets.conditions.values to support typing.
BaseConditionValueField and ConditionValueFormField are now
generics, accepting a type that the fields manage. These types are
accepted in serialize_value() and returned in deserialize_value().
Other value subclasses (for model values) also take a type.

If a type is not provided, these default to Any. This is available as
part of PEP 696 and a compatible typing_extensions.

Some Python 2.7-safe code has been removed, cleaning up some tests and
implementation code.

This is the first step in making condition support type-safe, and
modernizing some of the APIs for better type compliance.

Unit tests pass.

Commits

Files