Fix unsued-import pylint errors

This commit is contained in:
Philipp Hörist 2018-09-16 11:37:38 +02:00 committed by Philipp Hörist
parent 4cf7d20600
commit d011be2d89
15 changed files with 40 additions and 52 deletions

View File

@ -24,10 +24,11 @@
# along with Gajim. If not, see <http://www.gnu.org/licenses/>. # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
import os import os
import re
import time import time
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import Pango
from gi.repository import GLib from gi.repository import GLib
from gi.repository import Gio from gi.repository import Gio
@ -36,8 +37,6 @@ from gajim import message_control
from gajim.gtk import NonModalConfirmationDialog from gajim.gtk import NonModalConfirmationDialog
from gajim.gtk.util import convert_rgb_to_hex from gajim.gtk.util import convert_rgb_to_hex
from gajim import notify from gajim import notify
import re
from gajim.gtk.emoji_chooser import emoji_chooser from gajim.gtk.emoji_chooser import emoji_chooser
from gajim.common import events from gajim.common import events
from gajim.common import app 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 # module, but still they need to be kept around. Importing them automatically
# registers the contained CommandContainers with the command system, thereby # registers the contained CommandContainers with the command system, thereby
# populating the list of available commands. # populating the list of available commands.
# pylint: disable=unused-import
from gajim.command_system.implementation import standard from gajim.command_system.implementation import standard
from gajim.command_system.implementation import execute from gajim.command_system.implementation import execute
# pylint: enable=unused-import
if app.is_installed('GSPELL'): if app.is_installed('GSPELL'):
from gi.repository import Gspell from gi.repository import Gspell

View File

@ -20,11 +20,9 @@ Provides an actual implementation for the standard commands.
from time import localtime, strftime from time import localtime, strftime
from datetime import date from datetime import date
from gajim import dialogs
from gajim.common import app from gajim.common import app
from gajim.common import helpers from gajim.common import helpers
from gajim.common.i18n import _ from gajim.common.i18n import _
from gajim.common.exceptions import GajimGeneralException
from gajim.common.const import KindConstant from gajim.common.const import KindConstant
from gajim.command_system.errors import CommandError 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 from gajim.command_system.implementation.hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
class StandardCommonCommands(CommandContainer): class StandardCommonCommands(CommandContainer):
""" """
This command container contains standard commands which are common This command container contains standard commands which are common

View File

@ -18,8 +18,6 @@
# pylint: disable=attribute-defined-outside-init # pylint: disable=attribute-defined-outside-init
from calendar import timegm from calendar import timegm
import hashlib
import hmac
import logging import logging
from time import time as time_time from time import time as time_time

View File

@ -23,7 +23,6 @@
import sys import sys
import logging import logging
from gajim.common import app
from gajim.common import exceptions from gajim.common import exceptions
from gajim.common.i18n import _ from gajim.common.i18n import _

View File

@ -36,24 +36,24 @@ import select
import base64 import base64
import hashlib import hashlib
import shlex import shlex
from gajim.common import caps_cache
import socket import socket
import time import time
import logging
from datetime import datetime, timedelta from datetime import datetime, timedelta
from distutils.version import LooseVersion as V from distutils.version import LooseVersion as V
from encodings.punycode import punycode_encode from encodings.punycode import punycode_encode
from string import Template from string import Template
import nbxmpp import nbxmpp
from gajim.common import caps_cache
from gajim.common import configpaths
from gajim.common.i18n import Q_ from gajim.common.i18n import Q_
from gajim.common.i18n import _ from gajim.common.i18n import _
from gajim.common.i18n import ngettext from gajim.common.i18n import ngettext
from gajim.common import configpaths
try: try:
import precis_i18n.codec import precis_i18n.codec # pylint: disable=unused-import
HAS_PRECIS_I18N = True HAS_PRECIS_I18N = True
except ImportError: except ImportError:
HAS_PRECIS_I18N = False HAS_PRECIS_I18N = False
@ -81,7 +81,6 @@ try:
except Exception: except Exception:
pass pass
import logging
log = logging.getLogger('gajim.c.helpers') log = logging.getLogger('gajim.c.helpers')
special_groups = (_('Transports'), _('Not in Roster'), _('Observers'), _('Groupchats')) special_groups = (_('Transports'), _('Not in Roster'), _('Observers'), _('Groupchats'))

View File

