The following issues were found
tests/micropython/const.py
7 issues
Line: 3
Column: 1
# test constant optimisation
from micropython import const
X = const(123)
Y = const(X + 456)
print(X, Y + 1)
Reported by Pylint.
Line: 1
Column: 1
# test constant optimisation
from micropython import const
X = const(123)
Y = const(X + 456)
print(X, Y + 1)
Reported by Pylint.
Line: 11
Column: 1
print(X, Y + 1)
def f():
print(X, Y + 1)
f()
Reported by Pylint.
Line: 11
Column: 1
print(X, Y + 1)
def f():
print(X, Y + 1)
f()
Reported by Pylint.
Line: 23
Column: 1
print(_X, _Y)
class A:
Z = const(1)
_Z = const(2)
print(Z, _Z)
Reported by Pylint.
Line: 23
Column: 1
print(_X, _Y)
class A:
Z = const(1)
_Z = const(2)
print(Z, _Z)
Reported by Pylint.
Line: 23
Column: 1
print(_X, _Y)
class A:
Z = const(1)
_Z = const(2)
print(Z, _Z)
Reported by Pylint.
tests/thread/thread_ident1.py
7 issues
Line: 11
Column: 5
def thread_entry():
tid = _thread.get_ident()
print("thread", type(tid) == int, tid != 0, tid != tid_main)
global finished
finished = True
tid_main = _thread.get_ident()
print("main", type(tid_main) == int, tid_main != 0)
Reported by Pylint.
Line: 1
Column: 1
# test _thread.get_ident() function
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
import _thread
def thread_entry():
tid = _thread.get_ident()
Reported by Pylint.
Line: 8
Column: 1
import _thread
def thread_entry():
tid = _thread.get_ident()
print("thread", type(tid) == int, tid != 0, tid != tid_main)
global finished
finished = True
Reported by Pylint.
Line: 10
Column: 21
def thread_entry():
tid = _thread.get_ident()
print("thread", type(tid) == int, tid != 0, tid != tid_main)
global finished
finished = True
tid_main = _thread.get_ident()
Reported by Pylint.
Line: 11
Column: 5
def thread_entry():
tid = _thread.get_ident()
print("thread", type(tid) == int, tid != 0, tid != tid_main)
global finished
finished = True
tid_main = _thread.get_ident()
print("main", type(tid_main) == int, tid_main != 0)
Reported by Pylint.
Line: 16
Column: 15
tid_main = _thread.get_ident()
print("main", type(tid_main) == int, tid_main != 0)
finished = False
_thread.start_new_thread(thread_entry, ())
while not finished:
Reported by Pylint.
Line: 18
Column: 1
tid_main = _thread.get_ident()
print("main", type(tid_main) == int, tid_main != 0)
finished = False
_thread.start_new_thread(thread_entry, ())
while not finished:
pass
print("done")
Reported by Pylint.
tests/internal_bench/var-6.1-instance-attr-5.py
7 issues
Line: 13
Column: 10
self.num = 20000000
def test(num):
o = Foo()
i = 0
while i < o.num:
i += 1
Reported by Pylint.
Line: 1
Column: 1
import bench
class Foo:
def __init__(self):
self.num1 = 0
self.num2 = 0
self.num3 = 0
self.num4 = 0
Reported by Pylint.
Line: 1
Column: 1
import bench
class Foo:
def __init__(self):
self.num1 = 0
self.num2 = 0
self.num3 = 0
self.num4 = 0
Reported by Pylint.
Line: 4
Column: 1
import bench
class Foo:
def __init__(self):
self.num1 = 0
self.num2 = 0
self.num3 = 0
self.num4 = 0
Reported by Pylint.
Line: 4
Column: 1
import bench
class Foo:
def __init__(self):
self.num1 = 0
self.num2 = 0
self.num3 = 0
self.num4 = 0
Reported by Pylint.
Line: 13
Column: 1
self.num = 20000000
def test(num):
o = Foo()
i = 0
while i < o.num:
i += 1
Reported by Pylint.
Line: 14
Column: 5
def test(num):
o = Foo()
i = 0
while i < o.num:
i += 1
Reported by Pylint.
tests/basics/memoryview_gc.py
7 issues
Line: 6
Column: 5
memoryview
except:
print("SKIP")
raise SystemExit
b = bytearray(10)
m = memoryview(b)[1:]
for i in range(len(m)):
m[i] = i
Reported by Pylint.
Line: 20
Column: 5
# allocate lots of memory
for i in range(100000):
[42, 42, 42, 42]
# check that the memoryview is still what we want
print(list(m))
# check that creating a memoryview of a memoryview retains the underlying data
Reported by Pylint.
Line: 1
Column: 1
# test memoryview retains pointer to original object/buffer
try:
memoryview
except:
print("SKIP")
raise SystemExit
b = bytearray(10)
m = memoryview(b)[1:]
Reported by Pylint.
Line: 10
Column: 1
b = bytearray(10)
m = memoryview(b)[1:]
for i in range(len(m)):
m[i] = i
# reclaim b, but hopefully not the buffer
b = None
import gc
Reported by Pylint.
Line: 14
Column: 1
m[i] = i
# reclaim b, but hopefully not the buffer
b = None
import gc
gc.collect()
# allocate lots of memory
for i in range(100000):
Reported by Pylint.
Line: 15
Column: 1
# reclaim b, but hopefully not the buffer
b = None
import gc
gc.collect()
# allocate lots of memory
for i in range(100000):
[42, 42, 42, 42]
Reported by Pylint.
Line: 26
Column: 1
print(list(m))
# check that creating a memoryview of a memoryview retains the underlying data
m = None
gc.collect() # cleanup from previous test
m = memoryview(memoryview(bytearray(i for i in range(50)))[5:-5])
print(sum(m), list(m[:10]))
gc.collect()
for i in range(10):
Reported by Pylint.
tests/extmod/uasyncio_cancel_self.py
7 issues
Line: 10
Column: 9
import asyncio
except ImportError:
print("SKIP")
raise SystemExit
async def task():
print("task start")
global_task.cancel()
Reported by Pylint.
Line: 19
Column: 5
async def main():
global global_task
global_task = asyncio.create_task(task())
try:
await global_task
except asyncio.CancelledError:
print("main cancel")
Reported by Pylint.
Line: 1
Column: 1
# Test a task cancelling itself (currently unsupported)
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 task():
print("task start")
global_task.cancel()
async def main():
Reported by Pylint.
Line: 18
Column: 1
global_task.cancel()
async def main():
global global_task
global_task = asyncio.create_task(task())
try:
await global_task
except asyncio.CancelledError:
Reported by Pylint.
Line: 19
Column: 5
async def main():
global global_task
global_task = asyncio.create_task(task())
try:
await global_task
except asyncio.CancelledError:
print("main cancel")
Reported by Pylint.
Line: 30
Column: 1
try:
asyncio.run(main())
except RuntimeError as er:
print(er)
Reported by Pylint.
ports/nrf/examples/nrf52_pwm.py
7 issues
Line: 2
Column: 1
import time
from machine import PWM, Pin
def pulse():
for i in range(0, 101):
p = PWM(0, Pin("P17", mode=Pin.OUT), freq=PWM.FREQ_16MHZ, duty=i, period=16000)
p.init()
time.sleep_ms(10)
Reported by Pylint.
Line: 9
Column: 9
for i in range(0, 101):
p = PWM(0, Pin("P17", mode=Pin.OUT), freq=PWM.FREQ_16MHZ, duty=i, period=16000)
p.init()
time.sleep_ms(10)
p.deinit()
for i in range(0, 101):
p = PWM(0, Pin("P17", mode=Pin.OUT), freq=PWM.FREQ_16MHZ, duty=100 - i, period=16000)
p.init()
Reported by Pylint.
Line: 15
Column: 9
for i in range(0, 101):
p = PWM(0, Pin("P17", mode=Pin.OUT), freq=PWM.FREQ_16MHZ, duty=100 - i, period=16000)
p.init()
time.sleep_ms(10)
p.deinit()
Reported by Pylint.
Line: 1
Column: 1
import time
from machine import PWM, Pin
def pulse():
for i in range(0, 101):
p = PWM(0, Pin("P17", mode=Pin.OUT), freq=PWM.FREQ_16MHZ, duty=i, period=16000)
p.init()
time.sleep_ms(10)
Reported by Pylint.
Line: 5
Column: 1
from machine import PWM, Pin
def pulse():
for i in range(0, 101):
p = PWM(0, Pin("P17", mode=Pin.OUT), freq=PWM.FREQ_16MHZ, duty=i, period=16000)
p.init()
time.sleep_ms(10)
p.deinit()
Reported by Pylint.
Line: 7
Column: 9
def pulse():
for i in range(0, 101):
p = PWM(0, Pin("P17", mode=Pin.OUT), freq=PWM.FREQ_16MHZ, duty=i, period=16000)
p.init()
time.sleep_ms(10)
p.deinit()
for i in range(0, 101):
Reported by Pylint.
Line: 13
Column: 9
p.deinit()
for i in range(0, 101):
p = PWM(0, Pin("P17", mode=Pin.OUT), freq=PWM.FREQ_16MHZ, duty=100 - i, period=16000)
p.init()
time.sleep_ms(10)
p.deinit()
Reported by Pylint.
tests/basics/builtin_locals.py
7 issues
Line: 1
Column: 1
# test builtin locals()
x = 123
print(locals()['x'])
class A:
y = 1
def f(self):
pass
Reported by Pylint.
Line: 3
Column: 1
# test builtin locals()
x = 123
print(locals()['x'])
class A:
y = 1
def f(self):
pass
Reported by Pylint.
Line: 6
Column: 1
x = 123
print(locals()['x'])
class A:
y = 1
def f(self):
pass
print('x' in locals())
Reported by Pylint.
Line: 6
Column: 1
x = 123
print(locals()['x'])
class A:
y = 1
def f(self):
pass
print('x' in locals())
Reported by Pylint.
Line: 6
Column: 1
x = 123
print(locals()['x'])
class A:
y = 1
def f(self):
pass
print('x' in locals())
Reported by Pylint.
Line: 8
Column: 5
class A:
y = 1
def f(self):
pass
print('x' in locals())
print(locals()['y'])
print('f' in locals())
Reported by Pylint.
Line: 8
Column: 5
class A:
y = 1
def f(self):
pass
print('x' in locals())
print(locals()['y'])
print('f' in locals())
Reported by Pylint.
tests/thread/stress_recurse.py
7 issues
Line: 17
Column: 5
foo()
except RuntimeError:
print("RuntimeError")
global finished
finished = True
finished = False
Reported by Pylint.
Line: 1
Column: 1
# test hitting the function recursion limit within a thread
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
import _thread
def foo():
foo()
Reported by Pylint.
Line: 8
Column: 1
import _thread
def foo():
foo()
def thread_entry():
try:
Reported by Pylint.
Line: 8
Column: 1
import _thread
def foo():
foo()
def thread_entry():
try:
Reported by Pylint.
Line: 12
Column: 1
foo()
def thread_entry():
try:
foo()
except RuntimeError:
print("RuntimeError")
global finished
Reported by Pylint.
Line: 17
Column: 5
foo()
except RuntimeError:
print("RuntimeError")
global finished
finished = True
finished = False
Reported by Pylint.
Line: 21
Column: 1
finished = True
finished = False
_thread.start_new_thread(thread_entry, ())
# busy wait for thread to finish
while not finished:
Reported by Pylint.
tests/extmod/framebuf8.py
7 issues
Line: 5
Column: 5
import framebuf
except ImportError:
print("SKIP")
raise SystemExit
def printbuf():
print("--8<--")
for y in range(h):
Reported by Pylint.
Line: 1
Column: 1
try:
import framebuf
except ImportError:
print("SKIP")
raise SystemExit
def printbuf():
print("--8<--")
Reported by Pylint.
Line: 8
Column: 1
raise SystemExit
def printbuf():
print("--8<--")
for y in range(h):
for x in range(w):
print("%02x" % buf[(x + y * w)], end="")
print()
Reported by Pylint.
Line: 10
Column: 9
def printbuf():
print("--8<--")
for y in range(h):
for x in range(w):
print("%02x" % buf[(x + y * w)], end="")
print()
print("-->8--")
Reported by Pylint.
Line: 11
Column: 13
def printbuf():
print("--8<--")
for y in range(h):
for x in range(w):
print("%02x" % buf[(x + y * w)], end="")
print()
print("-->8--")
Reported by Pylint.
Line: 17
Column: 1
print("-->8--")
w = 8
h = 5
buf = bytearray(w * h)
fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS8)
# fill
Reported by Pylint.
Line: 18
Column: 1
w = 8
h = 5
buf = bytearray(w * h)
fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS8)
# fill
fbuf.fill(0x55)
Reported by Pylint.
tests/internal_bench/var-6-instance-attr.py
7 issues
Line: 9
Column: 10
self.num = 20000000
def test(num):
o = Foo()
i = 0
while i < o.num:
i += 1
Reported by Pylint.
Line: 1
Column: 1
import bench
class Foo:
def __init__(self):
self.num = 20000000
def test(num):
Reported by Pylint.
Line: 1
Column: 1
import bench
class Foo:
def __init__(self):
self.num = 20000000
def test(num):
Reported by Pylint.
Line: 4
Column: 1
import bench
class Foo:
def __init__(self):
self.num = 20000000
def test(num):
Reported by Pylint.
Line: 4
Column: 1
import bench
class Foo:
def __init__(self):
self.num = 20000000
def test(num):
Reported by Pylint.
Line: 9
Column: 1
self.num = 20000000
def test(num):
o = Foo()
i = 0
while i < o.num:
i += 1
Reported by Pylint.
Line: 10
Column: 5
def test(num):
o = Foo()
i = 0
while i < o.num:
i += 1
Reported by Pylint.