bundles / traitlets 5.15.0 / traitlets / traitlets / validate
function
traitlets.traitlets:validate
source: /traitlets/traitlets.py :1167
Signature
def validate ( * names : Sentinel | str ) → ValidateHandler Summary
A decorator to register cross validator of HasTraits object's state when a Trait is set.
Extended Summary
The handler passed to the decorator must have one proposal dict argument. The proposal dictionary must hold the following keys:
ownerthe HasTraits instancevaluethe proposed value for the modified trait attributetraitthe TraitType instance associated with the attribute
Parameters
*namesThe str names of the Traits to validate.
Notes
Since the owner has access to the HasTraits instance via the 'owner' key, the registered cross validator could potentially make changes to attributes of the HasTraits instance. However, we recommend not to do so. The reason is that the cross-validation of attributes may run in arbitrary order when exiting the hold_trait_notifications context, and such changes may not commute.
Aliases
-
traitlets.validate