Strings, Numbers and Booleans¶
Strings¶
-
class
String(value=Unspecified, **kw)¶ Bases:
flatland.schema.scalars.ScalarA regular old text string.
-
strip= True¶ If true, strip leading and trailing whitespace during conversion.
-
adapt(value)¶ Return a Python representation.
Returns: a text value or NoneIf
stripis true, leading and trailing whitespace will be removed.
-
serialize(value)¶ Return a text representation.
Returns: a Unicode value or u''if value isNoneIf
stripis true, leading and trailing whitespace will be removed.
-
is_empty¶ True if the String is missing or has no value.
-
Numbers¶
-
class
Integer(value=Unspecified, **kw)¶ Bases:
flatland.schema.scalars.NumberElement type for Python’s int.
-
type_¶ alias of
__builtin__.int
-
format= u'%i'¶ u'%i'
-
-
class
Long(value=Unspecified, **kw)¶ Bases:
flatland.schema.scalars.NumberElement type for Python’s long.
-
type_¶ alias of
__builtin__.long
-
format= u'%i'¶ u'%i'
-
-
class
Float(value=Unspecified, **kw)¶ Bases:
flatland.schema.scalars.NumberElement type for Python’s float.
-
type_¶ alias of
__builtin__.float
-
format= u'%f'¶ u'%f'
-
-
class
Decimal(value=Unspecified, **kw)¶ Bases:
flatland.schema.scalars.NumberElement type for Python’s Decimal.
-
type_¶ alias of
decimal.Decimal
-
format= u'%f'¶ u'%f'
-
Booleans¶
-
class
Boolean(value=Unspecified, **kw)¶ Bases:
flatland.schema.scalars.ScalarElement type for Python’s
bool.-
true= u'1'¶ The text serialization for
True:u'1'.
-
true_synonyms= (u'on', u'true', u'True', u'1')¶ A sequence of acceptable string equivalents for True.
Defaults to
(u'on', u'true', u'True', u'1')
-
false= u''¶ The text serialization for
False:u''.
-
false_synonyms= (u'off', u'false', u'False', u'0', u'')¶ A sequence of acceptable string equivalents for False.
Defaults to
(u'off', u'false', u'False', u'0', u'')
-
adapt(value)¶ Coerce value to
bool.Returns: a boolorNoneIf value is text, returns
Trueif the value is intrue_synonyms,Falseif infalse_synonymsandNoneotherwise.For non-text values, equivalent to
bool(value).
-
serialize(value)¶ Convert
bool(value)to a canonical text representation.Returns: either self.trueorself.false.
-