The following issues were found
tests/extmod/uselect_poll_udp.py
5 issues
Line: 10
Column: 9
import socket, select
except ImportError:
print("SKIP")
raise SystemExit
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(socket.getaddrinfo("127.0.0.1", 8000)[0][-1])
poll = select.poll()
Reported by Pylint.
Line: 1
Column: 1
# test select.poll on UDP sockets
try:
import usocket as socket, uselect as select
except ImportError:
try:
import socket, select
except ImportError:
print("SKIP")
Reported by Pylint.
Line: 4
Column: 5
# test select.poll on UDP sockets
try:
import usocket as socket, uselect as select
except ImportError:
try:
import socket, select
except ImportError:
print("SKIP")
Reported by Pylint.
Line: 7
Column: 9
import usocket as socket, uselect as select
except ImportError:
try:
import socket, select
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 28
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
# same test for select.select, but just skip it if the function isn't available
if hasattr(select, "select"):
r, w, e = select.select([s], [], [], 0)
assert not r and not w and not e
Reported by Bandit.
tests/basics/sys_exit.py
5 issues
Line: 12
Column: 5
sys.exit
except AttributeError:
print("SKIP")
raise SystemExit
try:
raise SystemExit
except SystemExit as e:
print("SystemExit", e.args)
Reported by Pylint.
Line: 1
Column: 1
# test sys module's exit function
try:
import usys as sys
except ImportError:
import sys
try:
sys.exit
Reported by Pylint.
Line: 16
Column: 1
try:
raise SystemExit
except SystemExit as e:
print("SystemExit", e.args)
try:
sys.exit()
except SystemExit as e:
Reported by Pylint.
Line: 21
Column: 1
try:
sys.exit()
except SystemExit as e:
print("SystemExit", e.args)
try:
sys.exit(42)
except SystemExit as e:
Reported by Pylint.
Line: 26
Column: 1
try:
sys.exit(42)
except SystemExit as e:
print("SystemExit", e.args)
Reported by Pylint.
tests/basics/bytes_large.py
5 issues
Line: 1
Column: 1
b1 = b"long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes"
b2 = b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes"
Reported by Pylint.
Line: 1
Column: 1
b1 = b"long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes"
b2 = b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes"
Reported by Pylint.
Line: 1
Column: 1
b1 = b"long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes"
b2 = b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes"
Reported by Pylint.
Line: 2
Column: 1
b1 = b"long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes"
b2 = b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes"
Reported by Pylint.
Line: 2
Column: 1
b1 = b"long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes long bytes"
b2 = b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes" b"concatenated bytes"
Reported by Pylint.
tests/cpydiff/core_class_mro.py
5 issues
Line: 5
Column: 1
categories: Core,Classes
description: Method Resolution Order (MRO) is not compliant with CPython
cause: Depth first non-exhaustive method resolution order
workaround: Avoid complex class hierarchies with multiple inheritance and complex method overrides. Keep in mind that many languages don't support multiple inheritance at all.
"""
class Foo:
def __str__(self):
Reported by Pylint.
Line: 9
Column: 1
"""
class Foo:
def __str__(self):
return "Foo"
class C(tuple, Foo):
Reported by Pylint.
Line: 9
Column: 1
"""
class Foo:
def __str__(self):
return "Foo"
class C(tuple, Foo):
Reported by Pylint.
Line: 14
Column: 1
return "Foo"
class C(tuple, Foo):
pass
t = C((1, 2, 3))
print(t)
Reported by Pylint.
Line: 14
Column: 1
return "Foo"
class C(tuple, Foo):
pass
t = C((1, 2, 3))
print(t)
Reported by Pylint.
tests/basics/try_error.py
5 issues
Line: 5
Column: 9
try:
try:
a
except 1:
pass
except TypeError:
print("TypeError")
Reported by Pylint.
Line: 6
Column: 12
try:
try:
a
except 1:
pass
except TypeError:
print("TypeError")
try:
Reported by Pylint.
Line: 13
Column: 9
try:
try:
a
except (1,):
pass
except TypeError:
print("TypeError")
Reported by Pylint.
Line: 14
Column: 12
try:
try:
a
except (1,):
pass
except TypeError:
print("TypeError")
Reported by Pylint.
Line: 1
Column: 1
# test bad exception match
try:
try:
a
except 1:
pass
except TypeError:
print("TypeError")
Reported by Pylint.
tests/basics/fun_annotations.py
5 issues
Line: 1
Column: 1
def foo(x: int, y: list) -> dict:
return {x: y}
print(foo(1, [2, 3]))
Reported by Pylint.
Line: 1
Column: 1
def foo(x: int, y: list) -> dict:
return {x: y}
print(foo(1, [2, 3]))
Reported by Pylint.
Line: 1
Column: 1
def foo(x: int, y: list) -> dict:
return {x: y}
print(foo(1, [2, 3]))
Reported by Pylint.
Line: 1
Column: 1
def foo(x: int, y: list) -> dict:
return {x: y}
print(foo(1, [2, 3]))
Reported by Pylint.
Line: 1
Column: 1
def foo(x: int, y: list) -> dict:
return {x: y}
print(foo(1, [2, 3]))
Reported by Pylint.
tests/basics/async_def.py
5 issues
Line: 1
Column: 1
# test async def
def dec(f):
print('decorator')
return f
# test definition with a decorator
@dec
async def foo():
Reported by Pylint.
Line: 3
Column: 1
# test async def
def dec(f):
print('decorator')
return f
# test definition with a decorator
@dec
async def foo():
Reported by Pylint.
Line: 3
Column: 1
# test async def
def dec(f):
print('decorator')
return f
# test definition with a decorator
@dec
async def foo():
Reported by Pylint.
Line: 9
Column: 1
# test definition with a decorator
@dec
async def foo():
print('foo')
coro = foo()
try:
coro.send(None)
Reported by Pylint.
Line: 9
Column: 1
# test definition with a decorator
@dec
async def foo():
print('foo')
coro = foo()
try:
coro.send(None)
Reported by Pylint.
tests/basics/async_await2.py
5 issues
Line: 1
Column: 1
# test await expression
try:
import usys as sys
except ImportError:
import sys
if sys.implementation.name == 'micropython':
# uPy allows normal generators to be awaitables
coroutine = lambda f: f
Reported by Pylint.
Line: 15
Column: 1
coroutine = types.coroutine
@coroutine
def wait(value):
print('wait value:', value)
msg = yield 'message from wait({})'.format(value)
print('wait got back:', msg)
return 10
Reported by Pylint.
Line: 21
Column: 1
print('wait got back:', msg)
return 10
async def f():
x = await wait(1)**2
print('x =', x)
coro = f()
print('return from send:', coro.send(None))
Reported by Pylint.
Line: 21
Column: 1
print('wait got back:', msg)
return 10
async def f():
x = await wait(1)**2
print('x =', x)
coro = f()
print('return from send:', coro.send(None))
Reported by Pylint.
Line: 22
Column: 5
return 10
async def f():
x = await wait(1)**2
print('x =', x)
coro = f()
print('return from send:', coro.send(None))
try:
Reported by Pylint.
tests/basics/async_await.py
5 issues
Line: 1
Column: 1
# test basic await expression
# adapted from PEP0492
async def abinary(n):
print(n)
if n <= 0:
return 1
l = await abinary(n - 1)
r = await abinary(n - 1)
Reported by Pylint.
Line: 4
Column: 1
# test basic await expression
# adapted from PEP0492
async def abinary(n):
print(n)
if n <= 0:
return 1
l = await abinary(n - 1)
r = await abinary(n - 1)
Reported by Pylint.
Line: 4
Column: 1
# test basic await expression
# adapted from PEP0492
async def abinary(n):
print(n)
if n <= 0:
return 1
l = await abinary(n - 1)
r = await abinary(n - 1)
Reported by Pylint.
Line: 8
Column: 5
print(n)
if n <= 0:
return 1
l = await abinary(n - 1)
r = await abinary(n - 1)
return l + 1 + r
o = abinary(4)
try:
Reported by Pylint.
Line: 9
Column: 5
if n <= 0:
return 1
l = await abinary(n - 1)
r = await abinary(n - 1)
return l + 1 + r
o = abinary(4)
try:
while True:
Reported by Pylint.
tests/basics/for_else.py
5 issues
Line: 6
Column: 1
# test optimised range with simple else
for i in range(2):
print(i)
else:
print('else')
# test optimised range with break over else
for i in range(2):
print(i)
Reported by Pylint.
Line: 21
Column: 5
print(i)
for j in range(4):
pass
else:
continue
break
# test optimised range with non-constant end value
N = 2
Reported by Pylint.
Line: 29
Column: 1
N = 2
for i in range(N):
print(i)
else:
print('else')
# test generic iterator with simple else
for i in [0, 1]:
print(i)
Reported by Pylint.
Line: 35
Column: 1
# test generic iterator with simple else
for i in [0, 1]:
print(i)
else:
print('else')
# test generic iterator with break over else
for i in [0, 1]:
print(i)
Reported by Pylint.
Line: 1
Column: 1
# test for-else statement
# test optimised range with simple else
for i in range(2):
print(i)
else:
print('else')
# test optimised range with break over else
Reported by Pylint.