Primitive Properties

Bool

class properties.Bool(doc, **kwargs)[source]

Property for True or False values

Available keywords (in addition to those inherited from Property):

  • cast - convert input value to boolean based on its truth value. By default, cast is False.

Integer

class properties.Integer(doc, **kwargs)[source]

Property for integer values

Available keywords (in addition to those inherited from Property):

  • min - Minimum valid value, inclusive. If None (the default), there is no minimum limit.
  • max - Maximum valid value, inclusive. If None (the default), there is no maximum limit.
  • cast - Attempt to convert input value to integer. By default, cast is False.

Float

class properties.Float(doc, **kwargs)[source]

Property for float values

Available keywords (in addition to those inherited from Property):

  • min - Minimum valid value, inclusive. If None (the default), there is no minimum limit.
  • max - Maximum valid value, inclusive. If None (the default), there is no maximum limit.
  • cast - Attempt to convert input value to integer. By default, cast is False.

Complex

class properties.Complex(doc, **kwargs)[source]

Property for complex numbers

Available keywords (in addition to those inherited from Property):

  • cast - Attempt to convert input value to integer. By default, cast is False.

String

class properties.String(doc, **kwargs)[source]

Property for string values

Available keywords (in addition to those inherited from Property):

  • strip - Substring to strip off input. By default, nothing is stripped.
  • change_case - If ‘lower’, coerces input to lowercase; if ‘upper’, coerce input to uppercase. If None (the default), case is left unchanged.
  • unicode - If True, coerce strings to unicode. Default is True to ensure consistent behavior across Python 2/3.
  • regex - Regular expression (pattern or compiled expression) the input string must match. Note: re.search is used to determine if string is valid; to match the entire string, ensure ‘^’ and ‘$’ are contained in the regex pattern.