From d011be2d898939ef3b96510ac1a41b59db5ecc25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sun, 16 Sep 2018 11:37:38 +0200 Subject: [PATCH] Fix unsued-import pylint errors --- gajim/chat_control_base.py | 7 +++-- .../command_system/implementation/standard.py | 3 +- gajim/common/connection_handlers_events.py | 2 -- gajim/common/dbus_support.py | 1 - gajim/common/helpers.py | 9 +++--- gajim/common/jingle_session.py | 4 ++- gajim/common/modules/bookmarks.py | 1 - gajim/gtk/dialogs.py | 1 - gajim/gtk/join_groupchat.py | 1 - gajim/gui_menu_builder.py | 13 ++++---- gajim/htmltextview.py | 30 ++++++++----------- gajim/plugins/plugins_i18n.py | 2 -- gajim/session.py | 7 ++--- gajim/statusicon.py | 1 - gajim/vcard.py | 10 +++---- 15 files changed, 40 insertions(+), 52 deletions(-) diff --git a/gajim/chat_control_base.py b/gajim/chat_control_base.py index b9066f366..1a82f304e 100644 --- a/gajim/chat_control_base.py +++ b/gajim/chat_control_base.py @@ -24,10 +24,11 @@ # along with Gajim. If not, see . import os +import re import time + from gi.repository import Gtk from gi.repository import Gdk -from gi.repository import Pango from gi.repository import GLib from gi.repository import Gio @@ -36,8 +37,6 @@ from gajim import message_control from gajim.gtk import NonModalConfirmationDialog from gajim.gtk.util import convert_rgb_to_hex from gajim import notify -import re - from gajim.gtk.emoji_chooser import emoji_chooser from gajim.common import events from gajim.common import app @@ -58,8 +57,10 @@ from gajim.command_system.implementation.middleware import CommandTools # module, but still they need to be kept around. Importing them automatically # registers the contained CommandContainers with the command system, thereby # populating the list of available commands. +# pylint: disable=unused-import from gajim.command_system.implementation import standard from gajim.command_system.implementation import execute +# pylint: enable=unused-import if app.is_installed('GSPELL'): from gi.repository import Gspell diff --git a/gajim/command_system/implementation/standard.py b/gajim/command_system/implementation/standard.py index 89b3cf9e8..985afcd8a 100644 --- a/gajim/command_system/implementation/standard.py +++ b/gajim/command_system/implementation/standard.py @@ -20,11 +20,9 @@ Provides an actual implementation for the standard commands. from time import localtime, strftime from datetime import date -from gajim import dialogs from gajim.common import app from gajim.common import helpers from gajim.common.i18n import _ -from gajim.common.exceptions import GajimGeneralException from gajim.common.const import KindConstant from gajim.command_system.errors import CommandError @@ -33,6 +31,7 @@ from gajim.command_system.mapping import generate_usage from gajim.command_system.implementation.hosts import ChatCommands, PrivateChatCommands, GroupChatCommands + class StandardCommonCommands(CommandContainer): """ This command container contains standard commands which are common diff --git a/gajim/common/connection_handlers_events.py b/gajim/common/connection_handlers_events.py index 32373b8a4..f38682c8e 100644 --- a/gajim/common/connection_handlers_events.py +++ b/gajim/common/connection_handlers_events.py @@ -18,8 +18,6 @@ # pylint: disable=attribute-defined-outside-init from calendar import timegm -import hashlib -import hmac import logging from time import time as time_time diff --git a/gajim/common/dbus_support.py b/gajim/common/dbus_support.py index 1f0e63ea0..265295524 100644 --- a/gajim/common/dbus_support.py +++ b/gajim/common/dbus_support.py @@ -23,7 +23,6 @@ import sys import logging -from gajim.common import app from gajim.common import exceptions from gajim.common.i18n import _ diff --git a/gajim/common/helpers.py b/gajim/common/helpers.py index 593c77bae..042a08ff1 100644 --- a/gajim/common/helpers.py +++ b/gajim/common/helpers.py @@ -36,24 +36,24 @@ import select import base64 import hashlib import shlex -from gajim.common import caps_cache import socket import time +import logging from datetime import datetime, timedelta from distutils.version import LooseVersion as V - from encodings.punycode import punycode_encode from string import Template import nbxmpp +from gajim.common import caps_cache +from gajim.common import configpaths from gajim.common.i18n import Q_ from gajim.common.i18n import _ from gajim.common.i18n import ngettext -from gajim.common import configpaths try: - import precis_i18n.codec + import precis_i18n.codec # pylint: disable=unused-import HAS_PRECIS_I18N = True except ImportError: HAS_PRECIS_I18N = False @@ -81,7 +81,6 @@ try: except Exception: pass -import logging log = logging.getLogger('gajim.c.helpers') special_groups = (_('Transports'), _('Not in Roster'), _('Observers'), _('Groupchats')) diff --git a/gajim/common/jingle_session.py b/gajim/common/jingle_session.py index f2c9e8c60..d4df04946 100644 --- a/gajim/common/jingle_session.py +++ b/gajim/common/jingle_session.py @@ -29,10 +29,12 @@ Handles Jingle sessions (XEP 0166) import logging from enum import Enum, unique + import nbxmpp + from gajim.common import app from gajim.common.jingle_transport import get_jingle_transport, JingleTransportIBB -from gajim.common.jingle_content import get_jingle_content, JingleContentSetupException, JingleContent +from gajim.common.jingle_content import get_jingle_content, JingleContentSetupException from gajim.common.jingle_ft import State from gajim.common.connection_handlers_events import ( FilesProp, JingleRequestReceivedEvent, JingleDisconnectedReceivedEvent, diff --git a/gajim/common/modules/bookmarks.py b/gajim/common/modules/bookmarks.py index 32515307e..f2a6b0b28 100644 --- a/gajim/common/modules/bookmarks.py +++ b/gajim/common/modules/bookmarks.py @@ -16,7 +16,6 @@ import logging import copy -from typing import Optional from collections import OrderedDict import nbxmpp diff --git a/gajim/gtk/dialogs.py b/gajim/gtk/dialogs.py index 68f604915..f9b393755 100644 --- a/gajim/gtk/dialogs.py +++ b/gajim/gtk/dialogs.py @@ -16,7 +16,6 @@ from gi.repository import Gtk from gajim.common import app from gajim.common import helpers -from gajim.common.modules import dataforms from gajim.gtk.util import get_builder from gajim.gtk.util import load_icon diff --git a/gajim/gtk/join_groupchat.py b/gajim/gtk/join_groupchat.py index 2fd8ed3d6..2102fb1c8 100644 --- a/gajim/gtk/join_groupchat.py +++ b/gajim/gtk/join_groupchat.py @@ -18,7 +18,6 @@ from gi.repository import Gdk from gajim.common import app from gajim.common import helpers -from gajim.common import ged from gajim.common.caps_cache import muc_caps_cache from gajim.common.exceptions import GajimGeneralException from gajim.gtk import ErrorDialog diff --git a/gajim/gui_menu_builder.py b/gajim/gui_menu_builder.py index fa3b17e06..175b89082 100644 --- a/gajim/gui_menu_builder.py +++ b/gajim/gui_menu_builder.py @@ -14,17 +14,18 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see . -from gi.repository import Gtk, Gio, GLib import os -from gajim import gtkgui_helpers -from gajim import message_control -from gajim.common import app -from gajim.common import helpers -from gajim.common import i18n +from gi.repository import Gtk, Gio, GLib from nbxmpp.protocol import NS_COMMANDS, NS_FILE, NS_MUC from nbxmpp.protocol import NS_JINGLE_FILE_TRANSFER_5, NS_CONFERENCE + +from gajim import gtkgui_helpers +from gajim import message_control from gajim.gtkgui_helpers import get_action +from gajim.common import app +from gajim.common import helpers + def build_resources_submenu(contacts, account, action, room_jid=None, room_account=None, cap=None): diff --git a/gajim/htmltextview.py b/gajim/htmltextview.py index f1d6a1ff8..ab5530c51 100644 --- a/gajim/htmltextview.py +++ b/gajim/htmltextview.py @@ -31,32 +31,33 @@ with the markup that docutils generate, and also more modular. """ +import re +import logging +import urllib +import xml.sax +import xml.sax.handler +from io import StringIO + from gi.repository import GObject from gi.repository import Pango from gi.repository import Gtk from gi.repository import Gdk from gi.repository import GdkPixbuf -import xml.sax -import xml.sax.handler -import re -from io import StringIO -import urllib if __name__ == '__main__': - from gajim.common import i18n from gajim.common import configpaths configpaths.init() + from gajim.common import app +from gajim.common import helpers +from gajim.common.i18n import _ +from gajim.common.const import StyleAttr +from gajim.gtk import JoinGroupchatWindow +from gajim.gtk import AddNewContactWindow from gajim.gtk.util import load_icon from gajim.gtk.util import get_cursor from gajim.gtk.util import get_builder -from gajim.common import helpers -from gajim.gtk import JoinGroupchatWindow -from gajim.gtk import AddNewContactWindow -from gajim.common.const import StyleAttr - -import logging log = logging.getLogger('gajim.htmlview') __all__ = ['HtmlTextView'] @@ -1096,11 +1097,6 @@ change_cursor = None if __name__ == '__main__': from gajim.conversation_textview import ConversationTextview from gajim.gui_interface import Interface - from gajim.common import app, logger, caps_cache - # TODO: don't call Logger() it will create the DB - # maybe mock this object for tests - # app.logger = logger.Logger() - # caps_cache.initialize(app.logger) Interface() diff --git a/gajim/plugins/plugins_i18n.py b/gajim/plugins/plugins_i18n.py index 16860bc21..e962553e3 100644 --- a/gajim/plugins/plugins_i18n.py +++ b/gajim/plugins/plugins_i18n.py @@ -20,7 +20,6 @@ import os import locale import gettext -from gajim.common import app from gajim.common import configpaths APP = 'gajim_plugins' @@ -36,5 +35,4 @@ try: t = gettext.translation(APP, plugins_locale_dir) _ = t.gettext except IOError: - from gajim.common import i18n _ = gettext.gettext diff --git a/gajim/session.py b/gajim/session.py index 4fa00b513..838e047d9 100644 --- a/gajim/session.py +++ b/gajim/session.py @@ -21,16 +21,15 @@ import string import random import itertools +from gajim import message_control +from gajim import notify from gajim.common import helpers from gajim.common import events from gajim.common import app from gajim.common import contacts from gajim.common import ged -from gajim.common.connection_handlers_events import ChatstateReceivedEvent, \ - InformationEvent +from gajim.common.connection_handlers_events import ChatstateReceivedEvent from gajim.common.const import KindConstant -from gajim import message_control -from gajim import notify from gajim.gtk import SingleMessageWindow diff --git a/gajim/statusicon.py b/gajim/statusicon.py index 6ea971b7c..80e9248b6 100644 --- a/gajim/statusicon.py +++ b/gajim/statusicon.py @@ -25,7 +25,6 @@ from gi.repository import Gtk from gi.repository import Gdk from gajim import dialogs -from gajim import config from gajim import tooltips from gajim import gtkgui_helpers from gajim.common import app diff --git a/gajim/vcard.py b/gajim/vcard.py index a196b3882..37c7c03ca 100644 --- a/gajim/vcard.py +++ b/gajim/vcard.py @@ -25,16 +25,15 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see . +import os +import base64 +import binascii + from gi.repository import Gtk from gi.repository import GLib from gi.repository import Gdk -from gi.repository import GdkPixbuf -import base64 -import binascii -import os from gajim import gtkgui_helpers - from gajim.common import helpers from gajim.common import app from gajim.common import ged @@ -44,6 +43,7 @@ from gajim.common.const import AvatarSize # log = logging.getLogger('gajim.vcard') + class VcardWindow: """ Class for contact's information window