The following issues were found

tests/extmod/uselect_poll_udp.py
5 issues
Consider explicitly re-raising using the 'from' keyword
Error

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.

Missing module docstring
Error

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.

Multiple imports on one line (usocket, uselect)
Error

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.

Multiple imports on one line (socket, select)
Error

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.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

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
Consider explicitly re-raising using the 'from' keyword
Error

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.

Missing module docstring
Error

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.

Variable name "e" doesn't conform to snake_case naming style
Error

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.

Variable name "e" doesn't conform to snake_case naming style
Error

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.

Variable name "e" doesn't conform to snake_case naming style
Error

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 too long (458/100)
Error

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.

Missing module docstring
Error

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.

Constant name "b1" doesn't conform to UPPER_CASE naming style
Error

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 too long (356/100)
Error

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.

Constant name "b2" doesn't conform to UPPER_CASE naming style
Error

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 too long (175/100)
Error

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.

Missing class docstring
Error

Line: 9 Column: 1

              """


class Foo:
    def __str__(self):
        return "Foo"


class C(tuple, Foo):

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 9 Column: 1

              """


class Foo:
    def __str__(self):
        return "Foo"


class C(tuple, Foo):

            

Reported by Pylint.

Class name "C" doesn't conform to PascalCase naming style
Error

Line: 14 Column: 1

                      return "Foo"


class C(tuple, Foo):
    pass


t = C((1, 2, 3))
print(t)

            

Reported by Pylint.

Missing class docstring
Error

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
Undefined variable 'a'
Error

Line: 5 Column: 9

              
try:
    try:
        a
    except 1:
        pass
except TypeError:
    print("TypeError")


            

Reported by Pylint.

Catching an exception which doesn't inherit from Exception: 1
Error

Line: 6 Column: 12

              try:
    try:
        a
    except 1:
        pass
except TypeError:
    print("TypeError")

try:

            

Reported by Pylint.

Undefined variable 'a'
Error

Line: 13 Column: 9

              
try:
    try:
        a
    except (1,):
        pass
except TypeError:
    print("TypeError")

            

Reported by Pylint.

Catching an exception which doesn't inherit from Exception: 1
Error

Line: 14 Column: 12

              try:
    try:
        a
    except (1,):
        pass
except TypeError:
    print("TypeError")

            

Reported by Pylint.

Missing module docstring
Error

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
Black listed name "foo"
Error

Line: 1 Column: 1

              def foo(x: int, y: list) -> dict:
    return {x: y}

print(foo(1, [2, 3]))

            

Reported by Pylint.

Argument name "x" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              def foo(x: int, y: list) -> dict:
    return {x: y}

print(foo(1, [2, 3]))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 1 Column: 1

              def foo(x: int, y: list) -> dict:
    return {x: y}

print(foo(1, [2, 3]))

            

Reported by Pylint.

Argument name "y" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              def foo(x: int, y: list) -> dict:
    return {x: y}

print(foo(1, [2, 3]))

            

Reported by Pylint.

Missing module docstring
Error

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
Missing module docstring
Error

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.

Argument name "f" doesn't conform to snake_case naming style
Error

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.

Missing function or method docstring
Error

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.

Black listed name "foo"
Error

Line: 9 Column: 1

              
# test definition with a decorator
@dec
async def foo():
    print('foo')

coro = foo()
try:
    coro.send(None)

            

Reported by Pylint.

Missing function or method docstring
Error

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
Missing module docstring
Error

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.

Missing function or method docstring
Error

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.

Function name "f" doesn't conform to snake_case naming style
Error

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.

Missing function or method docstring
Error

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.

Variable name "x" doesn't conform to snake_case naming style
Error

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
Missing module docstring
Error

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.

Missing function or method docstring
Error

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.

Argument name "n" doesn't conform to snake_case naming style
Error

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.

Variable name "l" doesn't conform to snake_case naming style
Error

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.

Variable name "r" doesn't conform to snake_case naming style
Error

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
Else clause on loop without a break statement
Error

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.

Else clause on loop without a break statement
Error

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.

Else clause on loop without a break statement
Error

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.

Else clause on loop without a break statement
Error

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.

Missing module docstring
Error

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.