cytoflow.utility.custom_traits#
Custom traits for cytoflow
PositiveInt, PositiveFloat – versions of traits.trait_types.Int and traits.trait_types.Float that must be
positive (and optionally 0).
PositiveCInt, PositiveCFloat – versions of traits.trait_types.CInt, traits.trait_types.CFloat that must
be positive (and optionally 0).
IntOrNone, FloatOrNone – versions of traits.trait_types.Int and traits.trait_types.Float that may also
hold the value None.
CIntOrNone, CFloatOrNone – versions of traits.trait_types.CInt and traits.trait_types.CFloat that may also
hold the value None.
ScaleEnum – an enumeration whose value is one of the registered scales.
Removed – a trait that was present in a previous version but was removed.
Deprecated – a trait that was present in a previous version but was renamed.
- class cytoflow.utility.custom_traits.PositiveInt(default_value=<traits.trait_type._NoDefaultSpecifiedType object>, **metadata)[source]#
Bases:
BaseIntDefines a trait whose value must be a positive integer
- info_text = 'a positive integer'#
A description of the type of value this trait accepts:
- class cytoflow.utility.custom_traits.PositiveCInt(default_value=<traits.trait_type._NoDefaultSpecifiedType object>, **metadata)[source]#
Bases:
BaseCIntDefines a trait whose converted value must be a positive integer
- info_text = 'a positive integer'#
A description of the type of value this trait accepts:
- class cytoflow.utility.custom_traits.PositiveFloat(default_value=<traits.trait_type._NoDefaultSpecifiedType object>, **metadata)[source]#
Bases:
BaseFloatDefines a trait whose value must be a positive float
- info_text = 'a positive float'#
A description of the type of value this trait accepts:
- class cytoflow.utility.custom_traits.PositiveCFloat(default_value=<traits.trait_type._NoDefaultSpecifiedType object>, **metadata)[source]#
Bases:
BaseCFloatDefines a trait whose converted value must be a positive float
- info_text = 'a positive float'#
A description of the type of value this trait accepts:
- class cytoflow.utility.custom_traits.FloatOrNone(default_value=<traits.trait_type._NoDefaultSpecifiedType object>, **metadata)[source]#
Bases:
BaseFloatDefines a trait whose value must be a float or None
- info_text = 'a float or None'#
A description of the type of value this trait accepts:
- class cytoflow.utility.custom_traits.CFloatOrNone(default_value=<traits.trait_type._NoDefaultSpecifiedType object>, **metadata)[source]#
Bases:
BaseCFloatDefines a trait whose converted value must be a float or None
- info_text = 'a float or None'#
A description of the type of value this trait accepts:
- class cytoflow.utility.custom_traits.UnitFloat(default_value=<traits.trait_type._NoDefaultSpecifiedType object>, **metadata)[source]#
Bases:
BaseFloatDefines a trait whose value must be a float between 0 and 1 (inclusive)
- class cytoflow.utility.custom_traits.IntOrNone(default_value=<traits.trait_type._NoDefaultSpecifiedType object>, **metadata)[source]#
Bases:
BaseIntDefines a trait whose value must be an integer or None
- info_text = 'an int or None'#
A description of the type of value this trait accepts:
- class cytoflow.utility.custom_traits.CIntOrNone(default_value=<traits.trait_type._NoDefaultSpecifiedType object>, **metadata)[source]#
Bases:
BaseCIntDefines a trait whose converted value must be an integer or None
- info_text = 'an int or None'#
A description of the type of value this trait accepts:
- class cytoflow.utility.custom_traits.ScaleEnum(*args, **metadata)[source]#
Bases:
BaseEnumDefines an enumeration that contains one of the registered data scales
- info_text = 'an enum containing one of the registered scales'#
- get_default_value()[source]#
Get information about the default value.
The default implementation analyzes the value of the trait’s
default_valueattribute and determines an appropriatedefault_value_typefor thedefault_value. If you need to override this method to provide a different result tuple, the following values are valid values fordefault_value_type:0, 1: The
default_valueitem of the tuple is the default value.2: The object containing the trait is the default value.
3: A new copy of the list specified by
default_valueis the default value.4: A new copy of the dictionary specified by
default_valueis the default value.5: A new instance of TraitListObject constructed using the
default_valuelist is the default value.6: A new instance of TraitDictObject constructed using the
default_valuedictionary is the default value.7:
default_valueis a tuple of the form:(callable, args, kw), wherecallableis a callable,argsis a tuple, andkwis either a dictionary or None. The default value is the result obtained by invokingcallable(\*args, \*\*kw).8:
default_valueis a callable. The default value is the result obtained by invokingdefault_value(object), whereobjectis the object containing the trait. If the trait has avalidate()method, thevalidate()method is also called to validate the result.9: A new instance of
TraitSetObjectconstructed using thedefault_valueset is the default value.
- Returns:
default_value_type, default_value – The default value information, consisting of an integer, giving the type of default value, and the corresponding default value as described above.
- Return type:
int, any
- class cytoflow.utility.custom_traits.Removed(**metadata)[source]#
Bases:
TraitTypeNames a trait that was present in a previous version but was removed.
Trait metadata:
err_string : the error string in the error
gui : if
True, don’t return a backtrace (because it’s very slow)- warningif
True, raise a warning when the trait is referenced. Otherwise, raise an exception.
- warningif
- class cytoflow.utility.custom_traits.Deprecated(**metadata)[source]#
Bases:
TraitTypeNames a trait that was present in a previous version but was renamed. When the trait is accessed, a warning is raised, and the access is passed through to the new trait.
- Trait metadata:
new : the name of the new trait
err_string : the error string in the error
gui : if
True, don’t return a backtrace (because it’s very slow)
- class cytoflow.utility.custom_traits.ChangedStr(**metadata)[source]#
Bases:
BaseStrWhen an invalid type is set, return a custom string.
- error(_, name, value)[source]#
Raises a TraitError exception.
This method is called by the validate() method when an assigned value is not valid. Raising a TraitError exception either notifies the user of the problem, or, in the case of compound traits, provides a chance for another trait handler to handle to validate the value.
- Parameters:
object (object) – The object whose attribute is being assigned.
name (str) – The name of the attribute being assigned.
value (object) – The proposed new value for the attribute.