Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(61)  |  Call(52)  |  Derive(0)  |  Import(9)
Represents a set of language pluralization rules.  The constructor
accepts a list of (tag, expr) tuples or a dict of CLDR rules. The
resulting object is callable and accepts one parameter with a positive or
negative number (both integer and float) for the number that indicates the
plural form for a string and returns the tag for the format:

>>> rule = PluralRule({'one': 'n is 1'})
>>> rule(1)
'one'
>>> rule(2)(more...)

src/f/j/fjord-HEAD/vendor/packages/Babel/scripts/import_cldr.py   fjord(Download)
 
from babel import dates, numbers
from babel.plural import PluralRule
from babel.localedata import Alias
from babel._compat import pickle, text_type
        for rule in elem.findall('pluralRule'):
            rules.append((rule.attrib['count'], text_type(rule.text)))
        pr = PluralRule(rules)
        for locale in elem.attrib['locales'].split():
            plural_rules[locale] = pr

src/z/e/ZenPacks.zenoss.OpenStack-HEAD/src/Babel-1.3/scripts/import_cldr.py   ZenPacks.zenoss.OpenStack(Download)
 
from babel import dates, numbers
from babel.plural import PluralRule
from babel.localedata import Alias
from babel._compat import pickle, text_type
        for rule in elem.findall('pluralRule'):
            rules.append((rule.attrib['count'], text_type(rule.text)))
        pr = PluralRule(rules)
        for locale in elem.attrib['locales'].split():
            plural_rules[locale] = pr

src/b/a/Babel-1.3/scripts/import_cldr.py   Babel(Download)
 
from babel import dates, numbers
from babel.plural import PluralRule
from babel.localedata import Alias
from babel._compat import pickle, text_type
        for rule in elem.findall('pluralRule'):
            rules.append((rule.attrib['count'], text_type(rule.text)))
        pr = PluralRule(rules)
        for locale in elem.attrib['locales'].split():
            plural_rules[locale] = pr

src/p/r/proofofexistence-HEAD/babel/core.py   proofofexistence(Download)
from babel import localedata
from babel._compat import pickle, string_types
from babel.plural import PluralRule
 
__all__ = ['UnknownLocaleError', 'Locale', 'default_locale', 'negotiate_locale',
           'parse_locale']
 
 
_global_data = None
_default_plural_rule = PluralRule({})

src/w/e/webapp-improved-HEAD/lib/babel/scripts/import_cldr.py   webapp-improved(Download)
 
from babel import dates, numbers
from babel.plural import PluralRule
from babel.localedata import Alias
 
        for rule in elem.findall('pluralRule'):
            rules.append((rule.attrib['count'], unicode(rule.text)))
        pr = PluralRule(rules)
        for locale in elem.attrib['locales'].split():
            plural_rules[locale] = pr

src/b/a/babel-HEAD/scripts/import_cldr.py   babel(Download)
 
from babel import dates, numbers
from babel.plural import PluralRule
from babel.localedata import Alias
from babel.util import set
        for rule in elem.findall('pluralRule'):
            rules.append((rule.attrib['count'], unicode(rule.text)))
        pr = PluralRule(rules)
        for locale in elem.attrib['locales'].split():
            plural_rules[locale] = pr

src/b/a/Babel-CLDR-HEAD/scripts/import_cldr.py   Babel-CLDR(Download)
 
from babel import dates, numbers
from babel.plural import PluralRule
from babel.localedata import Alias
 
        for rule in elem.findall('pluralRule'):
            rules.append((rule.attrib['count'], unicode(rule.text)))
        pr = PluralRule(rules)
        for locale in elem.attrib['locales'].split():
            plural_rules[locale] = pr

src/a/n/android2po-1.2.0/android2po/convert.py   android2po(Download)
    plural count separately. See http://babel.edgewall.org/ticket/291.
    """
    from babel.plural import (PluralRule, _fallback_tag, _plural_tags,
                              _GettextCompiler)
    rule = PluralRule.parse(rule)

src/a/n/android2po-HEAD/android2po/convert.py   android2po(Download)
    plural count separately. See http://babel.edgewall.org/ticket/291.
    """
    from babel.plural import (PluralRule, _fallback_tag, _plural_tags,
                              _GettextCompiler)
    rule = PluralRule.parse(rule)

src/f/j/fjord-HEAD/vendor/packages/Babel/tests/test_plural.py   fjord(Download)
class test_plural_rule():
    rule = plural.PluralRule({'one': 'n is 1'})
    assert rule(1) == 'one'
    assert rule(2) == 'other'
 
    rule = plural.PluralRule({'one': 'n is 1'})
def test_plural_within_rules():
    p = plural.PluralRule({'one': 'n is 1', 'few': 'n within 2,4,7..9'})
    assert repr(p) == "<PluralRule 'one: n is 1, few: n within 2,4,7..9'>"
    assert plural.to_javascript(p) == (
        "(function(n) { "

  1 | 2  Next