Failed Conditions
Pull Request — master (#2076)
by Abdeali
02:04
created

LogPrinterThread.run()   A

Complexity

Conditions 3

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 3
dl 0
loc 7
rs 9.4285
1
import queue
2
import threading
3
4
5
class LogPrinterThread(threading.Thread):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable threading does not seem to be defined.
Loading history...
6
    """
7
    This is the Thread object that outputs all log messages it gets from
8
    its message_queue. Setting obj.running = False will stop within the next
9
    0.1 seconds.
10
    """
11
12
    def __init__(self, message_queue, log_printer):
13
        threading.Thread.__init__(self)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable self does not seem to be defined.
Loading history...
14
        self.running = True
15
        self.message_queue = message_queue
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable message_queue does not seem to be defined.
Loading history...
16
        self.log_printer = log_printer
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable log_printer does not seem to be defined.
Loading history...
17
18
    def run(self):
19
        while self.running:
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable self does not seem to be defined.
Loading history...
20
            try:
21
                elem = self.message_queue.get(timeout=0.1)
22
                self.log_printer.log_message(elem)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable elem does not seem to be defined.
Loading history...
23
            except queue.Empty:
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable queue does not seem to be defined.
Loading history...
24
                pass
25