MCPcopy
hub / github.com/opendevops-cn/opendevops / get

Method get

scripts/tornado_source_code/tornado/locale.py:254–269  ·  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

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