mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-06 15:04:34 +08:00
Fix defects found by lgtm.com
This commit is contained in:
parent
53f9d031c9
commit
d52c6230e9
@ -1,4 +1,4 @@
|
||||
#VERSION: 1.42
|
||||
#VERSION: 1.43
|
||||
|
||||
# Author:
|
||||
# Christophe DUMEZ (chris@qbittorrent.org)
|
||||
@ -90,7 +90,7 @@ def retrieve_url(url):
|
||||
charset = 'utf-8'
|
||||
try:
|
||||
ignore, charset = info['Content-Type'].split('charset=')
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
dat = dat.decode(charset, 'replace')
|
||||
dat = htmlentitydecode(dat)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#VERSION: 1.42
|
||||
#VERSION: 1.43
|
||||
|
||||
# Author:
|
||||
# Fabien Devaux <fab AT gnux DOT info>
|
||||
@ -77,7 +77,7 @@ def initialize_engines():
|
||||
# bind class name
|
||||
globals()[engi] = getattr(engine_module, engi)
|
||||
supported_engines.append(engi)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return supported_engines
|
||||
@ -94,7 +94,7 @@ def engines_to_xml(supported_engines):
|
||||
if hasattr(search_engine, "supported_categories"):
|
||||
supported_categories = " ".join((key
|
||||
for key in search_engine.supported_categories.keys()
|
||||
if key is not "all"))
|
||||
if key != "all"))
|
||||
|
||||
yield "".join((tab, "<", short_name, ">\n",
|
||||
tab, tab, "<name>", search_engine.name, "</name>\n",
|
||||
@ -138,7 +138,7 @@ def run_search(engine_list):
|
||||
else:
|
||||
engine.search(what)
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#VERSION: 1.21
|
||||
#VERSION: 1.22
|
||||
|
||||
# Author:
|
||||
# Christophe DUMEZ (chris@qbittorrent.org)
|
||||
@ -45,7 +45,7 @@ for engine in engines:
|
||||
exec("from engines.%s import %s" % (e, e))
|
||||
exec("engine_url = %s.url" % e)
|
||||
supported_engines[engine_url] = e
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -1,4 +1,4 @@
|
||||
#VERSION: 1.46
|
||||
#VERSION: 1.47
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
@ -51,13 +51,13 @@ def anySizeToBytes(size_string):
|
||||
# separate integer from unit
|
||||
try:
|
||||
size, unit = size_string.split()
|
||||
except:
|
||||
except Exception:
|
||||
try:
|
||||
size = size_string.strip()
|
||||
unit = ''.join([c for c in size if c.isalpha()])
|
||||
if len(unit) > 0:
|
||||
size = size[:-len(unit)]
|
||||
except:
|
||||
except Exception:
|
||||
return -1
|
||||
if len(size) == 0:
|
||||
return -1
|
||||
|
@ -1,4 +1,4 @@
|
||||
#VERSION: 1.41
|
||||
#VERSION: 1.42
|
||||
|
||||
# Author:
|
||||
# Christophe DUMEZ (chris@qbittorrent.org)
|
||||
@ -90,7 +90,7 @@ def retrieve_url(url):
|
||||
charset = 'utf-8'
|
||||
try:
|
||||
ignore, charset = info['Content-Type'].split('charset=')
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
dat = dat.decode(charset, 'replace')
|
||||
dat = htmlentitydecode(dat)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#VERSION: 1.42
|
||||
#VERSION: 1.43
|
||||
|
||||
# Author:
|
||||
# Fabien Devaux <fab AT gnux DOT info>
|
||||
@ -76,7 +76,7 @@ def initialize_engines():
|
||||
# bind class name
|
||||
globals()[engi] = getattr(engine_module, engi)
|
||||
supported_engines.append(engi)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return supported_engines
|
||||
@ -93,7 +93,7 @@ def engines_to_xml(supported_engines):
|
||||
if hasattr(search_engine, "supported_categories"):
|
||||
supported_categories = " ".join((key
|
||||
for key in search_engine.supported_categories.keys()
|
||||
if key is not "all"))
|
||||
if key != "all"))
|
||||
|
||||
yield "".join((tab, "<", short_name, ">\n",
|
||||
tab, tab, "<name>", search_engine.name, "</name>\n",
|
||||
@ -138,7 +138,7 @@ def run_search(engine_list):
|
||||
engine.search(what)
|
||||
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#VERSION: 1.21
|
||||
#VERSION: 1.22
|
||||
|
||||
# Author:
|
||||
# Christophe DUMEZ (chris@qbittorrent.org)
|
||||
@ -45,7 +45,7 @@ for engine in engines:
|
||||
exec("from engines.%s import %s" % (e, e))
|
||||
exec("engine_url = %s.url" % e)
|
||||
supported_engines[engine_url] = e
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user