The following issues were found

tests/basics/builtin_eval_buffer.py
9 issues
Statement seems to have no effect
Error

Line: 4 Column: 5

              # test builtin eval with a buffer (bytearray/memoryview) input

try:
    eval
    bytearray
    memoryview
except:
    print("SKIP")
    raise SystemExit

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 5 Column: 5

              
try:
    eval
    bytearray
    memoryview
except:
    print("SKIP")
    raise SystemExit


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 6 Column: 5

              try:
    eval
    bytearray
    memoryview
except:
    print("SKIP")
    raise SystemExit

print(eval(bytearray(b'1 + 1')))

            

Reported by Pylint.

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

Line: 9 Column: 5

                  memoryview
except:
    print("SKIP")
    raise SystemExit

print(eval(bytearray(b'1 + 1')))
print(eval(memoryview(b'2 + 2')))

            

Reported by Pylint.

Use of eval
Error

Line: 11 Column: 7

                  print("SKIP")
    raise SystemExit

print(eval(bytearray(b'1 + 1')))
print(eval(memoryview(b'2 + 2')))

            

Reported by Pylint.

Use of possibly insecure function - consider using safer ast.literal_eval.
Security blacklist

Line: 11
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b307-eval

                  print("SKIP")
    raise SystemExit

print(eval(bytearray(b'1 + 1')))
print(eval(memoryview(b'2 + 2')))

            

Reported by Bandit.

Use of possibly insecure function - consider using safer ast.literal_eval.
Security blacklist

Line: 12
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b307-eval

                  raise SystemExit

print(eval(bytearray(b'1 + 1')))
print(eval(memoryview(b'2 + 2')))

            

Reported by Bandit.

Use of eval
Error

Line: 12 Column: 7

                  raise SystemExit

print(eval(bytearray(b'1 + 1')))
print(eval(memoryview(b'2 + 2')))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test builtin eval with a buffer (bytearray/memoryview) input

try:
    eval
    bytearray
    memoryview
except:
    print("SKIP")
    raise SystemExit

            

Reported by Pylint.

tests/internal_bench/funcall-3-funcall-local.py
9 issues
Unused variable 'a'
Error

Line: 16 Column: 9

              def test(num):
    f_ = f
    for i in iter(range(num)):
        a = f_(i)


bench.run(test)

            

Reported by Pylint.

Module name "funcall-3-funcall-local" doesn't conform to snake_case naming style
Error

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.

Missing module docstring
Error

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.

Missing function or method docstring
Error

Line: 9 Column: 1

              import bench


def f(x):
    return x + 1


def test(num):
    f_ = f

            

Reported by Pylint.

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

Line: 9 Column: 1

              import bench


def f(x):
    return x + 1


def test(num):
    f_ = f

            

Reported by Pylint.

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

Line: 9 Column: 1

              import bench


def f(x):
    return x + 1


def test(num):
    f_ = f

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                  return x + 1


def test(num):
    f_ = f
    for i in iter(range(num)):
        a = f_(i)



            

Reported by Pylint.

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

Line: 14 Column: 5

              

def test(num):
    f_ = f
    for i in iter(range(num)):
        a = f_(i)


bench.run(test)

            

Reported by Pylint.

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

Line: 16 Column: 9

              def test(num):
    f_ = f
    for i in iter(range(num)):
        a = f_(i)


bench.run(test)

            

Reported by Pylint.

ports/esp8266/modules/port_diag.py
9 issues
Unable to import 'esp'
Error

Line: 1 Column: 1

              import esp
import uctypes
import network
import lwip


def main():

    ROM = uctypes.bytearray_at(0x40200000, 16)

            

Reported by Pylint.

Unable to import 'uctypes'
Error

Line: 2 Column: 1

              import esp
import uctypes
import network
import lwip


def main():

    ROM = uctypes.bytearray_at(0x40200000, 16)

            

Reported by Pylint.

Unable to import 'network'
Error

Line: 3 Column: 1

              import esp
import uctypes
import network
import lwip


def main():

    ROM = uctypes.bytearray_at(0x40200000, 16)

            

Reported by Pylint.

Unable to import 'lwip'
Error

Line: 4 Column: 1

              import esp
import uctypes
import network
import lwip


def main():

    ROM = uctypes.bytearray_at(0x40200000, 16)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import esp
import uctypes
import network
import lwip


def main():

    ROM = uctypes.bytearray_at(0x40200000, 16)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              import lwip


def main():

    ROM = uctypes.bytearray_at(0x40200000, 16)
    fid = esp.flash_id()

    print("FlashROM:")

            

Reported by Pylint.

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

Line: 9 Column: 5

              
def main():

    ROM = uctypes.bytearray_at(0x40200000, 16)
    fid = esp.flash_id()

    print("FlashROM:")
    print("Flash ID: %x (Vendor: %x Device: %x)" % (fid, fid & 0xFF, fid & 0xFF00 | fid >> 16))


            

Reported by Pylint.

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

Line: 16 Column: 5

                  print("Flash ID: %x (Vendor: %x Device: %x)" % (fid, fid & 0xFF, fid & 0xFF00 | fid >> 16))

    print("Flash bootloader data:")
    SZ_MAP = {0: "512KB", 1: "256KB", 2: "1MB", 3: "2MB", 4: "4MB"}
    FREQ_MAP = {0: "40MHZ", 1: "26MHZ", 2: "20MHz", 0xF: "80MHz"}
    print("Byte @2: %02x" % ROM[2])
    print(
        "Byte @3: %02x (Flash size: %s Flash freq: %s)"
        % (ROM[3], SZ_MAP.get(ROM[3] >> 4, "?"), FREQ_MAP.get(ROM[3] & 0xF))

            

Reported by Pylint.

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

Line: 17 Column: 5

              
    print("Flash bootloader data:")
    SZ_MAP = {0: "512KB", 1: "256KB", 2: "1MB", 3: "2MB", 4: "4MB"}
    FREQ_MAP = {0: "40MHZ", 1: "26MHZ", 2: "20MHz", 0xF: "80MHz"}
    print("Byte @2: %02x" % ROM[2])
    print(
        "Byte @3: %02x (Flash size: %s Flash freq: %s)"
        % (ROM[3], SZ_MAP.get(ROM[3] >> 4, "?"), FREQ_MAP.get(ROM[3] & 0xF))
    )

            

Reported by Pylint.

ports/esp32/modules/inisetup.py
9 issues
Unable to import 'uos'
Error

Line: 1 Column: 1

              import uos
from flashbdev import bdev


def check_bootsec():
    buf = bytearray(bdev.ioctl(5, 0))  # 5 is SEC_SIZE
    bdev.readblocks(0, buf)
    empty = True
    for b in buf:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import uos
from flashbdev import bdev


def check_bootsec():
    buf = bytearray(bdev.ioctl(5, 0))  # 5 is SEC_SIZE
    bdev.readblocks(0, buf)
    empty = True
    for b in buf:

            

Reported by Pylint.

Either all return statements in a function should return an expression, or none of them should.
Error

Line: 5 Column: 1

              from flashbdev import bdev


def check_bootsec():
    buf = bytearray(bdev.ioctl(5, 0))  # 5 is SEC_SIZE
    bdev.readblocks(0, buf)
    empty = True
    for b in buf:
        if b != 0xFF:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 1

              from flashbdev import bdev


def check_bootsec():
    buf = bytearray(bdev.ioctl(5, 0))  # 5 is SEC_SIZE
    bdev.readblocks(0, buf)
    empty = True
    for b in buf:
        if b != 0xFF:

            

Reported by Pylint.

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

Line: 9 Column: 9

                  buf = bytearray(bdev.ioctl(5, 0))  # 5 is SEC_SIZE
    bdev.readblocks(0, buf)
    empty = True
    for b in buf:
        if b != 0xFF:
            empty = False
            break
    if empty:
        return True

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 1

                  fs_corrupted()


def fs_corrupted():
    import time

    while 1:
        print(
            """\

            

Reported by Pylint.

Import outside toplevel (time)
Error

Line: 19 Column: 5

              

def fs_corrupted():
    import time

    while 1:
        print(
            """\
The filesystem appears to be corrupted. If you had important data there, you

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 33 Column: 1

                      time.sleep(3)


def setup():
    check_bootsec()
    print("Performing initial setup")
    uos.VfsLfs2.mkfs(bdev)
    vfs = uos.VfsLfs2(bdev)
    uos.mount(vfs, "/")

            

Reported by Pylint.

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

Line: 39 Column: 34

                  uos.VfsLfs2.mkfs(bdev)
    vfs = uos.VfsLfs2(bdev)
    uos.mount(vfs, "/")
    with open("boot.py", "w") as f:
        f.write(
            """\
# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)

            

Reported by Pylint.

tests/basics/fun_error.py
9 issues
No value for argument 'y' in function call
Error

Line: 42 Column: 5

              # kw given for positional, but a different positional is missing
try:
    def f(x, y): pass
    f(x=1)
except TypeError:
    print('TypeError')

            

Reported by Pylint.

Unused argument 'x'
Error

Line: 41 Column: 11

              
# kw given for positional, but a different positional is missing
try:
    def f(x, y): pass
    f(x=1)
except TypeError:
    print('TypeError')

            

Reported by Pylint.

Unused argument 'y'
Error

Line: 41 Column: 14

              
# kw given for positional, but a different positional is missing
try:
    def f(x, y): pass
    f(x=1)
except TypeError:
    print('TypeError')

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test errors from bad function calls

# function doesn't take keyword args
try:
    [].append(x=1)
except TypeError:
    print('TypeError')

# function with variable number of positional args given too few

            

Reported by Pylint.

More than one statement on a single line
Error

Line: 41 Column: 18

              
# kw given for positional, but a different positional is missing
try:
    def f(x, y): pass
    f(x=1)
except TypeError:
    print('TypeError')

            

Reported by Pylint.

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

Line: 41 Column: 5

              
# kw given for positional, but a different positional is missing
try:
    def f(x, y): pass
    f(x=1)
except TypeError:
    print('TypeError')

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 41 Column: 5

              
# kw given for positional, but a different positional is missing
try:
    def f(x, y): pass
    f(x=1)
except TypeError:
    print('TypeError')

            

Reported by Pylint.

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

Line: 41 Column: 5

              
# kw given for positional, but a different positional is missing
try:
    def f(x, y): pass
    f(x=1)
except TypeError:
    print('TypeError')

            

Reported by Pylint.

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

Line: 41 Column: 5

              
# kw given for positional, but a different positional is missing
try:
    def f(x, y): pass
    f(x=1)
except TypeError:
    print('TypeError')

            

Reported by Pylint.

tests/thread/thread_exc1.py
9 issues
Undefined variable 'n_finished'
Error

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.

Using the global statement
Error

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.

Missing module docstring
Error

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.

Black listed name "foo"
Error

Line: 8 Column: 1

              import _thread


def foo():
    raise ValueError


def thread_entry():
    try:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

              import _thread


def foo():
    raise ValueError


def thread_entry():
    try:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 1

                  raise ValueError


def thread_entry():
    try:
        foo()
    except ValueError:
        pass
    with lock:

            

Reported by Pylint.

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

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.

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

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.

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

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/basics/try3.py
9 issues
Undefined variable 'foo'
Error

Line: 5 Column: 9

              
def f():
    try:
        foo()
    except:
        print("except 1")
        try:
            baz()
        except:

            

Reported by Pylint.

Undefined variable 'baz'
Error

Line: 9 Column: 13

                  except:
        print("except 1")
        try:
            baz()
        except:
            print("except 2")
        bar()

try:

            

Reported by Pylint.

Undefined variable 'bar'
Error

Line: 12 Column: 9

                          baz()
        except:
            print("except 2")
        bar()

try:
    f()
except:
    print("f except")

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 6 Column: 5

              def f():
    try:
        foo()
    except:
        print("except 1")
        try:
            baz()
        except:
            print("except 2")

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 10 Column: 9

                      print("except 1")
        try:
            baz()
        except:
            print("except 2")
        bar()

try:
    f()

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 16 Column: 1

              
try:
    f()
except:
    print("f except")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # nested exceptions

def f():
    try:
        foo()
    except:
        print("except 1")
        try:
            baz()

            

Reported by Pylint.

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

Line: 3 Column: 1

              # nested exceptions

def f():
    try:
        foo()
    except:
        print("except 1")
        try:
            baz()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 3 Column: 1

              # nested exceptions

def f():
    try:
        foo()
    except:
        print("except 1")
        try:
            baz()

            

Reported by Pylint.

ports/esp32/boards/manifest.py
9 issues
Undefined variable 'freeze'
Error

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.

Undefined variable 'freeze'
Error

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.

Undefined variable 'freeze'
Error

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.

Undefined variable 'freeze'
Error

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.

Undefined variable 'freeze'
Error

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.

Undefined variable 'include'
Error

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.

Undefined variable 'include'
Error

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.

Undefined variable 'include'
Error

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.

Missing module docstring
Error

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
Catching too general exception Exception
Error

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.

Catching too general exception Exception
Error

Line: 13 Column: 8

              
try:
    raise AssertionError
except Exception:
    print("Caught AssertionError via Exception")

try:
    raise AssertionError
except AssertionError:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 23 Column: 8

              
try:
    raise AttributeError
except Exception:
    print("Caught AttributeError via Exception")

try:
    raise AttributeError
except AttributeError:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 33 Column: 8

              
try:
    raise EOFError
except Exception:
    print("Caught EOFError via Exception")

try:
    raise EOFError
except EOFError:

            

Reported by Pylint.

Catching too general exception BaseException
Error

Line: 43 Column: 8

              
try:
    raise Exception
except BaseException:
    print("Caught Exception via BaseException")

try:
    raise Exception
except Exception:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 48 Column: 8

              
try:
    raise Exception
except Exception:
    print("Caught Exception")

try:
    raise ImportError
except Exception:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 53 Column: 8

              
try:
    raise ImportError
except Exception:
    print("Caught ImportError via Exception")

try:
    raise ImportError
except ImportError:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 93 Column: 8

              
try:
    raise LookupError
except Exception:
    print("Caught LookupError via Exception")

try:
    raise LookupError
except LookupError:

            

Reported by Pylint.

Missing module docstring
Error

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/micropython/opt_level.py
9 issues
Unable to import 'micropython'
Error

Line: 1 Column: 1

              import micropython as micropython

# check we can get and set the level
micropython.opt_level(0)
print(micropython.opt_level())
micropython.opt_level(1)
print(micropython.opt_level())

# check that the optimisation levels actually differ

            

Reported by Pylint.

Use of exec detected.
Security

Line: 11
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html

              
# check that the optimisation levels actually differ
micropython.opt_level(0)
exec("print(__debug__)")
micropython.opt_level(1)
exec("print(__debug__)")
exec("assert 0")

            

Reported by Bandit.

Use of exec
Error

Line: 11 Column: 1

              
# check that the optimisation levels actually differ
micropython.opt_level(0)
exec("print(__debug__)")
micropython.opt_level(1)
exec("print(__debug__)")
exec("assert 0")

            

Reported by Pylint.

Use of exec detected.
Security

Line: 13
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html

              micropython.opt_level(0)
exec("print(__debug__)")
micropython.opt_level(1)
exec("print(__debug__)")
exec("assert 0")

            

Reported by Bandit.

Use of exec
Error

Line: 13 Column: 1

              micropython.opt_level(0)
exec("print(__debug__)")
micropython.opt_level(1)
exec("print(__debug__)")
exec("assert 0")

            

Reported by Pylint.

Use of exec detected.
Security

Line: 14
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html

              exec("print(__debug__)")
micropython.opt_level(1)
exec("print(__debug__)")
exec("assert 0")

            

Reported by Bandit.

Use of exec
Error

Line: 14 Column: 1

              exec("print(__debug__)")
micropython.opt_level(1)
exec("print(__debug__)")
exec("assert 0")

            

Reported by Pylint.

Import alias does not rename original package
Error

Line: 1 Column: 1

              import micropython as micropython

# check we can get and set the level
micropython.opt_level(0)
print(micropython.opt_level())
micropython.opt_level(1)
print(micropython.opt_level())

# check that the optimisation levels actually differ

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import micropython as micropython

# check we can get and set the level
micropython.opt_level(0)
print(micropython.opt_level())
micropython.opt_level(1)
print(micropython.opt_level())

# check that the optimisation levels actually differ

            

Reported by Pylint.