GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( f7c16c...141f85 )
by Benjamin
02:01
created

Led   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
dl 0
loc 23
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A deactivate() 0 3 1
A __toggle() 0 8 1
A __init__() 0 5 1
A activate() 0 3 1
1
class Led(object):
2
    def __init__(self, bus, address, port):
3
        self.bus = bus
4
        self.address = address
5
        self.port = port
6
        self.active = False
7
8
    def activate(self):
9
        self.__toggle(True)
10
        self.active = True
11
12
    def deactivate(self):
13
        self.__toggle(False)
14
        self.active = False
15
16
    def __toggle(self, state):
17
        state_list = list(bin(self.active)[2:].zfill(8))
18
19
        state_list[self.port] = int(state)
20
        state = ''.join(state_list)
21
22
        state = int(state, 2)
23
        self.bus.write_byte(self.address, state)
24