87 self.ring.add_node((server, instance))
88
89 def removeDestination(self, destination):
90 (server, port, instance) = destination 91 if not self.hasDestination(destination):
92 raise Exception("destination instance (%s, %s) not configured" % (server, instance))
93 del self.instance_ports[(server, instance)]
41 pass
42 fake_service = _FakeService()
43
44 for plugin_name, plugin_class in MetricReceiver.plugins.items(): 45 plugin_class.build(fake_service)
46
47
38 self.aggregation_func = None
39
40 def input(self, datapoint):
41 (timestamp, value) = datapoint 42 interval = timestamp - (timestamp % self.aggregation_frequency)
43 if interval in self.interval_buffers:
44 buffer = self.interval_buffers[interval]
6
7class ProcessorTest(TestCase):
8 def test_processor_registers(self):
9 class DummyProcessor(Processor):10 plugin_name = "dummy_processor"
11
12 self.assertTrue("dummy_processor" in Processor.plugins)
77 options.
78 """
79 parser = FakeParser()
80 options, args = parser.parse_args(("start",)) 81 self.assertEqual(("start",), args)
82
83
An unused variable takes up space in the code, and can lead to confusion, and it should be removed. If this variable is necessary, name the variable _
to indicate that it will be unused, or start the name with unused
or _unused
.
def update():
for i in range(10): # Usused variable `i`
time.sleep(0.01)
display_result()
def update():
for _ in range(10):
time.sleep(0.01)
display_result()