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.

Led.__init__()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
cc 1
c 5
b 0
f 0
dl 0
loc 6
rs 9.4285
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 = True
7
        self.deactivate()
8
9
    def activate(self):
10
        self.__toggle(1)
11
        self.active = True
12
13
    def deactivate(self):
14
        self.__toggle(0)
15
        self.active = False
16
17
    def __toggle(self, state):
18
        state_list = list(bin(self.active)[2:].zfill(8))
19
20
        state_list[self.port] = state
21
        state = ''.join(str(e) for e in state_list)
22
        state = int(state, 2)
23
24
        self.bus.write_byte(self.address, state)
25