Strings, Numbers and Booleans
*****************************


Strings
=======

class String(value=Unspecified, **kw)

   Bases: "flatland.schema.scalars.Scalar"

   A 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 "None"

      If "strip" is true, leading and trailing whitespace will be
      removed.

   serialize(value)

      Return a text representation.

      Returns:
         a Unicode value or "u''" if *value* is "None"

      If "strip" is 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.Number"

   Element type for Python’s int.

   type_

      alias of "__builtin__.int"

   format = u'%i'

      "u'%i'"

class Long(value=Unspecified, **kw)

   Bases: "flatland.schema.scalars.Number"

   Element type for Python’s long.

   type_

      alias of "__builtin__.long"

   format = u'%i'

      "u'%i'"

class Float(value=Unspecified, **kw)

   Bases: "flatland.schema.scalars.Number"

   Element type for Python’s float.

   type_

      alias of "__builtin__.float"

   format = u'%f'

      "u'%f'"

class Decimal(value=Unspecified, **kw)

   Bases: "flatland.schema.scalars.Number"

   Element 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.Scalar"

   Element 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 "bool" or "None"

      If *value* is text, returns "True" if the value is in
      "true_synonyms", "False" if in "false_synonyms" and "None"
      otherwise.

      For non-text values, equivalent to "bool(value)".

   serialize(value)

      Convert "bool(value)" to a canonical text representation.

      Returns:
         either "self.true" or "self.false".
