@@ -227,7 +227,8 @@ def limit(self) -> Optional[int]:
227
227
228
228
@property
229
229
def valid (self ) -> bool :
230
- """True iff both the count and limit are set for this usage type."""
230
+ """True iff both the count and limit are set for this usage
231
+ type."""
231
232
return self ._count is not None and self ._limit is not None
232
233
233
234
@property
@@ -546,11 +547,13 @@ def _check_valid_languages(
546
547
"""Internal function to check given languages are valid."""
547
548
if target_lang == "EN" :
548
549
raise DeepLException (
549
- 'target_lang="EN" is deprecated, please use "EN-GB" or "EN-US" instead.'
550
+ 'target_lang="EN" is deprecated, please use "EN-GB" or "EN-US"'
551
+ "instead."
550
552
)
551
553
elif target_lang == "PT" :
552
554
raise DeepLException (
553
- 'target_lang="PT" is deprecated, please use "PT-PT" or "PT-BR" instead.'
555
+ 'target_lang="PT" is deprecated, please use "PT-PT" or "PT-BR"'
556
+ "instead."
554
557
)
555
558
556
559
def _check_language_and_formality (
@@ -758,17 +761,19 @@ def translate_document_from_filepath(
758
761
759
762
:param input_path: Path to document to be translated.
760
763
:param output_path: Path to store translated document.
761
- :param source_lang: (Optional) Language code of input document, for example "DE",
762
- "EN", "FR". If omitted, DeepL will auto-detect the input language.
763
- :param target_lang: Language code to translate document into, for example "DE",
764
- "EN-US", "FR".
765
- :param formality: (Optional) Desired formality for translation, as Formality
766
- enum, "less" or "more".
764
+ :param source_lang: (Optional) Language code of input document, for
765
+ example "DE", "EN", "FR". If omitted, DeepL will auto-detect the
766
+ input language.
767
+ :param target_lang: Language code to translate document into, for
768
+ example "DE", "EN-US", "FR".
769
+ :param formality: (Optional) Desired formality for translation, as
770
+ Formality enum, "less" or "more".
767
771
:param glossary: (Optional) glossary or glossary ID to use for
768
772
translation. Must match specified source_lang and target_lang.
769
773
770
- :raises DocumentTranslationException: If an error occurs during translation,
771
- The exception includes information about the document request.
774
+ :raises DocumentTranslationException: If an error occurs during
775
+ translation. The exception includes information about the document
776
+ request.
772
777
"""
773
778
with open (input_path , "rb" ) as in_file :
774
779
with open (output_path , "wb" ) as out_file :
@@ -801,7 +806,8 @@ def translate_document(
801
806
802
807
:param input_document: Document to translate as a file-like object. It
803
808
is recommended to open files in binary mode.
804
- :param output_document: File-like object to receive translated document.
809
+ :param output_document: File-like object to receive translated
810
+ document.
805
811
:param source_lang: (Optional) Language code of input document, for
806
812
example "DE", "EN", "FR". If omitted, DeepL will auto-detect the
807
813
input language.
0 commit comments