From a9991a7a5a240aca228e0d655b2e756293a731b3 Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Sat, 5 Oct 2019 15:22:28 +0530 Subject: [PATCH] class_sqlThread pylint fixes --- src/class_sqlThread.py | 9 ++++----- src/depends.py | 4 ++-- src/helper_inbox.py | 3 ++- src/helper_search.py | 3 +-- src/helper_sql.py | 1 + 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/class_sqlThread.py b/src/class_sqlThread.py index 7df75137..3d59803c 100644 --- a/src/class_sqlThread.py +++ b/src/class_sqlThread.py @@ -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 diff --git a/src/depends.py b/src/depends.py index 0114ec94..7ae9220e 100755 --- a/src/depends.py +++ b/src/depends.py @@ -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 + package and the dialog utility. """ if sys.hexversion < 0x20600F0: logger.error( diff --git a/src/helper_inbox.py b/src/helper_inbox.py index 95214743..1b1710d6 100644 --- a/src/helper_inbox.py +++ b/src/helper_inbox.py @@ -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 diff --git a/src/helper_search.py b/src/helper_search.py index d6704731..0908ada3 100644 --- a/src/helper_search.py +++ b/src/helper_search.py @@ -1,5 +1,4 @@ -#!/usr/bin/python2.7 - +"""Additional SQL helper for searching messages""" from helper_sql import * try: diff --git a/src/helper_sql.py b/src/helper_sql.py index 138a9f50..ad0a5dc4 100644 --- a/src/helper_sql.py +++ b/src/helper_sql.py @@ -80,6 +80,7 @@ def sqlExecuteChunked(sqlStatement, idCount, *args): def sqlExecute(sqlStatement, *args): + """Execute SQL statement (optionally with arguments)""" sqlLock.acquire() sqlSubmitQueue.put(sqlStatement)