The following issues were found
tests/basics/del_deref.py
7 issues
Line: 1
Column: 1
def f():
x = 1
y = 2
def g():
nonlocal x
print(y)
try:
print(x)
except NameError:
Reported by Pylint.
Line: 1
Column: 1
def f():
x = 1
y = 2
def g():
nonlocal x
print(y)
try:
print(x)
except NameError:
Reported by Pylint.
Line: 1
Column: 1
def f():
x = 1
y = 2
def g():
nonlocal x
print(y)
try:
print(x)
except NameError:
Reported by Pylint.
Line: 2
Column: 5
def f():
x = 1
y = 2
def g():
nonlocal x
print(y)
try:
print(x)
except NameError:
Reported by Pylint.
Line: 3
Column: 5
def f():
x = 1
y = 2
def g():
nonlocal x
print(y)
try:
print(x)
except NameError:
Reported by Pylint.
Line: 4
Column: 5
def f():
x = 1
y = 2
def g():
nonlocal x
print(y)
try:
print(x)
except NameError:
Reported by Pylint.
Line: 11
Column: 5
print(x)
except NameError:
print("NameError")
def h():
nonlocal x
print(y)
try:
del x
except NameError:
Reported by Pylint.
tests/basics/comprehension1.py
7 issues
Line: 1
Column: 1
def f():
# list comprehension
print([a + 1 for a in range(5)])
print([(a, b) for a in range(3) for b in range(2)])
print([a * 2 for a in range(7) if a > 3])
print([a for a in [1, 3, 5]])
print([a for a in [a for a in range(4)]])
Reported by Pylint.
Line: 1
Column: 1
def f():
# list comprehension
print([a + 1 for a in range(5)])
print([(a, b) for a in range(3) for b in range(2)])
print([a * 2 for a in range(7) if a > 3])
print([a for a in [1, 3, 5]])
print([a for a in [a for a in range(4)]])
Reported by Pylint.
Line: 1
Column: 1
def f():
# list comprehension
print([a + 1 for a in range(5)])
print([(a, b) for a in range(3) for b in range(2)])
print([a * 2 for a in range(7) if a > 3])
print([a for a in [1, 3, 5]])
print([a for a in [a for a in range(4)]])
Reported by Pylint.
Line: 8
Column: 1
print([(a, b) for a in range(3) for b in range(2)])
print([a * 2 for a in range(7) if a > 3])
print([a for a in [1, 3, 5]])
print([a for a in [a for a in range(4)]])
# dict comprehension
d = {a : 2 * a for a in range(5)}
Reported by Pylint.
Line: 9
Column: 1
print([a * 2 for a in range(7) if a > 3])
print([a for a in [1, 3, 5]])
print([a for a in [a for a in range(4)]])
# dict comprehension
d = {a : 2 * a for a in range(5)}
print(d[0], d[1], d[2], d[3], d[4])
Reported by Pylint.
Line: 9
Column: 1
print([a * 2 for a in range(7) if a > 3])
print([a for a in [1, 3, 5]])
print([a for a in [a for a in range(4)]])
# dict comprehension
d = {a : 2 * a for a in range(5)}
print(d[0], d[1], d[2], d[3], d[4])
Reported by Pylint.
Line: 13
Column: 5
# dict comprehension
d = {a : 2 * a for a in range(5)}
print(d[0], d[1], d[2], d[3], d[4])
# set comprehension
# see set_comprehension.py
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/basics/closure_defargs.py
7 issues
Line: 1
Column: 1
# test closure with default args
def f():
a = 1
def bar(b = 10, c = 20):
print(a + b + c)
bar()
bar(2)
bar(2, 3)
Reported by Pylint.
Line: 3
Column: 1
# test closure with default args
def f():
a = 1
def bar(b = 10, c = 20):
print(a + b + c)
bar()
bar(2)
bar(2, 3)
Reported by Pylint.
Line: 3
Column: 1
# test closure with default args
def f():
a = 1
def bar(b = 10, c = 20):
print(a + b + c)
bar()
bar(2)
bar(2, 3)
Reported by Pylint.
Line: 4
Column: 5
# test closure with default args
def f():
a = 1
def bar(b = 10, c = 20):
print(a + b + c)
bar()
bar(2)
bar(2, 3)
Reported by Pylint.
Line: 5
Column: 5
def f():
a = 1
def bar(b = 10, c = 20):
print(a + b + c)
bar()
bar(2)
bar(2, 3)
Reported by Pylint.
Line: 5
Column: 5
def f():
a = 1
def bar(b = 10, c = 20):
print(a + b + c)
bar()
bar(2)
bar(2, 3)
Reported by Pylint.
Line: 5
Column: 5
def f():
a = 1
def bar(b = 10, c = 20):
print(a + b + c)
bar()
bar(2)
bar(2, 3)
Reported by Pylint.
tests/basics/class_super_object.py
7 issues
Line: 8
Column: 5
object.__init__
except AttributeError:
print("SKIP")
raise SystemExit
class Test(object):
def __init__(self):
super().__init__()
print("Test.__init__")
Reported by Pylint.
Line: 1
Column: 1
# Calling object.__init__() via super().__init__
try:
# If we don't expose object.__init__ (small ports), there's
# nothing to test.
object.__init__
except AttributeError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 10
Column: 1
print("SKIP")
raise SystemExit
class Test(object):
def __init__(self):
super().__init__()
print("Test.__init__")
t = Test()
Reported by Pylint.
Line: 10
Column: 1
print("SKIP")
raise SystemExit
class Test(object):
def __init__(self):
super().__init__()
print("Test.__init__")
t = Test()
Reported by Pylint.
Line: 10
Column: 1
print("SKIP")
raise SystemExit
class Test(object):
def __init__(self):
super().__init__()
print("Test.__init__")
t = Test()
Reported by Pylint.
Line: 17
Column: 1
t = Test()
class Test2:
def __init__(self):
super().__init__()
print("Test2.__init__")
t = Test2()
Reported by Pylint.
Line: 17
Column: 1
t = Test()
class Test2:
def __init__(self):
super().__init__()
print("Test2.__init__")
t = Test2()
Reported by Pylint.
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/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/basics/class_item.py
7 issues
Line: 24
Column: 5
pass
a = A()
try:
a[1]
except TypeError:
print('TypeError')
Reported by Pylint.
Line: 1
Column: 1
# test class with __getitem__, __setitem__, __delitem__ methods
class C:
def __getitem__(self, item):
print('get', item)
return 'item'
def __setitem__(self, item, value):
print('set', item, value)
Reported by Pylint.
Line: 3
Column: 1
# test class with __getitem__, __setitem__, __delitem__ methods
class C:
def __getitem__(self, item):
print('get', item)
return 'item'
def __setitem__(self, item, value):
print('set', item, value)
Reported by Pylint.
Line: 3
Column: 1
# test class with __getitem__, __setitem__, __delitem__ methods
class C:
def __getitem__(self, item):
print('get', item)
return 'item'
def __setitem__(self, item, value):
print('set', item, value)
Reported by Pylint.
Line: 20
Column: 1
del c[3]
# index not supported
class A:
pass
a = A()
try:
a[1]
except TypeError:
Reported by Pylint.
Line: 20
Column: 1
del c[3]
# index not supported
class A:
pass
a = A()
try:
a[1]
except TypeError:
Reported by Pylint.
Line: 20
Column: 1
del c[3]
# index not supported
class A:
pass
a = A()
try:
a[1]
except TypeError:
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/class_contains.py
7 issues
Line: 1
Column: 1
# A contains everything
class A:
def __contains__(self, key):
return True
a = A()
print(True in a)
print(1 in a)
print(() in a)
Reported by Pylint.
Line: 2
Column: 1
# A contains everything
class A:
def __contains__(self, key):
return True
a = A()
print(True in a)
print(1 in a)
print(() in a)
Reported by Pylint.
Line: 2
Column: 1
# A contains everything
class A:
def __contains__(self, key):
return True
a = A()
print(True in a)
print(1 in a)
print(() in a)
Reported by Pylint.
Line: 2
Column: 1
# A contains everything
class A:
def __contains__(self, key):
return True
a = A()
print(True in a)
print(1 in a)
print(() in a)
Reported by Pylint.
Line: 12
Column: 1
print(() in a)
# B contains given things
class B:
def __init__(self, items):
self.items = items
def __contains__(self, key):
return key in self.items
Reported by Pylint.
Line: 12
Column: 1
print(() in a)
# B contains given things
class B:
def __init__(self, items):
self.items = items
def __contains__(self, key):
return key in self.items
Reported by Pylint.
Line: 12
Column: 1
print(() in a)
# B contains given things
class B:
def __init__(self, items):
self.items = items
def __contains__(self, key):
return key in self.items
Reported by Pylint.