FixableTrait#

class FixableTrait(trait, default_value=None, unicode=False, range=True, allow_none=True, **kwargs)#

Bases: Union

Fixable parameter, specified in a filename pattern.

A fixable parameter (ie specified in a filename pattern) can take:

  1. a value of the appropriate type (int, float, bool, or str depending on the format),

  2. a string that will be interpreted as a regular expression to match a filename part or a string specifying a range of values (see below).

  3. a list of values (see 1), any of which will be accepted as a valid filename part.

Values for a fixable can be specified using a string expression of the following format start:stop[:step]. This will generate values between ‘start’ and ‘stop’ spaced by ‘step’. The ‘stop’ value will be included (values <= stop). The step is optional and will by default be one. It also does not need to be signed, only its absolute value will be used.

“2000:2005”: [2000, 2001, 2002, 2003, 2004, 2005] “2000:2005:2”: [2000, 2002, 2004] “2005:2000:2”: [2005, 2003, 2001] “0.:2.:0.5”: [0.0, 0.5, 1.0, 1.5, 2.0]

Parameters:
  • trait (TraitType) – Trait instance.

  • kwargs – Arguments passed to the Union trait created.

  • default_value (Any)

  • unicode (bool)

  • range (bool)

  • allow_none (bool)