eric6/WebBrowser/SafeBrowsing/SafeBrowsingAPIClient.py

changeset 7269
0c63ea7f94bd
parent 7229
53054eb5b15a
child 7360
9190402e4505
diff -r a28338eaf694 -r 0c63ea7f94bd eric6/WebBrowser/SafeBrowsing/SafeBrowsingAPIClient.py
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingAPIClient.py	Wed Sep 25 18:48:22 2019 +0200
+++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingAPIClient.py	Wed Sep 25 18:52:40 2019 +0200
@@ -11,8 +11,10 @@
 import json
 import base64
 
-from PyQt5.QtCore import pyqtSignal, QObject, QDateTime, QUrl, QByteArray, \
-    QCoreApplication, QEventLoop
+from PyQt5.QtCore import (
+    pyqtSignal, QObject, QDateTime, QUrl, QByteArray, QCoreApplication,
+    QEventLoop
+)
 from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply
 
 from WebBrowser.WebBrowserWindow import WebBrowserWindow
@@ -119,8 +121,9 @@
             "listUpdateRequests": [],
         }
         
-        for (threatType, platformType, threatEntryType), currentState in \
-                clientStates.items():
+        for (threatType, platformType, threatEntryType), currentState in (
+            clientStates.items()
+        ):
             requestBody["listUpdateRequests"].append(
                 {
                     "threatType": threatType,
@@ -187,17 +190,22 @@
             requestBody["threatInfo"]["threatEntries"].append(
                 {"hash": base64.b64encode(prefix).decode("ascii")})
         
-        for (threatType, platformType, threatEntryType), currentState in \
-                clientState.items():
+        for (threatType, platformType, threatEntryType), currentState in (
+            clientState.items()
+        ):
             requestBody["clientStates"].append(currentState)
             if threatType not in requestBody["threatInfo"]["threatTypes"]:
                 requestBody["threatInfo"]["threatTypes"].append(threatType)
-            if platformType not in \
-                    requestBody["threatInfo"]["platformTypes"]:
+            if (
+                platformType not in
+                    requestBody["threatInfo"]["platformTypes"]
+            ):
                 requestBody["threatInfo"]["platformTypes"].append(
                     platformType)
-            if threatEntryType not in \
-                    requestBody["threatInfo"]["threatEntryTypes"]:
+            if (
+                threatEntryType not in
+                    requestBody["threatInfo"]["threatEntryTypes"]
+            ):
                 requestBody["threatInfo"]["threatEntryTypes"].append(
                     threatEntryType)
         
@@ -245,8 +253,9 @@
             self.__nextRequestNoSoonerThan = QDateTime()
         else:
             waitDuration = int(float(minimumWaitDuration.rstrip("s")))
-            self.__nextRequestNoSoonerThan = \
+            self.__nextRequestNoSoonerThan = (
                 QDateTime.currentDateTime().addSecs(waitDuration)
+            )
     
     def fairUseDelayExpired(self):
         """
@@ -295,8 +304,10 @@
         
         # check the local cache first
         if urlStr in self.__lookupApiCache:
-            if self.__lookupApiCache[urlStr]["validUntil"] > \
-               QDateTime.currentDateTime():
+            if (
+                self.__lookupApiCache[urlStr]["validUntil"] >
+                    QDateTime.currentDateTime()
+            ):
                 # cached entry is still valid
                 return self.__lookupApiCache[urlStr]["threatInfo"], error
             else:

eric ide

mercurial