titibs29 / API_LED_PY

Re-defined variable from outer scope PYL-W0621
Anti-pattern
Major
4 occurrences in this check
Redefining name 'pin' from outer scope (line 69)
11
12
13@app.route('/set/<pin:int>/<state:int>')
14def set(pin, state):15    if pin not in pins:
16        abort(code=404, text="pin useless")
17    if not state in (1, 0):
Redefining name 'pin' from outer scope (line 69)
35
36
37@app.get('/get/<pin:int>')
38def get(pin):39    if pin not in pins:
40        abort(code=404, text="pin useless")
41    return str(states.get(pin))
Redefining name 'pin' from outer scope (line 69)
47
48
49@app.get('/switch/<pin:int>')
50def switch(pin):51    if not pin:
52        abort(code=404, text="pin not provided")
53    if pin not in pins:
Redefining name 'pin' from outer scope (line 69)
24@app.get('/setAll/<state:int>')
25def setAll(state):
26    gpio.output(pins, state)
27    for pin in states:28        states[pin] = state
29    return "all pins changed to "+str(state)
30