The following issues were found
tests/internal_bench/funcall-3-funcall-local.py
9 issues
Line: 16
Column: 9
def test(num):
f_ = f
for i in iter(range(num)):
a = f_(i)
bench.run(test)
Reported by Pylint.
Line: 1
Column: 1
# Function call overhead test
# Perform the same trivial operation as calling function, cached in a
# local variable. This is commonly known optimization for overly dynamic
# languages (the idea is to cut on symbolic look up overhead, as local
# variables are accessed by offset, not by name)
import bench
def f(x):
Reported by Pylint.
Line: 1
Column: 1
# Function call overhead test
# Perform the same trivial operation as calling function, cached in a
# local variable. This is commonly known optimization for overly dynamic
# languages (the idea is to cut on symbolic look up overhead, as local
# variables are accessed by offset, not by name)
import bench
def f(x):
Reported by Pylint.
Line: 9
Column: 1
import bench
def f(x):
return x + 1
def test(num):
f_ = f
Reported by Pylint.
Line: 9
Column: 1
import bench
def f(x):
return x + 1
def test(num):
f_ = f
Reported by Pylint.
Line: 9
Column: 1
import bench
def f(x):
return x + 1
def test(num):
f_ = f
Reported by Pylint.
Line: 13
Column: 1
return x + 1
def test(num):
f_ = f
for i in iter(range(num)):
a = f_(i)
Reported by Pylint.
Line: 14
Column: 5
def test(num):
f_ = f
for i in iter(range(num)):
a = f_(i)
bench.run(test)
Reported by Pylint.
Line: 16
Column: 9
def test(num):
f_ = f
for i in iter(range(num)):
a = f_(i)
bench.run(test)
Reported by Pylint.
tests/basics/unboundlocal.py
9 issues
Line: 4
Column: 11
# locals referenced before assignment
def f1():
print(x)
x = 1
def f2():
for i in range(0):
print(i)
Reported by Pylint.
Line: 1
Column: 1
# locals referenced before assignment
def f1():
print(x)
x = 1
def f2():
for i in range(0):
print(i)
Reported by Pylint.
Line: 3
Column: 1
# locals referenced before assignment
def f1():
print(x)
x = 1
def f2():
for i in range(0):
print(i)
Reported by Pylint.
Line: 3
Column: 1
# locals referenced before assignment
def f1():
print(x)
x = 1
def f2():
for i in range(0):
print(i)
Reported by Pylint.
Line: 5
Column: 5
def f1():
print(x)
x = 1
def f2():
for i in range(0):
print(i)
print(i)
Reported by Pylint.
Line: 7
Column: 1
print(x)
x = 1
def f2():
for i in range(0):
print(i)
print(i)
def check(f):
Reported by Pylint.
Line: 7
Column: 1
print(x)
x = 1
def f2():
for i in range(0):
print(i)
print(i)
def check(f):
Reported by Pylint.
Line: 12
Column: 1
print(i)
print(i)
def check(f):
try:
f()
except NameError:
print("NameError")
Reported by Pylint.
Line: 12
Column: 1
print(i)
print(i)
def check(f):
try:
f()
except NameError:
print("NameError")
Reported by Pylint.
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/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/perf_bench/viper_call1a.py
9 issues
Line: 1
Column: 2
@micropython.viper
def f1a(x):
return x
@micropython.native
def call(r):
f = f1a
for _ in r:
Reported by Pylint.
Line: 6
Column: 2
return x
@micropython.native
def call(r):
f = f1a
for _ in r:
f(1)
Reported by Pylint.
Line: 1
Column: 1
@micropython.viper
def f1a(x):
return x
@micropython.native
def call(r):
f = f1a
for _ in r:
Reported by Pylint.
Line: 2
Column: 1
@micropython.viper
def f1a(x):
return x
@micropython.native
def call(r):
f = f1a
for _ in r:
Reported by Pylint.
Line: 2
Column: 1
@micropython.viper
def f1a(x):
return x
@micropython.native
def call(r):
f = f1a
for _ in r:
Reported by Pylint.
Line: 7
Column: 1
@micropython.native
def call(r):
f = f1a
for _ in r:
f(1)
Reported by Pylint.
Line: 7
Column: 1
@micropython.native
def call(r):
f = f1a
for _ in r:
f(1)
Reported by Pylint.
Line: 8
Column: 5
@micropython.native
def call(r):
f = f1a
for _ in r:
f(1)
bm_params = {
Reported by Pylint.
Line: 21
Column: 1
}
def bm_setup(params):
return lambda: call(range(params[0])), lambda: (params[0] // 1000, None)
Reported by Pylint.
tests/extmod/uzlib_decompio_gz.py
9 issues
Line: 6
Column: 5
import uio as io
except ImportError:
print("SKIP")
raise SystemExit
# gzip bitstream
buf = io.BytesIO(
b"\x1f\x8b\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00"
Reported by Pylint.
Line: 1
Column: 1
try:
import uzlib as zlib
import uio as io
except ImportError:
print("SKIP")
raise SystemExit
# gzip bitstream
Reported by Pylint.
Line: 11
Column: 1
# gzip bitstream
buf = io.BytesIO(
b"\x1f\x8b\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00"
)
inp = zlib.DecompIO(buf, 16 + 8)
print(buf.seek(0, 1))
print(inp.read(1))
print(buf.seek(0, 1))
Reported by Pylint.
Line: 26
Column: 1
# Check FHCRC field
buf = io.BytesIO(
b"\x1f\x8b\x08\x02\x99\x0c\xe5W\x00\x03\x00\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00"
)
inp = zlib.DecompIO(buf, 16 + 8)
print(inp.read())
# Check FEXTRA field
Reported by Pylint.
Line: 33
Column: 1
# Check FEXTRA field
buf = io.BytesIO(
b"\x1f\x8b\x08\x04\x99\x0c\xe5W\x00\x03\x01\x00X\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00"
)
inp = zlib.DecompIO(buf, 16 + 8)
print(inp.read())
# broken header
Reported by Pylint.
Line: 40
Column: 1
# broken header
buf = io.BytesIO(
b"\x1f\x8c\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00"
)
try:
inp = zlib.DecompIO(buf, 16 + 8)
except ValueError:
print("ValueError")
Reported by Pylint.
Line: 49
Column: 1
# broken crc32
buf = io.BytesIO(
b"\x1f\x8b\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa7\x106\x05\x00\x00\x00"
)
inp = zlib.DecompIO(buf, 16 + 8)
try:
inp.read(6)
except OSError as e:
Reported by Pylint.
Line: 54
Column: 1
inp = zlib.DecompIO(buf, 16 + 8)
try:
inp.read(6)
except OSError as e:
print(repr(e))
# broken uncompressed size - not checked so far
# buf = io.BytesIO(b'\x1f\x8b\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x06\x00\x00\x00')
# inp = zlib.DecompIO(buf, 16 + 8)
Reported by Pylint.
Line: 58
Column: 1
print(repr(e))
# broken uncompressed size - not checked so far
# buf = io.BytesIO(b'\x1f\x8b\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x06\x00\x00\x00')
# inp = zlib.DecompIO(buf, 16 + 8)
# inp.read(6)
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/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.