Plugins/UiExtensionPlugins/Translator/TranslatorEngines/DeepLEngine.py

changeset 6026
4773c9469880
parent 6018
1c858879d3d0
child 6048
82ad8ec9548c
diff -r 9dfb5a421a56 -r 4773c9469880 Plugins/UiExtensionPlugins/Translator/TranslatorEngines/DeepLEngine.py
--- a/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/DeepLEngine.py	Mon Dec 11 19:17:20 2017 +0100
+++ b/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/DeepLEngine.py	Mon Dec 11 19:27:20 2017 +0100
@@ -58,7 +58,7 @@
         @return list of supported language codes
         @rtype list of str
         """
-        return ["de", "en", "es", "fr", "it", "nl", "pl",]
+        return ["de", "en", "es", "fr", "it", "nl", "pl", ]
     
     def getTranslation(self, requestObject, text, originalLanguage,
                        translationLanguage):
@@ -88,8 +88,9 @@
             "method": "LMT_handle_jobs",
             "id": 1,
             "params": {
-                "jobs": [{"kind": "default", "raw_en_sentence": s}
-                         for s in sentences
+                "jobs": [
+                    {"kind": "default", "raw_en_sentence": s}
+                    for s in sentences
                 ],
                 "lang": {
                     "user_preferred_langs": [
@@ -113,7 +114,7 @@
             
             if "error" in responseDict:
                 return self.tr("DeepL reported an error.\nMessage: {0}")\
-                    .format(responseDict["error"]["message"]),  False
+                    .format(responseDict["error"]["message"]), False
             
             if "result" not in responseDict:
                 return self.tr("DeepL call returned an unknown result"), False
@@ -134,9 +135,10 @@
             for translation in translations:
                 translationStrings.append(
                     "<br/>".join(
-                        [s["postprocessed_sentence"] for s in sorted(
-                            translation["beams"],
-                            key=lambda b: -1 * b["score"])
+                        [
+                            s["postprocessed_sentence"] for s in sorted(
+                                translation["beams"],
+                                key=lambda b: -1 * b["score"])
                         ]
                     )
                 )

eric ide

mercurial