mirror of
https://github.com/codex-storage/deluge.git
synced 2025-03-01 11:30:43 +00:00
[Lint] Fix pylint issues uncovered by recent changes
This commit is contained in:
parent
e370d7dbdd
commit
90d1bbbb31
@ -164,7 +164,7 @@ class Core(CorePluginBase):
|
|||||||
update_interval(300, 30, 10)
|
update_interval(300, 30, 10)
|
||||||
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log.error("Stats update error %s" % ex)
|
log.error("Stats update error %s", ex)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def save_stats(self):
|
def save_stats(self):
|
||||||
@ -173,7 +173,7 @@ class Core(CorePluginBase):
|
|||||||
self.saved_stats.config.update(self.get_totals())
|
self.saved_stats.config.update(self.get_totals())
|
||||||
self.saved_stats.save()
|
self.saved_stats.save()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log.error("Stats save error", ex)
|
log.error("Stats save error %s", ex)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# export:
|
# export:
|
||||||
|
@ -182,8 +182,8 @@ class Graph:
|
|||||||
"""Given a value x create an array of tick points to got with the graph
|
"""Given a value x create an array of tick points to got with the graph
|
||||||
The number of ticks returned can be constrained by limit, minimum of 3
|
The number of ticks returned can be constrained by limit, minimum of 3
|
||||||
"""
|
"""
|
||||||
# Limit is the number of ticks which is 1 + the number of steps as we
|
# Limit is the number of ticks which is 1 + the number of steps as we
|
||||||
# count the 0 tick in limit
|
# count the 0 tick in limit
|
||||||
if limit is not None:
|
if limit is not None:
|
||||||
if limit < 3:
|
if limit < 3:
|
||||||
limit = 2
|
limit = 2
|
||||||
@ -194,9 +194,9 @@ class Graph:
|
|||||||
scale = self.left_axis['formatter_scale'](x)
|
scale = self.left_axis['formatter_scale'](x)
|
||||||
x = x / float(scale)
|
x = x / float(scale)
|
||||||
|
|
||||||
# Find the largest power of 10 less than x
|
# Find the largest power of 10 less than x
|
||||||
log = math.log10(x)
|
comm_log = math.log10(x)
|
||||||
intbit = math.floor(log)
|
intbit = math.floor(comm_log)
|
||||||
|
|
||||||
interval = math.pow(10, intbit)
|
interval = math.pow(10, intbit)
|
||||||
steps = int(math.ceil(x / interval))
|
steps = int(math.ceil(x / interval))
|
||||||
|
@ -46,9 +46,9 @@ DEFAULT_CONF = {'version': 1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def neat_time(column, cell, model, iter):
|
def neat_time(column, cell, model, data):
|
||||||
"""Render seconds as seconds or minutes with label"""
|
"""Render seconds as seconds or minutes with label"""
|
||||||
seconds = model.get_value(iter, 0)
|
seconds = model.get_value(data, 0)
|
||||||
if seconds > 60:
|
if seconds > 60:
|
||||||
text = "%d %s" % (seconds / 60, _("minutes"))
|
text = "%d %s" % (seconds / 60, _("minutes"))
|
||||||
elif seconds == 60:
|
elif seconds == 60:
|
||||||
@ -62,7 +62,7 @@ def neat_time(column, cell, model, iter):
|
|||||||
|
|
||||||
|
|
||||||
def int_str(number):
|
def int_str(number):
|
||||||
return (str(int(number)))
|
return str(int(number))
|
||||||
|
|
||||||
|
|
||||||
def gtk_to_graph_color(color):
|
def gtk_to_graph_color(color):
|
||||||
@ -186,15 +186,15 @@ class GraphsTab(Tab):
|
|||||||
self.intervals_combo.set_model(liststore)
|
self.intervals_combo.set_model(liststore)
|
||||||
try:
|
try:
|
||||||
current = intervals.index(self.selected_interval)
|
current = intervals.index(self.selected_interval)
|
||||||
except:
|
except Exception:
|
||||||
current = 0
|
current = 0
|
||||||
# should select the value saved in config
|
# should select the value saved in config
|
||||||
self.intervals_combo.set_active(current)
|
self.intervals_combo.set_active(current)
|
||||||
|
|
||||||
def _on_selected_interval_changed(self, combobox):
|
def _on_selected_interval_changed(self, combobox):
|
||||||
model = combobox.get_model()
|
model = combobox.get_model()
|
||||||
iter = combobox.get_active_iter()
|
tree_iter = combobox.get_active_iter()
|
||||||
self.selected_interval = model.get_value(iter, 0)
|
self.selected_interval = model.get_value(tree_iter, 0)
|
||||||
self.update()
|
self.update()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ class GtkUI(GtkPluginBase):
|
|||||||
try:
|
try:
|
||||||
color_btn = self.glade.get_widget("%s_%s_color" % (graph, value))
|
color_btn = self.glade.get_widget("%s_%s_color" % (graph, value))
|
||||||
gtkconf[graph][value] = str(color_btn.get_color())
|
gtkconf[graph][value] = str(color_btn.get_color())
|
||||||
except:
|
except Exception:
|
||||||
gtkconf[graph][value] = DEFAULT_CONF['colors'][graph][value]
|
gtkconf[graph][value] = DEFAULT_CONF['colors'][graph][value]
|
||||||
self.config['colors'] = gtkconf
|
self.config['colors'] = gtkconf
|
||||||
self.graphs_tab.set_colors(self.config['colors'])
|
self.graphs_tab.set_colors(self.config['colors'])
|
||||||
@ -255,8 +255,8 @@ class GtkUI(GtkPluginBase):
|
|||||||
try:
|
try:
|
||||||
color_btn = self.glade.get_widget("%s_%s_color" % (graph, value))
|
color_btn = self.glade.get_widget("%s_%s_color" % (graph, value))
|
||||||
color_btn.set_color(gtk.gdk.Color(color))
|
color_btn.set_color(gtk.gdk.Color(color))
|
||||||
except:
|
except Exception:
|
||||||
log.debug("Unable to set %s %s %s" % (graph, value, color))
|
log.debug("Unable to set %s %s %s", graph, value, color)
|
||||||
client.stats.get_config().addCallback(self.cb_get_config)
|
client.stats.get_config().addCallback(self.cb_get_config)
|
||||||
|
|
||||||
def cb_get_config(self, config):
|
def cb_get_config(self, config):
|
||||||
|
@ -9,12 +9,13 @@ sclient.set_core_uri()
|
|||||||
|
|
||||||
|
|
||||||
def test_sync():
|
def test_sync():
|
||||||
if 1:
|
|
||||||
upload = sclient.graph_get_upload()
|
upload = sclient.graph_get_upload()
|
||||||
download = sclient.graph_get_download()
|
download = sclient.graph_get_download()
|
||||||
print(upload)
|
print(upload)
|
||||||
print(download)
|
print(download)
|
||||||
else:
|
|
||||||
|
"""
|
||||||
upload = [66804, 66915, 66974, 67447, 67540, 67318, 67320, 67249, 66659, 66489, 67027, 66914, 66802, 67303,
|
upload = [66804, 66915, 66974, 67447, 67540, 67318, 67320, 67249, 66659, 66489, 67027, 66914, 66802, 67303,
|
||||||
67654, 67643, 67763, 67528, 67523, 67431, 67214, 66939, 67316, 67020, 66881, 67103, 67377, 67141,
|
67654, 67643, 67763, 67528, 67523, 67431, 67214, 66939, 67316, 67020, 66881, 67103, 67377, 67141,
|
||||||
67366, 67492, 67375, 67203, 67056, 67010, 67029, 66741, 66695, 66868, 66805, 66264, 66249, 66317,
|
67366, 67492, 67375, 67203, 67056, 67010, 67029, 66741, 66695, 66868, 66805, 66264, 66249, 66317,
|
||||||
@ -37,6 +38,7 @@ def test_sync():
|
|||||||
15268, 14793, 15305, 16354, 16720, 17502, 17857, 16622, 18447, 19929, 31138, 36965, 36158, 32795,
|
15268, 14793, 15305, 16354, 16720, 17502, 17857, 16622, 18447, 19929, 31138, 36965, 36158, 32795,
|
||||||
30445, 21997, 18100, 22491, 27227, 29317, 32436, 35700, 39140, 36258, 33697, 24751, 20354, 8211,
|
30445, 21997, 18100, 22491, 27227, 29317, 32436, 35700, 39140, 36258, 33697, 24751, 20354, 8211,
|
||||||
3836, 1560, 834, 2034, 1744, 1637, 1637, 1637, 0, 0]
|
3836, 1560, 834, 2034, 1744, 1637, 1637, 1637, 0, 0]
|
||||||
|
"""
|
||||||
|
|
||||||
from .graph import NetworkGraph
|
from .graph import NetworkGraph
|
||||||
n = NetworkGraph()
|
n = NetworkGraph()
|
||||||
@ -81,8 +83,8 @@ def test_write():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.data = []
|
self.data = []
|
||||||
|
|
||||||
def write(self, str):
|
def write(self, string):
|
||||||
self.data.append(str)
|
self.data.append(string)
|
||||||
|
|
||||||
g = graph.Graph()
|
g = graph.Graph()
|
||||||
g.add_stat('download_rate', color=graph.green)
|
g.add_stat('download_rate', color=graph.green)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# See LICENSE for more details.
|
# See LICENSE for more details.
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
|
@ -941,7 +941,7 @@ class Preferences(component.Component):
|
|||||||
|
|
||||||
def on_plugin_action(arg):
|
def on_plugin_action(arg):
|
||||||
if not value and arg is False:
|
if not value and arg is False:
|
||||||
log.warn("Failed to enable plugin '%s'", name)
|
log.warn("Failed to enable plugin '%s'", name)
|
||||||
self.plugin_liststore.set_value(row, 1, False)
|
self.plugin_liststore.set_value(row, 1, False)
|
||||||
|
|
||||||
d.addBoth(on_plugin_action)
|
d.addBoth(on_plugin_action)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user