Fix bare-except pylint errors

This commit is contained in:
Philipp Hörist 2018-09-16 23:45:01 +02:00 committed by Philipp Hörist
parent 1c7f347a08
commit 5ff08236bb
11 changed files with 14 additions and 14 deletions

View File

@ -306,7 +306,7 @@ class AdvancedConfigurationWindow:
else: else:
try: try:
value = str(option) value = str(option)
except: except Exception:
value = option value = option
self.model.append(parent, [name, value, type_]) self.model.append(parent, [name, value, type_])

View File

@ -412,7 +412,7 @@ class JingleVideo(JingleRTPContent):
framerate = '' framerate = ''
try: try:
w, h = app.config.get('video_size').split('x') w, h = app.config.get('video_size').split('x')
except: except Exception:
w = h = None w = h = None
if w and h: if w and h:
video_size = 'video/x-raw,width=%s,height=%s ! ' % (w, h) video_size = 'video/x-raw,width=%s,height=%s ! ' % (w, h)

View File

@ -85,7 +85,7 @@ def load_cert_file(cert_path, cert_store=None):
except OpenSSL.crypto.Error as exception_obj: except OpenSSL.crypto.Error as exception_obj:
log.warning('Unable to load a certificate from file %s: %s', log.warning('Unable to load a certificate from file %s: %s',
cert_path, exception_obj.args[0][0][2]) cert_path, exception_obj.args[0][0][2])
except: except Exception:
log.warning('Unknown error while loading certificate from file ' log.warning('Unknown error while loading certificate from file '
'%s', cert_path) '%s', cert_path)
begin = -1 begin = -1

View File

@ -741,7 +741,7 @@ class MultipleDataForm(DataForm):
# def reported(self, record): # def reported(self, record):
# try: # try:
# self.delChild('reported') # self.delChild('reported')
# except: # except Exception:
# pass # pass
# #
# record.setName('reported') # record.setName('reported')

View File

@ -813,7 +813,7 @@ class ConnectionIBBytestream(ConnectionBytestream):
file_props = FilesProp.getFilePropByTransportSid(self.name, sid) file_props = FilesProp.getFilePropByTransportSid(self.name, sid)
try: try:
blocksize = int(blocksize) blocksize = int(blocksize)
except: except Exception:
err = nbxmpp.ERR_BAD_REQUEST err = nbxmpp.ERR_BAD_REQUEST
if not sid or not blocksize: if not sid or not blocksize:
err = nbxmpp.ERR_BAD_REQUEST err = nbxmpp.ERR_BAD_REQUEST

View File

@ -193,7 +193,7 @@ class IterableIPShell:
if self.iter_more: if self.iter_more:
try: try:
self.prompt = self.generatePrompt(True) self.prompt = self.generatePrompt(True)
except: except Exception:
self.IP.showtraceback() self.IP.showtraceback()
if self.IP.autoindent: if self.IP.autoindent:
self.IP.rl_do_indent = True self.IP.rl_do_indent = True
@ -203,7 +203,7 @@ class IterableIPShell:
except KeyboardInterrupt: except KeyboardInterrupt:
self.IP.write('\nKeyboardInterrupt\n') self.IP.write('\nKeyboardInterrupt\n')
self.IP.input_splitter.reset() self.IP.input_splitter.reset()
except: except Exception:
self.IP.showtraceback() self.IP.showtraceback()
else: else:
self.IP.input_splitter.push(line) self.IP.input_splitter.push(line)

View File

@ -37,7 +37,7 @@ import xml.etree.ElementTree as ET
try: try:
from PIL import Image from PIL import Image
except: except Exception:
pass pass
from io import BytesIO from io import BytesIO

View File

@ -48,7 +48,7 @@ import OpenSSL
try: try:
from PIL import Image from PIL import Image
except: except Exception:
pass pass
from gajim.common import app from gajim.common import app
@ -934,7 +934,7 @@ class Interface:
h = Hashes2() h = Hashes2()
try: try:
file_ = open(file_props.file_name, 'rb') file_ = open(file_props.file_name, 'rb')
except: except Exception:
return return
hash_ = h.calculateHash(file_props.algo, file_) hash_ = h.calculateHash(file_props.algo, file_)
file_.close() file_.close()

View File

@ -283,7 +283,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
def get_val(min_val=minl, max_val=maxl): def get_val(min_val=minl, max_val=maxl):
try: try:
val = float(value[:-2]) val = float(value[:-2])
except: except Exception:
log.warning('Unable to parse length value "%s"', value) log.warning('Unable to parse length value "%s"', value)
return None return None
if val > 0: if val > 0:

View File

@ -258,7 +258,7 @@ class GajimPluginConfig():
try: try:
self.data = pickle.load(fd) self.data = pickle.load(fd)
fd.close() fd.close()
except: except Exception:
fd.close() fd.close()
try: try:
import shelve import shelve
@ -269,7 +269,7 @@ class GajimPluginConfig():
raise GajimPluginException raise GajimPluginException
s.close() s.close()
self.save() self.save()
except: except Exception:
log.warning('%s plugin config file not readable. Saving it as ' log.warning('%s plugin config file not readable. Saving it as '
'%s and creating a new one' % (self.plugin.short_name, '%s and creating a new one' % (self.plugin.short_name,
self.FILE_PATH.decode(locale.getpreferredencoding()) + '.bak')) self.FILE_PATH.decode(locale.getpreferredencoding()) + '.bak'))

View File

@ -328,7 +328,7 @@ if dbus_support.supported:
jid = self._get_real_jid(jid, account) jid = self._get_real_jid(jid, account)
try: try:
jid = helpers.parse_jid(jid) jid = helpers.parse_jid(jid)
except: except Exception:
# Jid is not conform, ignore it # Jid is not conform, ignore it
return DBUS_BOOLEAN(False) return DBUS_BOOLEAN(False)