The following issues were found
tests/extmod/uctypes_ptr_native_le.py
9 issues
Line: 1
Column: 1
import usys
try:
import uctypes
except ImportError:
print("SKIP")
raise SystemExit
if usys.byteorder != "little":
Reported by Pylint.
Line: 7
Column: 5
import uctypes
except ImportError:
print("SKIP")
raise SystemExit
if usys.byteorder != "little":
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 20
Column: 1
"ptr2": (uctypes.PTR | 0, {"b": uctypes.UINT8 | 0}),
}
bytes = b"01"
addr = uctypes.addressof(bytes)
buf = addr.to_bytes(uctypes.sizeof(desc), "little")
S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.NATIVE)
Reported by Pylint.
Line: 1
Column: 1
import usys
try:
import uctypes
except ImportError:
print("SKIP")
raise SystemExit
if usys.byteorder != "little":
Reported by Pylint.
Line: 20
Column: 1
"ptr2": (uctypes.PTR | 0, {"b": uctypes.UINT8 | 0}),
}
bytes = b"01"
addr = uctypes.addressof(bytes)
buf = addr.to_bytes(uctypes.sizeof(desc), "little")
S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.NATIVE)
Reported by Pylint.
Line: 28
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.NATIVE)
print(S.ptr[0])
assert S.ptr[0] == ord("0")
print(S.ptr[1])
assert S.ptr[1] == ord("1")
print(hex(S.ptr16[0]))
assert hex(S.ptr16[0]) == "0x3130"
print(S.ptr2[0].b, S.ptr2[1].b)
Reported by Bandit.
Line: 30
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
print(S.ptr[0])
assert S.ptr[0] == ord("0")
print(S.ptr[1])
assert S.ptr[1] == ord("1")
print(hex(S.ptr16[0]))
assert hex(S.ptr16[0]) == "0x3130"
print(S.ptr2[0].b, S.ptr2[1].b)
print(S.ptr2[0].b, S.ptr2[1].b)
print(hex(S.ptr16[0]))
Reported by Bandit.
Line: 32
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
print(S.ptr[1])
assert S.ptr[1] == ord("1")
print(hex(S.ptr16[0]))
assert hex(S.ptr16[0]) == "0x3130"
print(S.ptr2[0].b, S.ptr2[1].b)
print(S.ptr2[0].b, S.ptr2[1].b)
print(hex(S.ptr16[0]))
assert (S.ptr2[0].b, S.ptr2[1].b) == (48, 49)
Reported by Bandit.
Line: 36
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
print(S.ptr2[0].b, S.ptr2[1].b)
print(S.ptr2[0].b, S.ptr2[1].b)
print(hex(S.ptr16[0]))
assert (S.ptr2[0].b, S.ptr2[1].b) == (48, 49)
Reported by Bandit.
ports/esp32/boards/manifest.py
9 issues
Line: 1
Column: 1
freeze("$(PORT_DIR)/modules")
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/ports/esp8266/modules", "ntptime.py")
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")
Reported by Pylint.
Line: 2
Column: 1
freeze("$(PORT_DIR)/modules")
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/ports/esp8266/modules", "ntptime.py")
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")
Reported by Pylint.
Line: 3
Column: 1
freeze("$(PORT_DIR)/modules")
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/ports/esp8266/modules", "ntptime.py")
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")
Reported by Pylint.
Line: 4
Column: 1
freeze("$(PORT_DIR)/modules")
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/ports/esp8266/modules", "ntptime.py")
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")
Reported by Pylint.
Line: 5
Column: 1
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/ports/esp8266/modules", "ntptime.py")
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")
Reported by Pylint.
Line: 6
Column: 1
freeze("$(MPY_DIR)/ports/esp8266/modules", "ntptime.py")
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")
Reported by Pylint.
Line: 7
Column: 1
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")
Reported by Pylint.
Line: 8
Column: 1
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")
Reported by Pylint.
Line: 1
Column: 1
freeze("$(PORT_DIR)/modules")
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/ports/esp8266/modules", "ntptime.py")
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")
Reported by Pylint.
tests/basics/exceptpoly.py
9 issues
Line: 3
Column: 8
try:
raise ArithmeticError
except Exception:
print("Caught ArithmeticError via Exception")
try:
raise ArithmeticError
except ArithmeticError:
print("Caught ArithmeticError")
Reported by Pylint.
Line: 13
Column: 8
try:
raise AssertionError
except Exception:
print("Caught AssertionError via Exception")
try:
raise AssertionError
except AssertionError:
Reported by Pylint.
Line: 23
Column: 8
try:
raise AttributeError
except Exception:
print("Caught AttributeError via Exception")
try:
raise AttributeError
except AttributeError:
Reported by Pylint.
Line: 33
Column: 8
try:
raise EOFError
except Exception:
print("Caught EOFError via Exception")
try:
raise EOFError
except EOFError:
Reported by Pylint.
Line: 43
Column: 8
try:
raise Exception
except BaseException:
print("Caught Exception via BaseException")
try:
raise Exception
except Exception:
Reported by Pylint.
Line: 48
Column: 8
try:
raise Exception
except Exception:
print("Caught Exception")
try:
raise ImportError
except Exception:
Reported by Pylint.
Line: 53
Column: 8
try:
raise ImportError
except Exception:
print("Caught ImportError via Exception")
try:
raise ImportError
except ImportError:
Reported by Pylint.
Line: 93
Column: 8
try:
raise LookupError
except Exception:
print("Caught LookupError via Exception")
try:
raise LookupError
except LookupError:
Reported by Pylint.
Line: 1
Column: 1
try:
raise ArithmeticError
except Exception:
print("Caught ArithmeticError via Exception")
try:
raise ArithmeticError
except ArithmeticError:
print("Caught ArithmeticError")
Reported by Pylint.
tests/micropython/viper_subscr.py
9 issues
Line: 4
Column: 2
# test standard Python subscr using viper types
@micropython.viper
def get(dest, i: int):
i += 1
return dest[i]
Reported by Pylint.
Line: 10
Column: 2
return dest[i]
@micropython.viper
def set(dest, i: int, val: int):
i += 1
dest[i] = val + 1
Reported by Pylint.
Line: 5
Column: 15
@micropython.viper
def get(dest, i: int):
i += 1
return dest[i]
@micropython.viper
Reported by Pylint.
Line: 11
Column: 15
@micropython.viper
def set(dest, i: int, val: int):
i += 1
dest[i] = val + 1
ar = [i for i in range(3)]
Reported by Pylint.
Line: 11
Column: 1
@micropython.viper
def set(dest, i: int, val: int):
i += 1
dest[i] = val + 1
ar = [i for i in range(3)]
Reported by Pylint.
Line: 1
Column: 1
# test standard Python subscr using viper types
@micropython.viper
def get(dest, i: int):
i += 1
return dest[i]
Reported by Pylint.
Line: 5
Column: 1
@micropython.viper
def get(dest, i: int):
i += 1
return dest[i]
@micropython.viper
Reported by Pylint.
Line: 11
Column: 1
@micropython.viper
def set(dest, i: int, val: int):
i += 1
dest[i] = val + 1
ar = [i for i in range(3)]
Reported by Pylint.
Line: 16
Column: 1
dest[i] = val + 1
ar = [i for i in range(3)]
for i in range(len(ar)):
set(ar, i - 1, i)
print(ar)
Reported by Pylint.
tests/basics/del_attr.py
9 issues
Line: 2
Column: 5
class C:
def f():
pass
# del a class attribute
del C.f
try:
print(C.x)
Reported by Pylint.
Line: 21
Column: 1
c = C()
c.x = 1
print(c.x)
del c.x
try:
print(c.x)
Reported by Pylint.
Line: 1
Column: 1
class C:
def f():
pass
# del a class attribute
del C.f
try:
print(C.x)
Reported by Pylint.
Line: 1
Column: 1
class C:
def f():
pass
# del a class attribute
del C.f
try:
print(C.x)
Reported by Pylint.
Line: 1
Column: 1
class C:
def f():
pass
# del a class attribute
del C.f
try:
print(C.x)
Reported by Pylint.
Line: 1
Column: 1
class C:
def f():
pass
# del a class attribute
del C.f
try:
print(C.x)
Reported by Pylint.
Line: 2
Column: 5
class C:
def f():
pass
# del a class attribute
del C.f
try:
print(C.x)
Reported by Pylint.
Line: 2
Column: 5
class C:
def f():
pass
# del a class attribute
del C.f
try:
print(C.x)
Reported by Pylint.
Line: 21
Column: 1
c = C()
c.x = 1
print(c.x)
del c.x
try:
print(c.x)
Reported by Pylint.
tests/basics/logic_constfolding.py
9 issues
Line: 12
Column: 12
return False
print(0 or False)
print(1 or foo)
print(f_false() or 1 or foo)
print(f_false() or 1 or f_true())
print(0 and foo)
print(1 and True)
Reported by Pylint.
Line: 13
Column: 25
print(0 or False)
print(1 or foo)
print(f_false() or 1 or foo)
print(f_false() or 1 or f_true())
print(0 and foo)
print(1 and True)
print(f_true() and 0 and foo)
Reported by Pylint.
Line: 16
Column: 13
print(f_false() or 1 or foo)
print(f_false() or 1 or f_true())
print(0 and foo)
print(1 and True)
print(f_true() and 0 and foo)
print(f_true() and 1 and f_false())
print(not 0)
Reported by Pylint.
Line: 18
Column: 26
print(0 and foo)
print(1 and True)
print(f_true() and 0 and foo)
print(f_true() and 1 and f_false())
print(not 0)
print(not False)
print(not 1)
Reported by Pylint.
Line: 1
Column: 1
# tests logical constant folding in parser
def f_true():
print('f_true')
return True
def f_false():
print('f_false')
return False
Reported by Pylint.
Line: 3
Column: 1
# tests logical constant folding in parser
def f_true():
print('f_true')
return True
def f_false():
print('f_false')
return False
Reported by Pylint.
Line: 7
Column: 1
print('f_true')
return True
def f_false():
print('f_false')
return False
print(0 or False)
print(1 or foo)
Reported by Pylint.
Line: 25
Column: 7
print(not False)
print(not 1)
print(not True)
print(not not 0)
print(not not 1)
Reported by Pylint.
Line: 26
Column: 7
print(not 1)
print(not True)
print(not not 0)
print(not not 1)
Reported by Pylint.
tests/thread/thread_exc1.py
9 issues
Line: 19
Column: 9
pass
with lock:
global n_finished
n_finished += 1
lock = _thread.allocate_lock()
n_thread = 4
n_finished = 0
Reported by Pylint.
Line: 18
Column: 9
except ValueError:
pass
with lock:
global n_finished
n_finished += 1
lock = _thread.allocate_lock()
n_thread = 4
Reported by Pylint.
Line: 1
Column: 1
# test raising and catching an exception within a thread
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
import _thread
def foo():
raise ValueError
Reported by Pylint.
Line: 8
Column: 1
import _thread
def foo():
raise ValueError
def thread_entry():
try:
Reported by Pylint.
Line: 8
Column: 1
import _thread
def foo():
raise ValueError
def thread_entry():
try:
Reported by Pylint.
Line: 12
Column: 1
raise ValueError
def thread_entry():
try:
foo()
except ValueError:
pass
with lock:
Reported by Pylint.
Line: 18
Column: 9
except ValueError:
pass
with lock:
global n_finished
n_finished += 1
lock = _thread.allocate_lock()
n_thread = 4
Reported by Pylint.
Line: 23
Column: 1
lock = _thread.allocate_lock()
n_thread = 4
n_finished = 0
# spawn threads
for i in range(n_thread):
while True:
Reported by Pylint.
Line: 24
Column: 1
lock = _thread.allocate_lock()
n_thread = 4
n_finished = 0
# spawn threads
for i in range(n_thread):
while True:
try:
Reported by Pylint.
tests/basics/closure2.py
9 issues
Line: 3
Column: 7
# closures; closing over an argument
def f(x):
y = 2 * x
def g(z):
return x + y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 4
Column: 5
# closures; closing over an argument
def f(x):
y = 2 * x
def g(z):
return x + y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 1
Column: 1
# closures; closing over an argument
def f(x):
y = 2 * x
def g(z):
return x + y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 3
Column: 1
# closures; closing over an argument
def f(x):
y = 2 * x
def g(z):
return x + y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 3
Column: 1
# closures; closing over an argument
def f(x):
y = 2 * x
def g(z):
return x + y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 3
Column: 1
# closures; closing over an argument
def f(x):
y = 2 * x
def g(z):
return x + y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 4
Column: 5
# closures; closing over an argument
def f(x):
y = 2 * x
def g(z):
return x + y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 5
Column: 5
def f(x):
y = 2 * x
def g(z):
return x + y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 5
Column: 5
def f(x):
y = 2 * x
def g(z):
return x + y + z
return g
print(f(1)(1))
Reported by Pylint.
tests/basics/closure1.py
9 issues
Line: 3
Column: 7
# closures
def f(x):
y = 2 * x
def g(z):
return y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 4
Column: 5
# closures
def f(x):
y = 2 * x
def g(z):
return y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 1
Column: 1
# closures
def f(x):
y = 2 * x
def g(z):
return y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 3
Column: 1
# closures
def f(x):
y = 2 * x
def g(z):
return y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 3
Column: 1
# closures
def f(x):
y = 2 * x
def g(z):
return y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 3
Column: 1
# closures
def f(x):
y = 2 * x
def g(z):
return y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 4
Column: 5
# closures
def f(x):
y = 2 * x
def g(z):
return y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 5
Column: 5
def f(x):
y = 2 * x
def g(z):
return y + z
return g
print(f(1)(1))
Reported by Pylint.
Line: 5
Column: 5
def f(x):
y = 2 * x
def g(z):
return y + z
return g
print(f(1)(1))
Reported by Pylint.
examples/ledangle.py
9 issues
Line: 6
Column: 10
def led_angle(seconds_to_run_for):
# make LED objects
l1 = pyb.LED(1)
l2 = pyb.LED(2)
accel = pyb.Accel()
for i in range(20 * seconds_to_run_for):
# get x-axis
Reported by Pylint.
Line: 7
Column: 10
def led_angle(seconds_to_run_for):
# make LED objects
l1 = pyb.LED(1)
l2 = pyb.LED(2)
accel = pyb.Accel()
for i in range(20 * seconds_to_run_for):
# get x-axis
x = accel.x()
Reported by Pylint.
Line: 8
Column: 13
# make LED objects
l1 = pyb.LED(1)
l2 = pyb.LED(2)
accel = pyb.Accel()
for i in range(20 * seconds_to_run_for):
# get x-axis
x = accel.x()
Reported by Pylint.
Line: 10
Column: 9
l2 = pyb.LED(2)
accel = pyb.Accel()
for i in range(20 * seconds_to_run_for):
# get x-axis
x = accel.x()
# turn on LEDs depending on angle
if x < -10:
Reported by Pylint.
Line: 1
Column: 1
import pyb
def led_angle(seconds_to_run_for):
# make LED objects
l1 = pyb.LED(1)
l2 = pyb.LED(2)
accel = pyb.Accel()
Reported by Pylint.
Line: 4
Column: 1
import pyb
def led_angle(seconds_to_run_for):
# make LED objects
l1 = pyb.LED(1)
l2 = pyb.LED(2)
accel = pyb.Accel()
Reported by Pylint.
Line: 6
Column: 5
def led_angle(seconds_to_run_for):
# make LED objects
l1 = pyb.LED(1)
l2 = pyb.LED(2)
accel = pyb.Accel()
for i in range(20 * seconds_to_run_for):
# get x-axis
Reported by Pylint.
Line: 7
Column: 5
def led_angle(seconds_to_run_for):
# make LED objects
l1 = pyb.LED(1)
l2 = pyb.LED(2)
accel = pyb.Accel()
for i in range(20 * seconds_to_run_for):
# get x-axis
x = accel.x()
Reported by Pylint.
Line: 12
Column: 9
for i in range(20 * seconds_to_run_for):
# get x-axis
x = accel.x()
# turn on LEDs depending on angle
if x < -10:
l1.on()
l2.off()
Reported by Pylint.