class_sqlThread pylint fixes

This commit is contained in:
lakshyacis 2019-10-05 15:22:28 +05:30
parent dbbf454c15
commit a9991a7a5a
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB
5 changed files with 10 additions and 10 deletions

View File

@ -4,22 +4,21 @@ sqlThread is defined here
import threading import threading
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
import sqlite3 import sqlite3
import time import time
import shutil # used for moving the messages.dat file import shutil # used for moving the messages.dat file
import sys import sys
import os import os
from debug import logger from debug import logger
import helper_sql import helper_sql
import helper_startup import helper_startup
import paths import paths
import queues import queues
import state import state
import tr import tr
# pylint: disable=attribute-defined-outside-init,protected-access
# 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.
class sqlThread(threading.Thread): class sqlThread(threading.Thread):
@ -28,7 +27,7 @@ class sqlThread(threading.Thread):
def __init__(self): def __init__(self):
threading.Thread.__init__(self, name="SQL") 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`""" """Process SQL queries from `.helper_sql.sqlSubmitQueue`"""
self.conn = sqlite3.connect(state.appdata + 'messages.dat') self.conn = sqlite3.connect(state.appdata + 'messages.dat')
self.conn.text_factory = str self.conn.text_factory = str

View File

@ -316,8 +316,8 @@ def check_curses():
"""Do curses dependency check. """Do curses dependency check.
Here we are checking for curses if available or not with check Here we are checking for curses if available or not with check
as interface requires the pythondialog\ package and the dialog as interface requires the pythondialog <https://pypi.org/project/pythondialog>
utility. package and the dialog utility.
""" """
if sys.hexversion < 0x20600F0: if sys.hexversion < 0x20600F0:
logger.error( logger.error(

View File

@ -1,10 +1,11 @@
"""Helper Inbox performs inbox messagese related operations.""" """Helper Inbox performs inbox messages related operations."""
from helper_sql import sqlExecute, sqlQuery from helper_sql import sqlExecute, sqlQuery
import queues import queues
def insert(t): def insert(t):
"""Perform an insert into the "inbox" table"""
sqlExecute('''INSERT INTO inbox VALUES (?,?,?,?,?,?,?,?,?,?)''', *t) sqlExecute('''INSERT INTO inbox VALUES (?,?,?,?,?,?,?,?,?,?)''', *t)
# shouldn't emit changedInboxUnread and displayNewInboxMessage # shouldn't emit changedInboxUnread and displayNewInboxMessage
# at the same time # at the same time

View File

@ -1,5 +1,4 @@
#!/usr/bin/python2.7 """Additional SQL helper for searching messages"""
from helper_sql import * from helper_sql import *
try: try:

View File

@ -80,6 +80,7 @@ def sqlExecuteChunked(sqlStatement, idCount, *args):
def sqlExecute(sqlStatement, *args): def sqlExecute(sqlStatement, *args):
"""Execute SQL statement (optionally with arguments)"""
sqlLock.acquire() sqlLock.acquire()
sqlSubmitQueue.put(sqlStatement) sqlSubmitQueue.put(sqlStatement)