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
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

View File

@ -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(

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
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

View File

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

View File

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