The following issues were found

tests/import/import3a.py
3 issues
Wildcard import import1b
Error

Line: 1 Column: 1

              from import1b import *

print(var)

            

Reported by Pylint.

Unused import throw from wildcard import
Error

Line: 1 Column: 1

              from import1b import *

print(var)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from import1b import *

print(var)

            

Reported by Pylint.

tests/internal_bench/loop_count-4-while_down_gt.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              import bench


def test(num):
    while num > 0:
        num -= 1


bench.run(test)

            

Reported by Pylint.

Module name "loop_count-4-while_down_gt" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              import bench


def test(num):
    while num > 0:
        num -= 1


bench.run(test)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 4 Column: 1

              import bench


def test(num):
    while num > 0:
        num -= 1


bench.run(test)

            

Reported by Pylint.

tests/basics/io_write_ext.py
3 issues
Unable to import 'uio'
Error

Line: 3 Column: 1

              # This tests extended (MicroPython-specific) form of write:
# write(buf, len) and write(buf, offset, len)
import uio

try:
    uio.BytesIO
except AttributeError:
    print('SKIP')
    raise SystemExit

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 9 Column: 5

                  uio.BytesIO
except AttributeError:
    print('SKIP')
    raise SystemExit

buf = uio.BytesIO()

buf.write(b"foo", 2)
print(buf.getvalue())

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # This tests extended (MicroPython-specific) form of write:
# write(buf, len) and write(buf, offset, len)
import uio

try:
    uio.BytesIO
except AttributeError:
    print('SKIP')
    raise SystemExit

            

Reported by Pylint.

tests/import/gen_context2.py
3 issues
Missing function or method docstring
Error

Line: 1 Column: 1

              def call(g):
    next(g)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def call(g):
    next(g)

            

Reported by Pylint.

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

Line: 1 Column: 1

              def call(g):
    next(g)

            

Reported by Pylint.

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

Line: 8 Column: 9

                      import random
    except ImportError:
        print("SKIP")
        raise SystemExit

# check getrandbits returns a value within the bit range
for b in (1, 2, 3, 4, 16, 32):
    for i in range(50):
        assert random.getrandbits(b) < (1 << b)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    import urandom as random
except ImportError:
    try:
        import random
    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: 13
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              # check getrandbits returns a value within the bit range
for b in (1, 2, 3, 4, 16, 32):
    for i in range(50):
        assert random.getrandbits(b) < (1 << b)

# check that seed(0) gives a non-zero value
random.seed(0)
print(random.getrandbits(16) != 0)


            

Reported by Bandit.

tests/internal_bench/loop_count-5-while_down_ne.py
3 issues
Module name "loop_count-5-while_down_ne" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              import bench


def test(num):
    while num != 0:
        num -= 1


bench.run(test)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import bench


def test(num):
    while num != 0:
        num -= 1


bench.run(test)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 4 Column: 1

              import bench


def test(num):
    while num != 0:
        num -= 1


bench.run(test)

            

Reported by Pylint.

tests/basics/int_big_and2.py
3 issues
Trailing whitespace
Error

Line: 1 Column: 11

              # test + + 

print( 97989513389222316022151446562729620153292831887555425160965597396
     & 23716683549865351578586448630079789776107310103486834795830390982)

print( 53817081128841898634258263553430908085326601592682411889506742059
     & 37042558948907407488299113387826240429667200950043601129661240876)

print( 26167512042587370698808974207700979337713004510730289760097826496

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test + + 

print( 97989513389222316022151446562729620153292831887555425160965597396
     & 23716683549865351578586448630079789776107310103486834795830390982)

print( 53817081128841898634258263553430908085326601592682411889506742059
     & 37042558948907407488299113387826240429667200950043601129661240876)

print( 26167512042587370698808974207700979337713004510730289760097826496

            

Reported by Pylint.

Trailing whitespace
Error

Line: 27 Column: 11

              print( 40019818573920230246248826511203818792007462193311949166285967147
     & 9487909752)

# test - - 

print( -97989513389222316022151446562729620153292831887555425160965597396
     & -23716683549865351578586448630079789776107310103486834795830390982)

print( -53817081128841898634258263553430908085326601592682411889506742059

            

Reported by Pylint.

ports/unix/variants/coverage/frzstr/frzstr_pkg2/mod.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test frozen package without __init__.py
print('frzstr_pkg2.mod')
class Foo:
    x = 1

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 3 Column: 1

              # test frozen package without __init__.py
print('frzstr_pkg2.mod')
class Foo:
    x = 1

            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              # test frozen package without __init__.py
print('frzstr_pkg2.mod')
class Foo:
    x = 1

            

Reported by Pylint.

tests/basics/builtin_range.py
3 issues
bad operand type for unary -: range
Error

Line: 52 Column: 5

              
# bad unary op
try:
    -range(1)
except TypeError:
    print("TypeError")

# bad subscription (can't store)
try:

            

Reported by Pylint.

'range(1)' does not support item assignment
Error

Line: 58 Column: 5

              
# bad subscription (can't store)
try:
    range(1)[0] = 1
except TypeError:
    print("TypeError")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test builtin range type

# print
print(range(4))

# bool
print(bool(range(0)))
print(bool(range(10)))


            

Reported by Pylint.

tests/stress/recursion.py
3 issues
Black listed name "foo"
Error

Line: 1 Column: 1

              def foo():
    foo()


try:
    foo()
except RuntimeError:
    print("RuntimeError")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def foo():
    foo()


try:
    foo()
except RuntimeError:
    print("RuntimeError")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 1 Column: 1

              def foo():
    foo()


try:
    foo()
except RuntimeError:
    print("RuntimeError")

            

Reported by Pylint.