changeset 748674f25b6a in /home/hg/repos/gajim-plugins
author: Bahtiar `kalkin-` Gadimov bahtiar@gadimov.de branches: details:gajim-plugins?cmd=changeset;node=748674f25b6a description: Add some straight forward pylint fixes
diffstat:
omemo/__init__.py | 1 + omemo/omemo/db_helpers.py | 6 ++++-- omemo/ui.py | 20 +++++++++----------- 3 files changed, 14 insertions(+), 13 deletions(-)
diffs (86 lines):
diff -r b092256f8c43 -r 748674f25b6a omemo/__init__.py --- a/omemo/__init__.py Thu Jul 28 22:54:11 2016 +0200 +++ b/omemo/__init__.py Thu Jul 28 22:57:25 2016 +0200 @@ -65,6 +65,7 @@
@log_calls('OmemoPlugin') def init(self): + # pylint: disable=attribute-defined-outside-init if not HAS_AXOLOTL: self.activatable = False self.available_text = _(AXOLOTL_MISSING) diff -r b092256f8c43 -r 748674f25b6a omemo/omemo/db_helpers.py --- a/omemo/omemo/db_helpers.py Thu Jul 28 22:54:11 2016 +0200 +++ b/omemo/omemo/db_helpers.py Thu Jul 28 22:57:25 2016 +0200 @@ -1,11 +1,13 @@ +''' Database helper functions ''' +
def table_exists(db, name): """ Check if the specified table exists in the db. """
- q = """ SELECT name FROM sqlite_master + query = """ SELECT name FROM sqlite_master WHERE type='table' AND name=?; """ - return db.execute(q, (name, )).fetchone() is not None + return db.execute(query, (name, )).fetchone() is not None
def user_version(db): diff -r b092256f8c43 -r 748674f25b6a omemo/ui.py --- a/omemo/ui.py Thu Jul 28 22:54:11 2016 +0200 +++ b/omemo/ui.py Thu Jul 28 22:57:25 2016 +0200 @@ -18,14 +18,17 @@ # the Gajim-OMEMO plugin. If not, see http://www.gnu.org/licenses/. #
+import binascii import logging
+import gobject import gtk + +# pylint: disable=import-error +import gtkgui_helpers from common import gajim from plugins.gui import GajimPluginConfigDialog -import gobject -import binascii -import gtkgui_helpers +# pylint: enable=import-error
log = logging.getLogger('gajim.plugin_system.omemo')
@@ -207,6 +210,7 @@
class OMEMOConfigDialog(GajimPluginConfigDialog): def init(self): + # pylint: disable=attribute-defined-outside-init self.GTK_BUILDER_FILE_PATH = \ self.plugin.local_file_path('config_dialog.ui') self.B = gtk.Builder() @@ -348,10 +352,7 @@ getAllActiveSessionsKeys() for item in fprDB: _id, jid, fpr, tr = item - if fpr in activeSessions: - active = True - else: - active = False + active = fpr in activeSessions fpr = binascii.hexlify(fpr) fpr = self.human_hash(fpr[2:]) if tr == UNTRUSTED: @@ -525,10 +526,7 @@
for item in fprDB: _id, jid, fpr, tr = item - if fpr in activeSessions: - active = True - else: - active = False + active = fpr in activeSessions fpr = binascii.hexlify(fpr) fpr = self.human_hash(fpr[2:]) if tr == UNTRUSTED: