The following issues were found
tests/basics/types2.py
5 issues
Line: 1
Column: 1
# Types are hashable
print(hash(type) != 0)
print(hash(int) != 0)
print(hash(list) != 0)
class Foo: pass
print(hash(Foo) != 0)
print(int == int)
print(int != list)
Reported by Pylint.
Line: 5
Column: 1
print(hash(type) != 0)
print(hash(int) != 0)
print(hash(list) != 0)
class Foo: pass
print(hash(Foo) != 0)
print(int == int)
print(int != list)
Reported by Pylint.
Line: 5
Column: 12
print(hash(type) != 0)
print(hash(int) != 0)
print(hash(list) != 0)
class Foo: pass
print(hash(Foo) != 0)
print(int == int)
print(int != list)
Reported by Pylint.
Line: 5
Column: 1
print(hash(type) != 0)
print(hash(int) != 0)
print(hash(list) != 0)
class Foo: pass
print(hash(Foo) != 0)
print(int == int)
print(int != list)
Reported by Pylint.
Line: 8
Column: 7
class Foo: pass
print(hash(Foo) != 0)
print(int == int)
print(int != list)
d = {}
d[int] = list
d[list] = int
Reported by Pylint.
tests/basics/async_syntaxerror.py
5 issues
Line: 7
Column: 5
exec
except NameError:
print("SKIP")
raise SystemExit
def test_syntax(code):
try:
exec(code)
Reported by Pylint.
Line: 12
Column: 9
def test_syntax(code):
try:
exec(code)
print("no SyntaxError")
except SyntaxError:
print("SyntaxError")
Reported by Pylint.
Line: 12
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html
def test_syntax(code):
try:
exec(code)
print("no SyntaxError")
except SyntaxError:
print("SyntaxError")
Reported by Bandit.
Line: 1
Column: 1
# test syntax errors using async
try:
exec
except NameError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 10
Column: 1
raise SystemExit
def test_syntax(code):
try:
exec(code)
print("no SyntaxError")
except SyntaxError:
print("SyntaxError")
Reported by Pylint.
tests/extmod/uasyncio_current_task.py
5 issues
Line: 10
Column: 9
import asyncio
except ImportError:
print("SKIP")
raise SystemExit
async def task(result):
result[0] = asyncio.current_task()
Reported by Pylint.
Line: 1
Column: 1
# Test current_task() function
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(result):
result[0] = asyncio.current_task()
async def main():
result = [None]
Reported by Pylint.
Line: 17
Column: 1
result[0] = asyncio.current_task()
async def main():
result = [None]
t = asyncio.create_task(task(result))
await asyncio.sleep(0)
await asyncio.sleep(0)
print(t is result[0])
Reported by Pylint.
Line: 19
Column: 5
async def main():
result = [None]
t = asyncio.create_task(task(result))
await asyncio.sleep(0)
await asyncio.sleep(0)
print(t is result[0])
Reported by Pylint.
tests/basics/subclass_native2_list.py
5 issues
Line: 1
Column: 1
class Base1:
def __init__(self, *args):
print("Base1.__init__", args)
class Clist1(Base1, list):
pass
a = Clist1()
print(len(a))
Reported by Pylint.
Line: 1
Column: 1
class Base1:
def __init__(self, *args):
print("Base1.__init__", args)
class Clist1(Base1, list):
pass
a = Clist1()
print(len(a))
Reported by Pylint.
Line: 1
Column: 1
class Base1:
def __init__(self, *args):
print("Base1.__init__", args)
class Clist1(Base1, list):
pass
a = Clist1()
print(len(a))
Reported by Pylint.
Line: 5
Column: 1
def __init__(self, *args):
print("Base1.__init__", args)
class Clist1(Base1, list):
pass
a = Clist1()
print(len(a))
# Not compliant - list assignment should happen in list.__init__, which is not called
Reported by Pylint.
Line: 17
Column: 1
print("---")
class Clist2(list, Base1):
pass
# Not compliant - should call list.__init__, but we don't have it
#a = Clist2()
#print(len(a))
Reported by Pylint.
tests/basics/subclass_native2_tuple.py
5 issues
Line: 1
Column: 1
class Base1:
def __init__(self, *args):
print("Base1.__init__", args)
class Ctuple1(Base1, tuple):
pass
a = Ctuple1()
print(len(a))
Reported by Pylint.
Line: 1
Column: 1
class Base1:
def __init__(self, *args):
print("Base1.__init__", args)
class Ctuple1(Base1, tuple):
pass
a = Ctuple1()
print(len(a))
Reported by Pylint.
Line: 1
Column: 1
class Base1:
def __init__(self, *args):
print("Base1.__init__", args)
class Ctuple1(Base1, tuple):
pass
a = Ctuple1()
print(len(a))
Reported by Pylint.
Line: 5
Column: 1
def __init__(self, *args):
print("Base1.__init__", args)
class Ctuple1(Base1, tuple):
pass
a = Ctuple1()
print(len(a))
a = Ctuple1([1, 2, 3])
Reported by Pylint.
Line: 15
Column: 1
print("---")
class Ctuple2(tuple, Base1):
pass
a = Ctuple2()
print(len(a))
a = Ctuple2([1, 2, 3])
Reported by Pylint.
tests/extmod/usocket_udp_nonblock.py
5 issues
Line: 10
Column: 9
import socket, errno
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])
s.settimeout(0)
Reported by Pylint.
Line: 1
Column: 1
# test non-blocking UDP sockets
try:
import usocket as socket, uerrno as errno
except ImportError:
try:
import socket, errno
except ImportError:
print("SKIP")
Reported by Pylint.
Line: 4
Column: 5
# test non-blocking UDP sockets
try:
import usocket as socket, uerrno as errno
except ImportError:
try:
import socket, errno
except ImportError:
print("SKIP")
Reported by Pylint.
Line: 7
Column: 9
import usocket as socket, uerrno as errno
except ImportError:
try:
import socket, errno
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 19
Column: 1
try:
s.recv(1)
except OSError as er:
print("EAGAIN:", er.errno == errno.EAGAIN)
Reported by Pylint.
tests/basics/bytes.py
5 issues
Line: 5
Column: 9
print(b'123')
print(br'123')
print(rb'123')
print(b'\u1234')
# construction
print(bytes())
print(bytes(b'abc'))
Reported by Pylint.
Line: 1
Column: 1
# literals
print(b'123')
print(br'123')
print(rb'123')
print(b'\u1234')
# construction
print(bytes())
print(bytes(b'abc'))
Reported by Pylint.
Line: 14
Column: 1
# make sure empty bytes is converted correctly
print(str(bytes(), 'utf-8'))
a = b"123"
print(a)
print(str(a))
print(repr(a))
print(a[0], a[2])
print(a[-1])
Reported by Pylint.
Line: 27
Column: 1
except TypeError:
print("TypeError")
s = 0
for i in a:
s += i
print(s)
Reported by Pylint.
Line: 50
Column: 1
print(bytes(range(5)))
# Make sure bytes are not mistreated as unicode
x = b"\xff\x8e\xfe}\xfd\x7f"
print(len(x))
print(x[0], x[1], x[2], x[3])
# Make sure init values are not mistreated as unicode chars
# For sequence of known len
Reported by Pylint.
tests/extmod/usocket_tcp_basic.py
5 issues
Line: 10
Column: 9
import socket, errno
except ImportError:
print("SKIP")
raise SystemExit
# recv() on a fresh socket should raise ENOTCONN
s = socket.socket()
try:
s.recv(1)
Reported by Pylint.
Line: 1
Column: 1
# Test basic, stand-alone TCP socket functionality
try:
import usocket as socket, uerrno as errno
except ImportError:
try:
import socket, errno
except ImportError:
print("SKIP")
Reported by Pylint.
Line: 4
Column: 5
# Test basic, stand-alone TCP socket functionality
try:
import usocket as socket, uerrno as errno
except ImportError:
try:
import socket, errno
except ImportError:
print("SKIP")
Reported by Pylint.
Line: 7
Column: 9
import usocket as socket, uerrno as errno
except ImportError:
try:
import socket, errno
except ImportError:
print("SKIP")
raise SystemExit
# recv() on a fresh socket should raise ENOTCONN
Reported by Pylint.
Line: 16
Column: 1
s = socket.socket()
try:
s.recv(1)
except OSError as er:
print("ENOTCONN:", er.errno == errno.ENOTCONN)
Reported by Pylint.
tests/basics/subclass_native_str.py
5 issues
Line: 1
Column: 1
# Test subclassing built-in str
class S(str):
pass
s = S('hello')
print(s == 'hello')
print('hello' == s)
print(s == 'Hello')
Reported by Pylint.
Line: 3
Column: 1
# Test subclassing built-in str
class S(str):
pass
s = S('hello')
print(s == 'hello')
print('hello' == s)
print(s == 'Hello')
Reported by Pylint.
Line: 3
Column: 1
# Test subclassing built-in str
class S(str):
pass
s = S('hello')
print(s == 'hello')
print('hello' == s)
print(s == 'Hello')
Reported by Pylint.
Line: 8
Column: 7
s = S('hello')
print(s == 'hello')
print('hello' == s)
print(s == 'Hello')
print('Hello' == s)
Reported by Pylint.
Line: 10
Column: 7
print(s == 'hello')
print('hello' == s)
print(s == 'Hello')
print('Hello' == s)
Reported by Pylint.
tests/basics/syntaxerror.py
5 issues
Line: 7
Column: 5
exec
except NameError:
print("SKIP")
raise SystemExit
def test_syntax(code):
try:
exec(code)
print("no SyntaxError")
Reported by Pylint.
Line: 11
Column: 9
def test_syntax(code):
try:
exec(code)
print("no SyntaxError")
except IndentationError:
print("IndentationError")
except SyntaxError:
print("SyntaxError")
Reported by Pylint.
Line: 11
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html
def test_syntax(code):
try:
exec(code)
print("no SyntaxError")
except IndentationError:
print("IndentationError")
except SyntaxError:
print("SyntaxError")
Reported by Bandit.
Line: 1
Column: 1
# test syntax errors
try:
exec
except NameError:
print("SKIP")
raise SystemExit
def test_syntax(code):
Reported by Pylint.
Line: 9
Column: 1
print("SKIP")
raise SystemExit
def test_syntax(code):
try:
exec(code)
print("no SyntaxError")
except IndentationError:
print("IndentationError")
Reported by Pylint.