MCPcopy Create free account
hub / github.com/DeepL/deepl-python / _check_valid_languages

Method _check_valid_languages

deepl/translator.py:244–257  ·  view source on GitHub ↗

Internal function to check given languages are valid.

(
        self, source_lang: Optional[str], target_lang: str
    )

Source from the content-addressed store, hash-verified

242 )
243
244 def _check_valid_languages(
245 self, source_lang: Optional[str], target_lang: str
246 ):
247 """Internal function to check given languages are valid."""
248 if target_lang == "EN":
249 raise DeepLException(
250 'target_lang="EN" is deprecated, please use "EN-GB" or "EN-US"'
251 "instead."
252 )
253 elif target_lang == "PT":
254 raise DeepLException(
255 'target_lang="PT" is deprecated, please use "PT-PT" or "PT-BR"'
256 "instead."
257 )
258
259 def _check_language_and_formality(
260 self,

Callers 1

Calls 1

DeepLExceptionClass · 0.85

Tested by

no test coverage detected