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.

train_iv   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 34
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 6

3 Methods

Rating   Name   Duplication   Size   Complexity  
A Train.current_change() 0 3 1
A Train.run() 0 14 3
A Train.voltage_change() 0 3 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A system() 0 2 1
1
import logging
2
from itertools import cycle
3
from curio import sleep
4
from bricknil import attach, start
5
from bricknil.hub import PoweredUpHub
6
from bricknil.sensor import TrainMotor, VisionSensor, Button, LED, VoltageSensor, CurrentSensor
7
from bricknil.const import Color
8
9
@attach(CurrentSensor, name='current', capabilities=[('sense_l', 2)])
10
@attach(TrainMotor, name='motor')
11
class Train(PoweredUpHub):
12
13
    async def voltage_change(self):
14
        mv = self.voltage.value
15
        self.message_info(f'train voltage {mv}')
16
17
    async def current_change(self):
18
        ma = self.current.value
19
        self.message_info(f'train current {ma}')
20
21
    async def run(self):
22
        self.message_info("Running")
23
24
        await self.motor.ramp_speed(50,3000)
25
        await sleep(60)
26
27
        for i in range(10,100,10):
28
            self.message_info(f'ramping speed {i}')
29
            await self.motor.ramp_speed(i, 900)  # Ramp to new speed in 0.9 seconds
30
            await sleep(3)
31
        for i in range(100,10,-10):
32
            self.message_info(f'ramping down speed {i}')
33
            await self.motor.ramp_speed(i, 900)  # Ramp to new speed in 0.9 seconds
34
            await sleep(3)
35
36
37
async def system():
38
    train = Train('My Train')
39
40
if __name__ == '__main__':
41
    logging.basicConfig(level=logging.INFO)
42
    start(system)
43