MCPcopy Create free account
hub / github.com/EasyIME/PIME / get

Method get

python/python3/tornado/locale.py:252–267  ·  view source on GitHub ↗

Returns the Locale for the given locale code. If it is not supported, we raise an exception.

(cls, code: str)

Source from the content-addressed store, hash-verified

250
251 @classmethod
252 def get(cls, code: str) -> "Locale":
253 """Returns the Locale for the given locale code.
254
255 If it is not supported, we raise an exception.
256 """
257 if code not in cls._cache:
258 assert code in _supported_locales
259 translations = _translations.get(code, None)
260 if translations is None:
261 locale = CSVLocale(code, {}) # type: Locale
262 elif _use_gettext:
263 locale = GettextLocale(code, translations)
264 else:
265 locale = CSVLocale(code, translations)
266 cls._cache[code] = locale
267 return cls._cache[code]
268
269 def __init__(self, code: str) -> None:
270 self.code = code

Callers 3

get_closestMethod · 0.45
__init__Method · 0.45
translateMethod · 0.45

Calls 2

CSVLocaleClass · 0.85
GettextLocaleClass · 0.85

Tested by

no test coverage detected