SonarQube fixes

This commit is contained in:
Juanjo Salvador
2018-04-20 22:24:06 +02:00
parent 5368b3bef7
commit b9622a2920

View File

@@ -80,17 +80,14 @@ class Utils:
block = []
for td in row.find_all('td'):
if td.find_all('a'):
for link in td.find_all('a'):
if link.get('href')[-9:] != '#comments':
block.append(link.get('href'))
if link.text.rstrip():
block.append(link.text)
block.append(link.text.rstrip())
if td.text.rstrip():
block.append(td.text.rstrip())
try:
torrent = {
'id': block[1].replace("/view/", ""),
'category': Utils.nyaa_categories(block[0]),
@@ -106,8 +103,6 @@ class Utils:
}
torrents.append(torrent)
except IndexError as ie:
pass
return torrents
@@ -152,17 +147,14 @@ class Utils:
block = []
for td in row.find_all('td'):
if td.find_all('a'):
for link in td.find_all('a'):
if link.get('href')[-9:] != '#comments':
block.append(link.get('href'))
if link.text.rstrip():
block.append(link.text)
block.append(link.text.rstrip())
if td.text.rstrip():
block.append(td.text.rstrip())
try:
torrent = {
'id': block[1].replace("/view/", ""),
'category': Utils.sukebei_categories(block[0]),
@@ -178,8 +170,6 @@ class Utils:
}
torrents.append(torrent)
except IndexError as ie:
pass
return torrents
@@ -227,14 +217,13 @@ class Utils:
if param in available_params:
if param != "category" and param != "status" and param != "lang":
query += "&{}={}".format(param, value)
else:
if param == "category":
elif param == "category":
query += "&c={}_{}".format(value[0], value[1])
if param == "status":
elif param == "status":
query += "&s={}".format(value)
if param == "lang":
elif param == "lang":
for lang in value:
query += "&lang={}".format(lang)