bundles / traitlets 5.14.3 / traitlets / traitlets / HasTraits / trait_values
function
traitlets.traitlets:HasTraits.trait_values
source: /traitlets/traitlets.py :1851
Signature
def trait_values ( self , ** metadata : t.Any ) → dict[str, t.Any] Summary
A dict of trait names and their values.
Extended Summary
The metadata kwargs allow functions to be passed in which filter traits based on metadata values. The functions should take a single value as an argument and return a boolean. If any function returns False, then the trait is not included in the output. If a metadata key doesn't exist, None will be passed to the function.
Returns
: A ``dict`` of trait names and their values.
Notes
Trait values are retrieved via getattr, any exceptions raised by traits or the operations they may trigger will result in the absence of a trait value in the result dict.
Aliases
-
traitlets.HasTraits.trait_values