# Path: flatland/signals.py

# 
# Path: flatland/schema/scalars.py
# class String(Scalar):
#     """A regular old Unicode string."""
# 
#     strip = True
#     """If true, strip leading and trailing whitespace during conversion."""
# 
#     def adapt(self, value):
#         """Return a Unicode representation.
# 
#         :returns: a ``unicode`` value or ``None``
# 
#         If :attr:`strip` is true, leading and trailing whitespace will be
#         removed.
# 
#         """
#         if value is None:
#             return None
#         elif self.strip:
#             return unicode(value).strip()
#         else:
#             return unicode(value)
# 
#     def serialize(self, value):
#         """Return a Unicode representation.
# 
#         :returns: a ``unicode`` value or ``u'' if *value* is ``None``
# 
#         If :attr:`strip` is true, leading and trailing whitespace will be
#         removed.
# 
#         """
#         if value is None:
#             return u''
#         elif self.strip:
#             return unicode(value).strip()
#         else:
#             return unicode(value)
# 
#     @property
#     def is_empty(self):
#         """True if the String is missing or has no value."""
#         return True if (not self.value and self.u == u'') else False
# 
# Path: flatland/schema/base.py
# class _BaseElement(object):
# class Element(_BaseElement):
# class Slot(object):
#     def __init__(self, value=Unspecified, **kw):
#     def named(cls, name):
#     def using(cls, **overrides):
#     def validated_by(cls, *validators):
#     def including_validators(cls, *validators, **kw):
#     def validate_element(self, element, state, descending):
#     def from_flat(cls, pairs, **kw):
#     def from_defaults(cls, **kw):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def label(self, cls):
#     def _get_all_valid(self):
#     def _set_all_valid(self, value):
#     def root(self):
#     def parents(self):
#     def path(self):
#     def children(self):
#     def all_children(self):
#     def fq_name(self, sep=u'.'):
#     def find(self, path, single=False, strict=True):
#     def el(self, path, sep=u'.'):
#     def _index(self, name):
#     def _parse_element_path(self, path, sep):
#     def add_error(self, message):
#     def add_warning(self, message):
#     def flattened_name(self, sep=u'_'):
#     def flatten(self, sep=u'_', value=operator.attrgetter('u')):
#     def set(self, value):
#     def set_flat(self, pairs, sep=u'_'):
#     def _set_flat(self, pairs, sep):
#     def set_default(self):
#     def is_empty(self):
#     def validate(self, state=None, recurse=True):
#     def _validate(self, state, descending):
#     def default_value(self):
#     def x(self):
#     def xa(self):
#     def __hash__(self):
# def validate_element(element, state, validators):


from flatland import String, signals
from flatland.schema.base import NotEmpty
from flatland.validation import (
    Converted,
    NoLongerThan,
    Present,
    )
from tests._util import eq_
    assert el.validate()
    assert len(sentinel) == 3
    assert sentinel[-1]['result']

    del sentinel[:]
    el = schema('squiznart')
    assert not el.validate()
    assert len(sentinel) == 3
    assert not sentinel[-1]['result']

    s2 = String.using(optional=False)

    del sentinel[:]
    el = s2()
    assert not el.validate()
    eq_(sentinel, [dict(sender=NotEmpty, element=el,
                        state=None, result=False)])

    del sentinel[:]
    el = s2('squiznart')
    assert el.validate()
    eq_(sentinel, [dict(sender=NotEmpty, element=el,
                        state=None, result=True)])

    del listener
    del sentinel[:]
    el = schema('squiznart')
    assert not el.validate()
    assert not sentinel


# Path: flatland/signals.py

# 
# Path: flatland/schema/scalars.py
# class String(Scalar):
#     """A regular old Unicode string."""
# 
#     strip = True
#     """If true, strip leading and trailing whitespace during conversion."""
# 
#     def adapt(self, value):
#         """Return a Unicode representation.
# 
#         :returns: a ``unicode`` value or ``None``
# 
#         If :attr:`strip` is true, leading and trailing whitespace will be
#         removed.
# 
#         """
#         if value is None:
#             return None
#         elif self.strip:
#             return unicode(value).strip()
#         else:
#             return unicode(value)
# 
#     def serialize(self, value):
#         """Return a Unicode representation.
# 
#         :returns: a ``unicode`` value or ``u'' if *value* is ``None``
# 
#         If :attr:`strip` is true, leading and trailing whitespace will be
#         removed.
# 
#         """
#         if value is None:
#             return u''
#         elif self.strip:
#             return unicode(value).strip()
#         else:
#             return unicode(value)
# 
#     @property
#     def is_empty(self):
#         """True if the String is missing or has no value."""
#         return True if (not self.value and self.u == u'') else False
# 
# Path: flatland/schema/base.py
# class _BaseElement(object):
# class Element(_BaseElement):
# class Slot(object):
#     def __init__(self, value=Unspecified, **kw):
#     def named(cls, name):
#     def using(cls, **overrides):
#     def validated_by(cls, *validators):
#     def including_validators(cls, *validators, **kw):
#     def validate_element(self, element, state, descending):
#     def from_flat(cls, pairs, **kw):
#     def from_defaults(cls, **kw):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def label(self, cls):
#     def _get_all_valid(self):
#     def _set_all_valid(self, value):
#     def root(self):
#     def parents(self):
#     def path(self):
#     def children(self):
#     def all_children(self):
#     def fq_name(self, sep=u'.'):
#     def find(self, path, single=False, strict=True):
#     def el(self, path, sep=u'.'):
#     def _index(self, name):
#     def _parse_element_path(self, path, sep):
#     def add_error(self, message):
#     def add_warning(self, message):
#     def flattened_name(self, sep=u'_'):
#     def flatten(self, sep=u'_', value=operator.attrgetter('u')):
#     def set(self, value):
#     def set_flat(self, pairs, sep=u'_'):
#     def _set_flat(self, pairs, sep):
#     def set_default(self):
#     def is_empty(self):
#     def validate(self, state=None, recurse=True):
#     def _validate(self, state, descending):
#     def default_value(self):
#     def x(self):
#     def xa(self):
#     def __hash__(self):
# def validate_element(element, state, validators):


# Path: tests/validation/test_signals.py
from flatland import String, signals
from flatland.schema.base import NotEmpty
from flatland.validation import (
    Converted,
    NoLongerThan,
    Present,
    )
from tests._util import eq_

    assert el.validate()
    assert len(sentinel) == 3
    assert sentinel[-1]['result']

    del sentinel[:]
    el = schema('squiznart')
    assert not el.validate()
    assert len(sentinel) == 3
    assert not sentinel[-1]['result']

    s2 = String.using(optional=False)

    del sentinel[:]
    el = s2()
    assert not el.validate()
    eq_(sentinel, [dict(sender=NotEmpty, element=el,
                        state=None, result=False)])

    del sentinel[:]
    el = s2('squiznart')
    assert el.validate()
    eq_(sentinel, [dict(sender=NotEmpty, element=el,
                        state=None, result=True)])

    del listener
    del sentinel[:]
    el = schema('squiznart')
    assert not el.validate()
    assert not sentinel


    signals.validator_validated._clear_state()