diff -r 27f636beebad -r 2c730d5fd177 eric6/WebBrowser/SafeBrowsing/SafeBrowsingCache.py --- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingCache.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingCache.py Tue Mar 02 17:17:09 2021 +0100 @@ -196,8 +196,9 @@ query.prepare( queryStr.format(",".join(["?"] * len(hashValues)))) for hashValue in hashValues: - query.addBindValue(QByteArray(hashValue), - QSql.In | QSql.Binary) + query.addBindValue( + QByteArray(hashValue), + QSql.ParamTypeFlag.In | QSql.ParamTypeFlag.Binary) query.exec() @@ -209,8 +210,9 @@ threatList = ThreatList(threatType, platformType, threatEntryType) output.append((threatList, hasExpired)) - QCoreApplication.processEvents(QEventLoop.AllEvents, - self.maxProcessEventsTime) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) del query finally: db.commit() @@ -255,8 +257,9 @@ threatList = ThreatList(threatType, platformType, threatEntryType) output.append((threatList, fullHash, negativeCacheExpired)) - QCoreApplication.processEvents(QEventLoop.AllEvents, - self.maxProcessEventsTime) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) del query finally: db.commit() @@ -299,8 +302,9 @@ try: query = QSqlQuery(db) query.prepare(insertQueryStr) - query.addBindValue(QByteArray(hashValue), - QSql.In | QSql.Binary) + query.addBindValue( + QByteArray(hashValue), + QSql.ParamTypeFlag.In | QSql.ParamTypeFlag.Binary) query.addBindValue(threatList.threatType) query.addBindValue(threatList.platformType) query.addBindValue(threatList.threatEntryType) @@ -310,8 +314,9 @@ query = QSqlQuery(db) query.prepare(updateQueryStr) - query.addBindValue(QByteArray(hashValue), - QSql.In | QSql.Binary) + query.addBindValue( + QByteArray(hashValue), + QSql.ParamTypeFlag.In | QSql.ParamTypeFlag.Binary) query.addBindValue(threatList.threatType) query.addBindValue(threatList.platformType) query.addBindValue(threatList.threatEntryType) @@ -400,8 +405,9 @@ try: query = QSqlQuery(db) query.prepare(queryStr) - query.addBindValue(QByteArray(hashPrefix), - QSql.In | QSql.Binary) + query.addBindValue( + QByteArray(hashPrefix), + QSql.ParamTypeFlag.In | QSql.ParamTypeFlag.Binary) query.addBindValue(threatList.threatType) query.addBindValue(threatList.platformType) query.addBindValue(threatList.threatEntryType) @@ -440,8 +446,9 @@ threatList = ThreatList(threatType, platformType, threatEntryType) output.append((threatList, clientState)) - QCoreApplication.processEvents(QEventLoop.AllEvents, - self.maxProcessEventsTime) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) del query finally: db.commit() @@ -550,7 +557,8 @@ db = QSqlDatabase.database(self.__connectionName) if db.isOpen(): db.transaction() - sha256Hash = QCryptographicHash(QCryptographicHash.Sha256) + sha256Hash = QCryptographicHash( + QCryptographicHash.Algorithm.Sha256) try: query = QSqlQuery(db) query.prepare(queryStr) @@ -562,8 +570,9 @@ while query.next(): # __IGNORE_WARNING_M523__ sha256Hash.addData(query.value(0)) - QCoreApplication.processEvents(QEventLoop.AllEvents, - self.maxProcessEventsTime) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) del query finally: db.commit() @@ -595,16 +604,18 @@ for prefix in prefixes: query = QSqlQuery(db) query.prepare(queryStr) - query.addBindValue(QByteArray(prefix), - QSql.In | QSql.Binary) + query.addBindValue( + QByteArray(prefix), + QSql.ParamTypeFlag.In | QSql.ParamTypeFlag.Binary) query.addBindValue(prefix[:4].hex()) query.addBindValue(threatList.threatType) query.addBindValue(threatList.platformType) query.addBindValue(threatList.threatEntryType) query.exec() del query - QCoreApplication.processEvents(QEventLoop.AllEvents, - self.maxProcessEventsTime) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) finally: db.commit() @@ -646,8 +657,9 @@ prefix = bytes(query.value(0)) output.append(prefix) index += 1 - QCoreApplication.processEvents(QEventLoop.AllEvents, - self.maxProcessEventsTime) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) del query finally: db.commit() @@ -692,12 +704,15 @@ query.addBindValue(threatList.platformType) query.addBindValue(threatList.threatEntryType) for prefix in removeBatch: - query.addBindValue(QByteArray(prefix), - QSql.In | QSql.Binary) + query.addBindValue( + QByteArray(prefix), + QSql.ParamTypeFlag.In | + QSql.ParamTypeFlag.Binary) query.exec() del query QCoreApplication.processEvents( - QEventLoop.AllEvents, self.maxProcessEventsTime) + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) finally: db.commit()