Fix assignment-from-none pylint errors

This commit is contained in:
Philipp Hörist 2019-04-07 20:13:35 +02:00
parent ee38f76004
commit 1c39d66d21
5 changed files with 14 additions and 17 deletions

View File

@ -497,7 +497,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
item = Gtk.SeparatorMenuItem.new()
menu.prepend(item)
menu2 = self.prepare_context_menu()
menu2 = self.prepare_context_menu() # pylint: disable=assignment-from-none
i = 0
for item in menu2:
menu2.remove(item)

View File

@ -113,14 +113,16 @@ class OptionsParser:
app.config.foreach(self.write_line, file)
except IOError:
log.exception('Failed to write config file')
return
return False
try:
temp_filepath.replace(config_path)
except Exception:
log.exception('Failed to replace config file')
else:
log.info('Successful saved config file')
return False
log.info('Successful saved config file')
return True
def update_config(self, old_version, new_version):
old_version_list = old_version.split('.') # convert '0.x.y' to (0, x, y)

View File

@ -1297,8 +1297,7 @@ class Socks5Client(Socks5):
return
if self.state < 5:
self.idlequeue.set_read_timeout(self.fd, CONNECT_TIMEOUT)
result = self.main(0)
self.queue.process_result(result, self)
self.main(0)
elif self.state == 5: # wait for proxy reply
pass
elif self.file_props.type_ == 'r':

View File

@ -2038,15 +2038,12 @@ class Interface:
@staticmethod
def save_config():
err_str = parser.write()
if err_str is not None:
print(err_str, file=sys.stderr)
# it is good to notify the user
# in case he or she cannot see the output of the console
error_dialog = ErrorDialog(_('Could not save your settings and '
'preferences'), err_str)
error_dialog.run()
sys.exit()
if parser.write():
return
error_dialog = ErrorDialog(
_('Could not save your settings and preferences'))
error_dialog.run()
@staticmethod
def update_avatar(account=None, jid=None, contact=None, room_avatar=False):

View File

@ -1,7 +1,7 @@
#!/bin/sh
PYLINT=${PYLINT:-pylint}
"$PYLINT" --disable=C0103,C0302,C0330,C0411,C0412,C0413,E0203,E0401,E0611,E0710,E0712,E1101,E1102,E1128,E1133,E1136,R0201,R0901,R0904,R0913,R0916,R1702,W0201,W0212,W0221,W0223,W0311,W0401,W0603,W0613,W0614 "$@"
"$PYLINT" --disable=C0103,C0302,C0330,C0411,C0412,C0413,E0203,E0401,E0611,E0710,E0712,E1101,E1102,E1133,E1136,R0201,R0901,R0904,R0913,R0916,R1702,W0201,W0212,W0221,W0223,W0311,W0401,W0603,W0613,W0614 "$@"
# C0103 invalid-name
# C0302 too-many-lines
@ -16,7 +16,6 @@ PYLINT=${PYLINT:-pylint}
# E0712 catching-non-exception - GLib.GError is not recognized
# E1101 no-member
# E1102 not-callable
# E1128 assignment-from-none
# E1133 not-an-iterable
# E1136 unsubscriptable-object
# R0201 no-self-use