The following issues were found
tests/basics/string_format_modulo_int.py
5 issues
Line: 14
Column: 7
print("%+d" % 10)
print("% d" % 10)
print("%d" % -10)
print("%d" % True)
print("%i" % -10)
print("%i" % True)
print("%u" % -10)
print("%u" % True)
print("%x" % 18)
Reported by Pylint.
Line: 16
Column: 7
print("%d" % -10)
print("%d" % True)
print("%i" % -10)
print("%i" % True)
print("%u" % -10)
print("%u" % True)
print("%x" % 18)
print("%o" % 18)
print("%X" % 18)
Reported by Pylint.
Line: 18
Column: 7
print("%i" % -10)
print("%i" % True)
print("%u" % -10)
print("%u" % True)
print("%x" % 18)
print("%o" % 18)
print("%X" % 18)
print("%#x" % 18)
print("%#X" % 18)
Reported by Pylint.
Line: 7
Column: 5
'' % ()
except TypeError:
print("SKIP")
raise SystemExit
# basic cases
print("%d" % 10)
print("%+d" % 10)
print("% d" % 10)
Reported by Pylint.
Line: 1
Column: 1
# test string modulo formatting with int values
try:
'' % ()
except TypeError:
print("SKIP")
raise SystemExit
# basic cases
Reported by Pylint.
tests/cpydiff/core_import_prereg.py
5 issues
Line: 7
Column: 1
cause: To make module handling more efficient, it's not wrapped with exception handling.
workaround: Test modules before production use; during development, use ``del sys.modules["name"]``, or just soft or hard reset the board.
"""
import sys
try:
from modules import foo
except NameError as e:
print(e)
Reported by Pylint.
Line: 10
Column: 5
import sys
try:
from modules import foo
except NameError as e:
print(e)
try:
from modules import foo
Reported by Pylint.
Line: 5
Column: 1
categories: Core,import
description: Failed to load modules are still registered as loaded
cause: To make module handling more efficient, it's not wrapped with exception handling.
workaround: Test modules before production use; during development, use ``del sys.modules["name"]``, or just soft or hard reset the board.
"""
import sys
try:
from modules import foo
Reported by Pylint.
Line: 11
Column: 1
try:
from modules import foo
except NameError as e:
print(e)
try:
from modules import foo
print("Should not get here")
Reported by Pylint.
Line: 17
Column: 1
from modules import foo
print("Should not get here")
except NameError as e:
print(e)
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/float/complex_special_methods.py
5 issues
Line: 1
Column: 1
# test complex interacting with special methods
class A:
def __add__(self, x):
print("__add__")
return 1
Reported by Pylint.
Line: 4
Column: 1
# test complex interacting with special methods
class A:
def __add__(self, x):
print("__add__")
return 1
Reported by Pylint.
Line: 4
Column: 1
# test complex interacting with special methods
class A:
def __add__(self, x):
print("__add__")
return 1
Reported by Pylint.
Line: 4
Column: 1
# test complex interacting with special methods
class A:
def __add__(self, x):
print("__add__")
return 1
Reported by Pylint.
Line: 5
Column: 5
class A:
def __add__(self, x):
print("__add__")
return 1
print(A() + 1j)
Reported by Pylint.
tests/float/complex_reverse_op.py
5 issues
Line: 1
Column: 1
# test complex interacting with special reverse methods
class A:
def __radd__(self, x):
print("__radd__")
return 2
Reported by Pylint.
Line: 4
Column: 1
# test complex interacting with special reverse methods
class A:
def __radd__(self, x):
print("__radd__")
return 2
Reported by Pylint.
Line: 4
Column: 1
# test complex interacting with special reverse methods
class A:
def __radd__(self, x):
print("__radd__")
return 2
Reported by Pylint.
Line: 4
Column: 1
# test complex interacting with special reverse methods
class A:
def __radd__(self, x):
print("__radd__")
return 2
Reported by Pylint.
Line: 5
Column: 5
class A:
def __radd__(self, x):
print("__radd__")
return 2
print(1j + A())
Reported by Pylint.
tests/extmod/uasyncio_await_return.py
5 issues
Line: 10
Column: 9
import asyncio
except ImportError:
print("SKIP")
raise SystemExit
async def foo():
return 42
Reported by Pylint.
Line: 1
Column: 1
# Test that tasks return their value correctly to the caller
try:
import uasyncio as asyncio
except ImportError:
try:
import asyncio
except ImportError:
print("SKIP")
Reported by Pylint.
Line: 13
Column: 1
raise SystemExit
async def foo():
return 42
async def main():
# Call function directly via an await
Reported by Pylint.
Line: 13
Column: 1
raise SystemExit
async def foo():
return 42
async def main():
# Call function directly via an await
Reported by Pylint.
Line: 17
Column: 1
return 42
async def main():
# Call function directly via an await
print(await foo())
# Create a task and await on it
task = asyncio.create_task(foo())
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.
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/basics/struct1_intbig.py
5 issues
Line: 2
Column: 5
try:
import ustruct as struct
except:
try:
import struct
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 3
Column: 1
try:
import ustruct as struct
except:
try:
import struct
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 8
Column: 9
import struct
except ImportError:
print("SKIP")
raise SystemExit
# check maximum pack on 32-bit machine
print(struct.pack("<I", 2**32 - 1))
print(struct.pack("<I", 0xffffffff))
Reported by Pylint.
Line: 1
Column: 1
try:
import ustruct as struct
except:
try:
import struct
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 41
Column: 1
print(struct.unpack("<q", b'\xff\xff\xff\xff\xff\xff\xff\x7f'))
# test with negative big integers that are actually small in magnitude
bigzero = (1 << 70) - (1 << 70)
for endian in "<>":
for type_ in "bhiq":
fmt = endian + type_
b = struct.pack(fmt, -2 + bigzero)
print(fmt, b, struct.unpack(fmt, b))
Reported by Pylint.
tests/basics/struct_endian.py
5 issues
Line: 4
Column: 5
# test ustruct and endian specific things
try:
import ustruct as struct
except:
try:
import struct
except ImportError:
print("SKIP")
Reported by Pylint.
Line: 5
Column: 1
try:
import ustruct as struct
except:
try:
import struct
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 10
Column: 9
import struct
except ImportError:
print("SKIP")
raise SystemExit
# unpack/unpack_from with unaligned native type
buf = b'0123456789'
print(struct.unpack('h', memoryview(buf)[1:3]))
print(struct.unpack_from('i', buf, 1))
Reported by Pylint.
Line: 1
Column: 1
# test ustruct and endian specific things
try:
import ustruct as struct
except:
try:
import struct
except ImportError:
print("SKIP")
Reported by Pylint.
Line: 13
Column: 1
raise SystemExit
# unpack/unpack_from with unaligned native type
buf = b'0123456789'
print(struct.unpack('h', memoryview(buf)[1:3]))
print(struct.unpack_from('i', buf, 1))
print(struct.unpack_from('@i', buf, 1))
print(struct.unpack_from('@ii', buf, 1))
Reported by Pylint.