firecrown.descriptors.TypeString#
- class firecrown.descriptors.TypeString(minsize=None, maxsize=None, predicate=None)[source]#
Bases:
objectString attribute descriptor.
:classs:`TypeString` provides several different means of validation of the controlled string attribute, all of which are optional.
- Parameters:
minsize (
None|int) –maxsize (
None|int) –predicate (
Optional[Callable[[str],bool]]) –
Public Methods:
__init__([minsize, maxsize, predicate])Initialize the TypeString object.
validate(value)Run all validators on this value.
__set_name__(_, name)Create the name of the private instance variable that will hold the value.
__get__(obj[, objtype])Accessor method, which reads controlled value.
__set__(obj, value)Setter for the validated variable.
- __get__(obj, objtype=None)[source]#
Accessor method, which reads controlled value.
This is invoked whenever the validated variable is read.
- Parameters:
obj – The object that contains the validated variable.
objtype – The type of the object that contains the validated variable.
- Return type:
str
- __set__(obj, value)[source]#
Setter for the validated variable.
This function invokes the validate method of the derived class.
- Parameters:
obj – The object that contains the validated variable.
value (
None|str) – The new value of the validated variable.
- Return type:
None