The following issues were found
tests/basics/floordivide_intbig.py
5 issues
Line: 1
Column: 1
# check modulo matches python definition
a = 987654321987987987987987987987
b = 19
print(a // b)
print(a // -b)
print(-a // b)
print(-a // -b)
Reported by Pylint.
Line: 3
Column: 1
# check modulo matches python definition
a = 987654321987987987987987987987
b = 19
print(a // b)
print(a // -b)
print(-a // b)
print(-a // -b)
Reported by Pylint.
Line: 4
Column: 1
# check modulo matches python definition
a = 987654321987987987987987987987
b = 19
print(a // b)
print(a // -b)
print(-a // b)
print(-a // -b)
Reported by Pylint.
Line: 10
Column: 1
print(a // -b)
print(-a // b)
print(-a // -b)
a = 10000000000000000000000000000000000000000000
b = 100
print(a // b)
print(a // -b)
print(-a // b)
print(-a // -b)
Reported by Pylint.
Line: 11
Column: 1
print(-a // b)
print(-a // -b)
a = 10000000000000000000000000000000000000000000
b = 100
print(a // b)
print(a // -b)
print(-a // b)
print(-a // -b)
Reported by Pylint.
tests/basics/errno1.py
5 issues
Line: 7
Column: 5
import uerrno
except ImportError:
print("SKIP")
raise SystemExit
# check that constants exist and are integers
print(type(uerrno.EIO))
# check that errors are rendered in a nice way
Reported by Pylint.
Line: 1
Column: 1
# test errno's and uerrno module
try:
import uerrno
except ImportError:
print("SKIP")
raise SystemExit
# check that constants exist and are integers
Reported by Pylint.
Line: 13
Column: 1
print(type(uerrno.EIO))
# check that errors are rendered in a nice way
msg = str(OSError(uerrno.EIO))
print(msg[:7], msg[-5:])
msg = str(OSError(uerrno.EIO, "details"))
print(msg[:7], msg[-14:])
msg = str(OSError(uerrno.EIO, "details", "more details"))
print(msg[:1], msg[-28:])
Reported by Pylint.
Line: 15
Column: 1
# check that errors are rendered in a nice way
msg = str(OSError(uerrno.EIO))
print(msg[:7], msg[-5:])
msg = str(OSError(uerrno.EIO, "details"))
print(msg[:7], msg[-14:])
msg = str(OSError(uerrno.EIO, "details", "more details"))
print(msg[:1], msg[-28:])
# check that unknown errno is still rendered
Reported by Pylint.
Line: 17
Column: 1
print(msg[:7], msg[-5:])
msg = str(OSError(uerrno.EIO, "details"))
print(msg[:7], msg[-14:])
msg = str(OSError(uerrno.EIO, "details", "more details"))
print(msg[:1], msg[-28:])
# check that unknown errno is still rendered
print(str(OSError(9999)))
Reported by Pylint.
tests/micropython/viper_binop_comp_imm.py
5 issues
Line: 2
Column: 2
# comparisons with immediate boundary values
@micropython.viper
def f(a: int):
print(a == -1, a == -255, a == -256, a == -257)
f(-1)
f(-255)
f(-256)
Reported by Pylint.
Line: 1
Column: 1
# comparisons with immediate boundary values
@micropython.viper
def f(a: int):
print(a == -1, a == -255, a == -256, a == -257)
f(-1)
f(-255)
f(-256)
Reported by Pylint.
Line: 3
Column: 1
# comparisons with immediate boundary values
@micropython.viper
def f(a: int):
print(a == -1, a == -255, a == -256, a == -257)
f(-1)
f(-255)
f(-256)
Reported by Pylint.
Line: 3
Column: 1
# comparisons with immediate boundary values
@micropython.viper
def f(a: int):
print(a == -1, a == -255, a == -256, a == -257)
f(-1)
f(-255)
f(-256)
Reported by Pylint.
Line: 3
Column: 1
# comparisons with immediate boundary values
@micropython.viper
def f(a: int):
print(a == -1, a == -255, a == -256, a == -257)
f(-1)
f(-255)
f(-256)
Reported by Pylint.
tests/basics/deque2.py
5 issues
Line: 10
Column: 5
from collections import deque
except ImportError:
print("SKIP")
raise SystemExit
# Initial sequence is not supported
try:
deque([1, 2, 3], 10)
Reported by Pylint.
Line: 1
Column: 1
# Tests for deques with "check overflow" flag and other extensions
# wrt to CPython.
try:
try:
from ucollections import deque
except ImportError:
from collections import deque
except ImportError:
print("SKIP")
Reported by Pylint.
Line: 49
Column: 1
print(d.popleft(), d.popleft())
try:
d.popleft()
except IndexError as e:
print(repr(e))
d.append(5)
d.append(6)
print(len(d))
Reported by Pylint.
Line: 57
Column: 1
print(len(d))
try:
d.append(7)
except IndexError as e:
print(repr(e))
print(len(d))
print(d.popleft(), d.popleft())
print(len(d))
Reported by Pylint.
Line: 65
Column: 1
print(len(d))
try:
d.popleft()
except IndexError as e:
print(repr(e))
Reported by Pylint.
examples/accellog.py
5 issues
Line: 5
Column: 9
import pyb
accel = pyb.Accel() # create object of accelerometer
blue = pyb.LED(4) # create object of blue LED
# open file to write data - /sd/ is the SD-card, /flash/ the internal memory
log = open("/sd/log.csv", "w")
Reported by Pylint.
Line: 6
Column: 8
import pyb
accel = pyb.Accel() # create object of accelerometer
blue = pyb.LED(4) # create object of blue LED
# open file to write data - /sd/ is the SD-card, /flash/ the internal memory
log = open("/sd/log.csv", "w")
blue.on() # turn on blue LED
Reported by Pylint.
Line: 15
Column: 9
# do 100 times (if the board is connected via USB, you can't write longer because the PC tries to open the filesystem which messes up your file.)
for i in range(100):
t = pyb.millis() # get time since reset
x, y, z = accel.filtered_xyz() # get acceleration data
log.write("{},{},{},{}\n".format(t, x, y, z)) # write data to file
log.close() # close file
blue.off() # turn off LED
Reported by Pylint.
Line: 1
Column: 1
# log the accelerometer values to a .csv-file on the SD-card
import pyb
accel = pyb.Accel() # create object of accelerometer
blue = pyb.LED(4) # create object of blue LED
# open file to write data - /sd/ is the SD-card, /flash/ the internal memory
log = open("/sd/log.csv", "w")
Reported by Pylint.
Line: 13
Column: 1
blue.on() # turn on blue LED
# do 100 times (if the board is connected via USB, you can't write longer because the PC tries to open the filesystem which messes up your file.)
for i in range(100):
t = pyb.millis() # get time since reset
x, y, z = accel.filtered_xyz() # get acceleration data
log.write("{},{},{},{}\n".format(t, x, y, z)) # write data to file
Reported by Pylint.
tests/micropython/opt_level_lineno.py
5 issues
Line: 1
Column: 1
import micropython as micropython
# check that level 3 doesn't store line numbers
# the expected output is that any line is printed as "line 1"
micropython.opt_level(3)
exec("try:\n xyz\nexcept NameError as er:\n import usys\n usys.print_exception(er)")
Reported by Pylint.
Line: 6
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html
# check that level 3 doesn't store line numbers
# the expected output is that any line is printed as "line 1"
micropython.opt_level(3)
exec("try:\n xyz\nexcept NameError as er:\n import usys\n usys.print_exception(er)")
Reported by Bandit.
Line: 6
Column: 1
# check that level 3 doesn't store line numbers
# the expected output is that any line is printed as "line 1"
micropython.opt_level(3)
exec("try:\n xyz\nexcept NameError as er:\n import usys\n usys.print_exception(er)")
Reported by Pylint.
Line: 1
Column: 1
import micropython as micropython
# check that level 3 doesn't store line numbers
# the expected output is that any line is printed as "line 1"
micropython.opt_level(3)
exec("try:\n xyz\nexcept NameError as er:\n import usys\n usys.print_exception(er)")
Reported by Pylint.
Line: 1
Column: 1
import micropython as micropython
# check that level 3 doesn't store line numbers
# the expected output is that any line is printed as "line 1"
micropython.opt_level(3)
exec("try:\n xyz\nexcept NameError as er:\n import usys\n usys.print_exception(er)")
Reported by Pylint.
ports/teensy/memzip_files/boot.py
5 issues
Line: 1
Column: 1
import pyb
print("Executing boot.py")
def pins():
for pin_name in dir(pyb.Pin.board):
pin = pyb.Pin(pin_name)
print("{:10s} {:s}".format(pin_name, str(pin)))
Reported by Pylint.
Line: 1
Column: 1
import pyb
print("Executing boot.py")
def pins():
for pin_name in dir(pyb.Pin.board):
pin = pyb.Pin(pin_name)
print("{:10s} {:s}".format(pin_name, str(pin)))
Reported by Pylint.
Line: 6
Column: 1
print("Executing boot.py")
def pins():
for pin_name in dir(pyb.Pin.board):
pin = pyb.Pin(pin_name)
print("{:10s} {:s}".format(pin_name, str(pin)))
Reported by Pylint.
Line: 12
Column: 1
print("{:10s} {:s}".format(pin_name, str(pin)))
def af():
for pin_name in dir(pyb.Pin.board):
pin = pyb.Pin(pin_name)
print("{:10s} {:s}".format(pin_name, str(pin.af_list())))
Reported by Pylint.
Line: 12
Column: 1
print("{:10s} {:s}".format(pin_name, str(pin)))
def af():
for pin_name in dir(pyb.Pin.board):
pin = pyb.Pin(pin_name)
print("{:10s} {:s}".format(pin_name, str(pin.af_list())))
Reported by Pylint.
tests/basics/class_store.py
5 issues
Line: 1
Column: 1
# store to class vs instance
class C:
pass
c = C()
c.x = 1
print(c.x)
C.x = 2
Reported by Pylint.
Line: 3
Column: 1
# store to class vs instance
class C:
pass
c = C()
c.x = 1
print(c.x)
C.x = 2
Reported by Pylint.
Line: 3
Column: 1
# store to class vs instance
class C:
pass
c = C()
c.x = 1
print(c.x)
C.x = 2
Reported by Pylint.
Line: 3
Column: 1
# store to class vs instance
class C:
pass
c = C()
c.x = 1
print(c.x)
C.x = 2
Reported by Pylint.
Line: 7
Column: 1
pass
c = C()
c.x = 1
print(c.x)
C.x = 2
C.y = 3
print(c.x, c.y)
print(C.x, C.y)
Reported by Pylint.
tests/basics/class_number.py
5 issues
Line: 14
Column: 1
print(self.value, '-', rhs)
c = C(0)
c + 1
c - 2
Reported by Pylint.
Line: 15
Column: 1
c = C(0)
c + 1
c - 2
Reported by Pylint.
Line: 1
Column: 1
# test class with __add__ and __sub__ methods
class C:
def __init__(self, value):
self.value = value
def __add__(self, rhs):
print(self.value, '+', rhs)
Reported by Pylint.
Line: 3
Column: 1
# test class with __add__ and __sub__ methods
class C:
def __init__(self, value):
self.value = value
def __add__(self, rhs):
print(self.value, '+', rhs)
Reported by Pylint.
Line: 3
Column: 1
# test class with __add__ and __sub__ methods
class C:
def __init__(self, value):
self.value = value
def __add__(self, rhs):
print(self.value, '+', rhs)
Reported by Pylint.
tests/float/types.py
5 issues
Line: 1
Column: 1
# float types
print(float)
print(complex)
print(type(float()) == float)
print(type(complex()) == complex)
print(type(0.0) == float)
Reported by Pylint.
Line: 6
Column: 7
print(float)
print(complex)
print(type(float()) == float)
print(type(complex()) == complex)
print(type(0.0) == float)
print(type(1j) == complex)
Reported by Pylint.
Line: 7
Column: 7
print(complex)
print(type(float()) == float)
print(type(complex()) == complex)
print(type(0.0) == float)
print(type(1j) == complex)
# hashing float types
Reported by Pylint.
Line: 9
Column: 7
print(type(float()) == float)
print(type(complex()) == complex)
print(type(0.0) == float)
print(type(1j) == complex)
# hashing float types
d = dict()
Reported by Pylint.
Line: 10
Column: 7
print(type(complex()) == complex)
print(type(0.0) == float)
print(type(1j) == complex)
# hashing float types
d = dict()
d[float] = complex
Reported by Pylint.