pyflake fixes

unused variables, imports, name shadowing
This commit is contained in:
mathieui 2016-10-21 00:20:41 +02:00
parent ab84756b45
commit 0bb67982b0
8 changed files with 11 additions and 24 deletions

View file

@ -7,7 +7,6 @@ import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
import os import os
from datetime import datetime
from xml.etree import cElementTree as ET from xml.etree import cElementTree as ET
from slixmpp.xmlstream.stanzabase import StanzaBase from slixmpp.xmlstream.stanzabase import StanzaBase

View file

@ -1136,7 +1136,7 @@ class Core(object):
""" """
def read_next_digit(digit): def read_next_digit(digit):
try: try:
nb = int(digit) int(digit)
except ValueError: except ValueError:
# If it is not a number, we do nothing. If it was the first # If it is not a number, we do nothing. If it was the first
# one, we do not wait for a second one by re-setting the # one, we do not wait for a second one by re-setting the

View file

@ -23,7 +23,6 @@ from poezio import common
from poezio import fixes from poezio import fixes
from poezio import pep from poezio import pep
from poezio import tabs from poezio import tabs
from poezio import windows
from poezio import xhtml from poezio import xhtml
from poezio import multiuserchat as muc from poezio import multiuserchat as muc
from poezio.common import safeJID from poezio.common import safeJID

View file

@ -271,9 +271,9 @@ class PluginManager(object):
""" """
try: try:
names = set() names = set()
for path in self.load_path: for path_ in self.load_path:
try: try:
add = set(os.listdir(path)) add = set(os.listdir(path_))
names |= add names |= add
except: except:
pass pass
@ -312,9 +312,9 @@ class PluginManager(object):
if not plugins_conf_dir: if not plugins_conf_dir:
config_home = os.environ.get('XDG_CONFIG_HOME') config_home = os.environ.get('XDG_CONFIG_HOME')
if not config_home: if not config_home:
config_home = os.path.join(os.environ.get('HOME'), '.config') config_home = path.join(os.environ.get('HOME'), '.config')
plugins_conf_dir = os.path.join(config_home, 'poezio', 'plugins') plugins_conf_dir = path.join(config_home, 'poezio', 'plugins')
self.plugins_conf_dir = os.path.expanduser(plugins_conf_dir) self.plugins_conf_dir = path.expanduser(plugins_conf_dir)
self.check_create_plugins_conf_dir() self.check_create_plugins_conf_dir()
def check_create_plugins_conf_dir(self): def check_create_plugins_conf_dir(self):
@ -337,11 +337,11 @@ class PluginManager(object):
""" """
plugins_dir = config.get('plugins_dir') plugins_dir = config.get('plugins_dir')
plugins_dir = plugins_dir or\ plugins_dir = plugins_dir or\
os.path.join(os.environ.get('XDG_DATA_HOME') or\ path.join(os.environ.get('XDG_DATA_HOME') or\
os.path.join(os.environ.get('HOME'), path.join(os.environ.get('HOME'),
'.local', 'share'), '.local', 'share'),
'poezio', 'plugins') 'poezio', 'plugins')
self.plugins_dir = os.path.expanduser(plugins_dir) self.plugins_dir = path.expanduser(plugins_dir)
self.check_create_plugins_dir() self.check_create_plugins_dir()
def check_create_plugins_dir(self): def check_create_plugins_dir(self):

View file

@ -13,7 +13,6 @@ Starting point of poezio. Launches both the Connection and Gui
import sys import sys
import os import os
import signal import signal
import logging
sys.path.append(os.path.dirname(os.path.abspath(__file__))) sys.path.append(os.path.dirname(os.path.abspath(__file__)))
@ -75,8 +74,6 @@ def main():
from poezio import core from poezio import core
log = logging.getLogger('')
signal.signal(signal.SIGINT, signal.SIG_IGN) # ignore ctrl-c signal.signal(signal.SIGINT, signal.SIG_IGN) # ignore ctrl-c
cocore = core.Core() cocore = core.Core()
signal.signal(signal.SIGUSR1, cocore.sigusr_handler) # reload the config signal.signal(signal.SIGUSR1, cocore.sigusr_handler) # reload the config

View file

@ -915,18 +915,14 @@ class MucTab(ChatTab):
""" """
self.need_resize = False self.need_resize = False
if config.get('hide_user_list') or self.size.tab_degrade_x: if config.get('hide_user_list') or self.size.tab_degrade_x:
display_user_list = False
text_width = self.width text_width = self.width
else: else:
display_user_list = True
text_width = (self.width // 10) * 9 text_width = (self.width // 10) * 9
if self.size.tab_degrade_y: if self.size.tab_degrade_y:
display_info_win = False
tab_win_height = 0 tab_win_height = 0
info_win_height = 0 info_win_height = 0
else: else:
display_info_win = True
tab_win_height = Tab.tab_win_height() tab_win_height = Tab.tab_win_height()
info_win_height = self.core.information_win_size info_win_height = self.core.information_win_size

View file

@ -269,8 +269,6 @@ class RosterInfoTab(Tab):
""" """
completion for /cert_add <name> <path> [management] completion for /cert_add <name> <path> [management]
""" """
text = the_input.get_text()
args = common.shell_split(text)
n = the_input.get_argument_position() n = the_input.get_argument_position()
log.debug('%s %s %s', the_input.text, n, the_input.pos) log.debug('%s %s %s', the_input.text, n, the_input.pos)
if n == 1: if n == 1:
@ -352,8 +350,6 @@ class RosterInfoTab(Tab):
""" """
completion for /cert_fetch <name> <path> completion for /cert_fetch <name> <path>
""" """
text = the_input.get_text()
args = common.shell_split(text)
n = the_input.get_argument_position() n = the_input.get_argument_position()
log.debug('%s %s %s', the_input.text, n, the_input.pos) log.debug('%s %s %s', the_input.text, n, the_input.pos)
if n == 1: if n == 1:

View file

@ -154,8 +154,8 @@ class XMLTab(Tab):
self.refresh() self.refresh()
def match_stanza(self, stanza): def match_stanza(self, stanza):
for matcher in self.filters: for matcher_ in self.filters:
if not matcher.match(stanza): if not matcher_.match(stanza):
return False return False
return True return True