reliure.types¶
inheritance diagrams¶
Class¶
-
class
reliure.types.Boolean(**kwargs)¶ Bases:
reliure.types.GenericType-
TRUE_VALUES= set([True, 'oui', 'o', '1', 'yes', 'true'])¶
-
__init__(**kwargs)¶
-
default_validators= [<reliure.validators.TypeValidator object at 0x7fe2d6c70e90>]¶
-
parse(value)¶
-
-
class
reliure.types.Datetime(**kwargs)¶ Bases:
reliure.types.GenericTypedatetime type
-
__init__(**kwargs)¶
-
as_dict()¶
-
parse(value)¶
-
-
class
reliure.types.GenericType(default=None, help='', multi=None, uniq=None, choices=None, attrs=None, validators=[], parse=None, serialize=None)¶ Bases:
objectDefine a type.
-
__init__(default=None, help='', multi=None, uniq=None, choices=None, attrs=None, validators=[], parse=None, serialize=None)¶ Parameters: - default – default value for the field
- help (str) – description of what the data is
- multi (bool) – field is a list or a set
- uniq (bool) – wether the values are unique, only apply if multi is True
- choices (list) – if setted the value should be one of the given choice
- attrs – field attributes, dictionary of {“name”: AbstractType()}
- validators – list of additional validators
- parse – a parsing function
- serialize – a pre-serialization function
-
as_dict()¶ returns a dictionary view of the option
Returns: the option converted in a dict Return type: dict
-
default¶ Default value of the type
-
default_validators= []¶
-
parse(value)¶ parsing from string
-
serialize(value, **kwargs)¶ pre-serialize value
-
validate(value)¶ Abstract method, check if a value is correct (type). Should raise
TypeErrorif the type the validation fail.Parameters: value – the value to validate Returns: the given value (that may have been converted)
-
-
class
reliure.types.Numeric(vtype=<type 'int'>, min=None, max=None, **kwargs)¶ Bases:
reliure.types.GenericTypeNumerical type (int or float)
-
__init__(vtype=<type 'int'>, min=None, max=None, **kwargs)¶ Parameters: - vtype – the type of numbers that can be stored in this field,
either
int,float. - signed (bool) – if the value may be negatif (True by default)
- min – if not None, the minimal possible value
- max – if not None, the maximal possible value
- vtype – the type of numbers that can be stored in this field,
either
-
as_dict()¶
-
parse(value)¶
-