@ -29,10 +29,12 @@ Handles Jingle sessions (XEP 0166)
import logging import logging
from enum import Enum, unique from enum import Enum, unique
import nbxmpp import nbxmpp
from gajim.common import app from gajim.common import app
from gajim.common.jingle_transport import get_jingle_transport, JingleTransportIBB 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.jingle_ft import State
from gajim.common.connection_handlers_events import ( from gajim.common.connection_handlers_events import (
FilesProp, JingleRequestReceivedEvent, JingleDisconnectedReceivedEvent, FilesProp, JingleRequestReceivedEvent, JingleDisconnectedReceivedEvent,

View File

@ -16,7 +16,6 @@
import logging import logging
import copy import copy
from typing import Optional
from collections import OrderedDict from collections import OrderedDict
import nbxmpp import nbxmpp

View File

@ -16,7 +16,6 @@ from gi.repository import Gtk
from gajim.common import app from gajim.common import app
from gajim.common import helpers from gajim.common import helpers
from gajim.common.modules import dataforms
from gajim.gtk.util import get_builder from gajim.gtk.util import get_builder
from gajim.gtk.util import load_icon from gajim.gtk.util import load_icon

View File

@ -18,7 +18,6 @@ from gi.repository import Gdk
from gajim.common import app from gajim.common import app
from gajim.common import helpers from gajim.common import helpers
from gajim.common import ged
from gajim.common.caps_cache import muc_caps_cache from gajim.common.caps_cache import muc_caps_cache
from gajim.common.exceptions import GajimGeneralException from gajim.common.exceptions import GajimGeneralException
from gajim.gtk import ErrorDialog from gajim.gtk import ErrorDialog

View File

@ -14,17 +14,18 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Gajim. If not, see <http://www.gnu.org/licenses/>. # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gtk, Gio, GLib
import os import os
from gajim import gtkgui_helpers
from gajim import message_control
from gajim.common import app from gi.repository import Gtk, Gio, GLib
from gajim.common import helpers
from gajim.common import i18n
from nbxmpp.protocol import NS_COMMANDS, NS_FILE, NS_MUC from nbxmpp.protocol import NS_COMMANDS, NS_FILE, NS_MUC
from nbxmpp.protocol import NS_JINGLE_FILE_TRANSFER_5, NS_CONFERENCE 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.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, def build_resources_submenu(contacts, account, action, room_jid=None,
room_account=None, cap=None): room_account=None, cap=None):

View File

@ -31,32 +31,33 @@ with the markup that docutils generate, and also more
modular. 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 GObject
from gi.repository import Pango from gi.repository import Pango
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import GdkPixbuf from gi.repository import GdkPixbuf
import xml.sax
import xml.sax.handler
import re
from io import StringIO
import urllib
if __name__ == '__main__': if __name__ == '__main__':
from gajim.common import i18n
from gajim.common import configpaths from gajim.common import configpaths
configpaths.init() configpaths.init()
from gajim.common import app 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 load_icon
from gajim.gtk.util import get_cursor from gajim.gtk.util import get_cursor
from gajim.gtk.util import get_builder 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') log = logging.getLogger('gajim.htmlview')
__all__ = ['HtmlTextView'] __all__ = ['HtmlTextView']
@ -1096,11 +1097,6 @@ change_cursor = None
if __name__ == '__main__': if __name__ == '__main__':
from gajim.conversation_textview import ConversationTextview from gajim.conversation_textview import ConversationTextview
from gajim.gui_interface import Interface 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() Interface()

View File

@ -20,7 +20,6 @@ import os
import locale import locale
import gettext import gettext
from gajim.common import app
from gajim.common import configpaths from gajim.common import configpaths
APP = 'gajim_plugins' APP = 'gajim_plugins'
@ -36,5 +35,4 @@ try:
t = gettext.translation(APP, plugins_locale_dir) t = gettext.translation(APP, plugins_locale_dir)
_ = t.gettext _ = t.gettext
except IOError: except IOError:
from gajim.common import i18n
_ = gettext.gettext _ = gettext.gettext

View File

@ -21,16 +21,15 @@ import string
import random import random
import itertools import itertools
from gajim import message_control
from gajim import notify
from gajim.common import helpers from gajim.common import helpers
from gajim.common import events from gajim.common import events
from gajim.common import app from gajim.common import app
from gajim.common import contacts from gajim.common import contacts
from gajim.common import ged from gajim.common import ged
from gajim.common.connection_handlers_events import ChatstateReceivedEvent, \ from gajim.common.connection_handlers_events import ChatstateReceivedEvent
InformationEvent
from gajim.common.const import KindConstant from gajim.common.const import KindConstant
from gajim import message_control
from gajim import notify
from gajim.gtk import SingleMessageWindow from gajim.gtk import SingleMessageWindow

View File

@ -25,7 +25,6 @@ from gi.repository import Gtk
from gi.repository import Gdk from gi.repository import Gdk
from gajim import dialogs from gajim import dialogs
from gajim import config
from gajim import tooltips from gajim import tooltips
from gajim import gtkgui_helpers from gajim import gtkgui_helpers
from gajim.common import app from gajim.common import app

View File

@ -25,16 +25,15 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Gajim. If not, see <http://www.gnu.org/licenses/>. # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
import os
import base64
import binascii
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import GLib from gi.repository import GLib
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import GdkPixbuf
import base64
import binascii
import os
from gajim import gtkgui_helpers from gajim import gtkgui_helpers
from gajim.common import helpers from gajim.common import helpers
from gajim.common import app from gajim.common import app
from gajim.common import ged from gajim.common import ged
@ -44,6 +43,7 @@ from gajim.common.const import AvatarSize
# log = logging.getLogger('gajim.vcard') # log = logging.getLogger('gajim.vcard')
class VcardWindow: class VcardWindow:
""" """
Class for contact's information window Class for contact's information window