Add typing for condition values.
Review Request #14264 — Created Dec. 11, 2024 and updated
This updates
djblets.conditions.values
to support typing.
BaseConditionValueField
andConditionValueFormField
are now
generics, accepting a type that the fields manage. These types are
accepted inserialize_value()
and returned indeserialize_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 compatibletyping_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.
Summary | ID |
---|---|
d7f333c502acba77fda42c20cbfdd89ee5f781c0 |
Description | From | Last Updated |
---|---|---|
This can just be TypeVar('_T') |
david |