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

All Samples(44)  |  Call(12)  |  Derive(0)  |  Import(32)
Return the dictionary for the given key in the global data.

The global data is stored in the ``babel/global.dat`` file and contains
information independent of individual locales.

>>> get_global('zone_aliases')['UTC']
u'Etc/GMT'
>>> get_global('zone_territories')['Europe/Berlin']
u'DE'
(more...)

        def get_global(key):
    """Return the dictionary for the given key in the global data.

    The global data is stored in the ``babel/global.dat`` file and contains
    information independent of individual locales.

    >>> get_global('zone_aliases')['UTC']
    u'Etc/GMT'
    >>> get_global('zone_territories')['Europe/Berlin']
    u'DE'

    .. versionadded:: 0.9

    :param key: the data key
    """
    global _global_data
    if _global_data is None:
        dirname = os.path.join(os.path.dirname(__file__))
        filename = os.path.join(dirname, 'global.dat')
        if not os.path.isfile(filename):
            _raise_no_data_error()
        fileobj = open(filename, 'rb')
        try:
            _global_data = pickle.load(fileobj)
        finally:
            fileobj.close()
    return _global_data.get(key, {})
        


src/b/a/babel-HEAD/babel/dates.py   babel(Download)
import re
 
from babel.core import default_locale, get_global, Locale
from babel.util import UTC
 

src/b/a/Babel-CLDR-HEAD/babel/dates.py   Babel-CLDR(Download)
import re
 
from babel.core import default_locale, get_global, Locale
from babel.util import UTC
 

src/f/j/fjord-HEAD/vendor/packages/Babel/tests/test_core.py   fjord(Download)
def test_get_global():
    assert core.get_global('zone_aliases')['UTC'] == 'Etc/GMT'
    assert core.get_global('zone_territories')['Europe/Berlin'] == 'DE'
 
 

src/z/e/ZenPacks.zenoss.OpenStack-HEAD/src/Babel-1.3/tests/test_core.py   ZenPacks.zenoss.OpenStack(Download)
def test_get_global():
    assert core.get_global('zone_aliases')['UTC'] == 'Etc/GMT'
    assert core.get_global('zone_territories')['Europe/Berlin'] == 'DE'
 
 

src/b/a/Babel-1.3/tests/test_core.py   Babel(Download)
def test_get_global():
    assert core.get_global('zone_aliases')['UTC'] == 'Etc/GMT'
    assert core.get_global('zone_territories')['Europe/Berlin'] == 'DE'
 
 

Previous  1 | 2 | 3 | 4