tossi/tolerance.py
def parse_tolerance_style(style, registry=None):
    """Resolves a tolerance style of the given tolerant particle morph::

    >>> parse_tolerance_style(u'은(는)')
    0
    >>> parse_tolerance_style(u'(은)는')
    1
    >>> parse_tolerance_style(OPTIONAL_MORPH2_AND_MORPH1)
    3

    """
    if isinstance(style, integer_types):
        return style
    if registry is None:
        from . import registry
    particle = registry.parse(style)
    if len(particle.tolerances) != 4:
        raise ValueError('Set tolerance style by general allomorphic particle')
    return particle.tolerances.index(style)
def parse_tolerance_style(style, registry=None):
    """Resolves a tolerance style of the given tolerant particle morph::

    >>> parse_tolerance_style(u'은(는)')
    0
    >>> parse_tolerance_style(u'(은)는')
    1
    >>> parse_tolerance_style(OPTIONAL_MORPH2_AND_MORPH1)
    3

    """
    if isinstance(style, integer_types):
        return style
    if registry is None:
        from . import registry
    particle = registry.parse(style)
    if len(particle.tolerances) != 4:
        raise ValueError('Set tolerance style by general allomorphic particle')
    return particle.tolerances.index(style)
def parse_tolerance_style ( style , registry = None ) : if isinstance ( style , integer_types ) : return style if registry is None : from . import registry particle = registry . parse ( style ) if len ( particle . tolerances ) != 4 : raise ValueError ( 'Set tolerance style by general allomorphic particle' ) return particle . tolerances . index ( style )
Resolves a tolerance style of the given tolerant particle morph::

    >>> parse_tolerance_style(u'은(는)')
    0
    >>> parse_tolerance_style(u'(은)는')
    1
    >>> parse_tolerance_style(OPTIONAL_MORPH2_AND_MORPH1)
    3
Resolves a tolerance style of the given tolerant particle morph ::