class_sqlThread pylint fixes
This commit is contained in:
parent
dbbf454c15
commit
a9991a7a5a
|
@ -4,22 +4,21 @@ sqlThread is defined here
|
|||
|
||||
import threading
|
||||
from bmconfigparser import BMConfigParser
|
||||
|
||||
import sqlite3
|
||||
import time
|
||||
import shutil # used for moving the messages.dat file
|
||||
import sys
|
||||
import os
|
||||
from debug import logger
|
||||
|
||||
import helper_sql
|
||||
import helper_startup
|
||||
import paths
|
||||
import queues
|
||||
import state
|
||||
import tr
|
||||
|
||||
# This thread exists because SQLITE3 is so un-threadsafe that we must
|
||||
# submit queries to it and it puts results back in a different queue. They
|
||||
# won't let us just use locks.
|
||||
# pylint: disable=attribute-defined-outside-init,protected-access
|
||||
|
||||
|
||||
class sqlThread(threading.Thread):
|
||||
|
@ -28,7 +27,7 @@ class sqlThread(threading.Thread):
|
|||
def __init__(self):
|
||||
threading.Thread.__init__(self, name="SQL")
|
||||
|
||||
def run(self):
|
||||
def run(self): # pylint: disable=too-many-locals, too-many-branches, too-many-statements
|
||||
"""Process SQL queries from `.helper_sql.sqlSubmitQueue`"""
|
||||
self.conn = sqlite3.connect(state.appdata + 'messages.dat')
|
||||
self.conn.text_factory = str
|
||||
|
|
|
@ -316,8 +316,8 @@ def check_curses():
|
|||
"""Do curses dependency check.
|
||||
|
||||
Here we are checking for curses if available or not with check
|
||||
as interface requires the pythondialog\ package and the dialog
|
||||
utility.
|
||||
as interface requires the pythondialog <https://pypi.org/project/pythondialog>
|
||||
package and the dialog utility.
|
||||
"""
|
||||
if sys.hexversion < 0x20600F0:
|
||||
logger.error(
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
"""Helper Inbox performs inbox messagese related operations."""
|
||||
"""Helper Inbox performs inbox messages related operations."""
|
||||
|
||||
from helper_sql import sqlExecute, sqlQuery
|
||||
import queues
|
||||
|
||||
|
||||
def insert(t):
|
||||
"""Perform an insert into the "inbox" table"""
|
||||
sqlExecute('''INSERT INTO inbox VALUES (?,?,?,?,?,?,?,?,?,?)''', *t)
|
||||
# shouldn't emit changedInboxUnread and displayNewInboxMessage
|
||||
# at the same time
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/python2.7
|
||||
|
||||
"""Additional SQL helper for searching messages"""
|
||||
from helper_sql import *
|
||||
|
||||
try:
|
||||
|
|
|
@ -80,6 +80,7 @@ def sqlExecuteChunked(sqlStatement, idCount, *args):
|
|||
|
||||
|
||||
def sqlExecute(sqlStatement, *args):
|
||||
"""Execute SQL statement (optionally with arguments)"""
|
||||
sqlLock.acquire()
|
||||
sqlSubmitQueue.put(sqlStatement)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user