Remove untyped except statements

This commit is contained in:
wordofglass 2016-04-26 00:14:35 +02:00
parent ac06be1a5a
commit bb5629ea1d
6 changed files with 8 additions and 12 deletions

View file

@ -1317,7 +1317,7 @@ class DateField(MediaField):
for item in items:
try:
items_.append(int(item))
except:
except (TypeError, ValueError):
items_.append(None)
return items_

View file

@ -264,7 +264,7 @@ def load_plugins(names=()):
and obj != BeetsPlugin and obj not in _classes:
_classes.add(obj)
except:
except Exception:
log.warning(
u'** error loading plugin {}:\n{}',
name,

View file

@ -570,7 +570,7 @@ class Template(object):
"""
try:
res = self.compiled(values, functions)
except: # Handle any exceptions thrown by compiled version.
except Exception: # Handle any exceptions thrown by compiled version.
res = self.interpret(values, functions)
return res

View file

@ -270,7 +270,7 @@ class FirstPipelineThread(PipelineThread):
return
self.out_queue.put(msg)
except:
except BaseException:
self.abort_all(sys.exc_info())
return
@ -318,7 +318,7 @@ class MiddlePipelineThread(PipelineThread):
return
self.out_queue.put(msg)
except:
except BaseException:
self.abort_all(sys.exc_info())
return
@ -357,7 +357,7 @@ class LastPipelineThread(PipelineThread):
# Send to consumer.
self.coro.send(msg)
except:
except BaseException:
self.abort_all(sys.exc_info())
return
@ -425,7 +425,7 @@ class Pipeline(object):
while threads[-1].is_alive():
threads[-1].join(1)
except:
except BaseException:
# Stop all the threads immediately.
for thread in threads:
thread.abort()

View file

@ -185,7 +185,7 @@ class DuplicatesPlugin(BeetsPlugin):
if tag:
try:
k, v = tag.split('=')
except:
except Exception:
raise UserError(
u"{}: can't parse k=v tag: {}".format(PLUGIN, tag)
)

View file

@ -274,8 +274,6 @@ class GioURI(URIGetter):
try:
uri_ptr = self.libgio.g_file_get_uri(g_file_ptr)
except:
raise
finally:
self.libgio.g_object_unref(g_file_ptr)
if not uri_ptr:
@ -285,8 +283,6 @@ class GioURI(URIGetter):
try:
uri = copy_c_string(uri_ptr)
except:
raise
finally:
self.libgio.g_free(uri_ptr)