The following issues were found

tests/basics/builtin_exec.py
26 issues
Using variable 'foo' before assignment
Error

Line: 10 Column: 7

                  raise SystemExit

print(exec("def foo(): return 42"))
print(foo())

d = {}
exec("def bar(): return 84", d)
print(d["bar"]())


            

Reported by Pylint.

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

Line: 7 Column: 5

                  exec
except NameError:
    print("SKIP")
    raise SystemExit

print(exec("def foo(): return 42"))
print(foo())

d = {}

            

Reported by Pylint.

Use of exec detected.
Security

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

                  print("SKIP")
    raise SystemExit

print(exec("def foo(): return 42"))
print(foo())

d = {}
exec("def bar(): return 84", d)
print(d["bar"]())

            

Reported by Bandit.

Use of exec
Error

Line: 9 Column: 7

                  print("SKIP")
    raise SystemExit

print(exec("def foo(): return 42"))
print(foo())

d = {}
exec("def bar(): return 84", d)
print(d["bar"]())

            

Reported by Pylint.

Use of exec
Error

Line: 13 Column: 1

              print(foo())

d = {}
exec("def bar(): return 84", d)
print(d["bar"]())

# passing None/dict as args to globals/locals
foo = 11
exec('print(foo)')

            

Reported by Pylint.

Use of exec detected.
Security

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

              print(foo())

d = {}
exec("def bar(): return 84", d)
print(d["bar"]())

# passing None/dict as args to globals/locals
foo = 11
exec('print(foo)')

            

Reported by Bandit.

Use of exec detected.
Security

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

              
# passing None/dict as args to globals/locals
foo = 11
exec('print(foo)')
exec('print(foo)', None)
exec('print(foo)', {'foo':3}, None)
exec('print(foo)', None, {'foo':3})
exec('print(foo)', None, {'bar':3})
exec('print(foo)', {'bar':3}, locals())

            

Reported by Bandit.

Use of exec
Error

Line: 18 Column: 1

              
# passing None/dict as args to globals/locals
foo = 11
exec('print(foo)')
exec('print(foo)', None)
exec('print(foo)', {'foo':3}, None)
exec('print(foo)', None, {'foo':3})
exec('print(foo)', None, {'bar':3})
exec('print(foo)', {'bar':3}, locals())

            

Reported by Pylint.

Use of exec detected.
Security

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

              # passing None/dict as args to globals/locals
foo = 11
exec('print(foo)')
exec('print(foo)', None)
exec('print(foo)', {'foo':3}, None)
exec('print(foo)', None, {'foo':3})
exec('print(foo)', None, {'bar':3})
exec('print(foo)', {'bar':3}, locals())


            

Reported by Bandit.

Use of exec
Error

Line: 19 Column: 1

              # passing None/dict as args to globals/locals
foo = 11
exec('print(foo)')
exec('print(foo)', None)
exec('print(foo)', {'foo':3}, None)
exec('print(foo)', None, {'foo':3})
exec('print(foo)', None, {'bar':3})
exec('print(foo)', {'bar':3}, locals())


            

Reported by Pylint.

tests/unicode/unicode_id.py
26 issues
function already defined line 7
Error

Line: 14 Column: 1

              print(α, αβγ, bβ, βb)

# function, argument, local identifiers
def α(β, γ):
    δ = β + γ
    print(β, γ, δ)


α(1, 2)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test unicode in identifiers

# comment
# αβγδϵφζ

# global identifiers
α = 1
αβγ = 2
bβ = 3

            

Reported by Pylint.

Constant name "α" contains a non-ASCII unicode character
Error

Line: 7 Column: 1

              # αβγδϵφζ

# global identifiers
α = 1
αβγ = 2
bβ = 3
βb = 4
print(α, αβγ, bβ, βb)


            

Reported by Pylint.

Constant name "αβγ" contains a non-ASCII unicode character
Error

Line: 8 Column: 1

              
# global identifiers
α = 1
αβγ = 2
bβ = 3
βb = 4
print(α, αβγ, bβ, βb)

# function, argument, local identifiers

            

Reported by Pylint.

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

Line: 9 Column: 1

              # global identifiers
α = 1
αβγ = 2
bβ = 3
βb = 4
print(α, αβγ, bβ, βb)

# function, argument, local identifiers
def α(β, γ):

            

Reported by Pylint.

Constant name "βb" contains a non-ASCII unicode character
Error

Line: 10 Column: 1

              α = 1
αβγ = 2
bβ = 3
βb = 4
print(α, αβγ, bβ, βb)

# function, argument, local identifiers
def α(β, γ):
    δ = β + γ

            

Reported by Pylint.

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

Line: 10 Column: 1

              α = 1
αβγ = 2
bβ = 3
βb = 4
print(α, αβγ, bβ, βb)

# function, argument, local identifiers
def α(β, γ):
    δ = β + γ

            

Reported by Pylint.

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

Line: 14 Column: 1

              print(α, αβγ, bβ, βb)

# function, argument, local identifiers
def α(β, γ):
    δ = β + γ
    print(β, γ, δ)


α(1, 2)

            

Reported by Pylint.

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

Line: 14 Column: 1

              print(α, αβγ, bβ, βb)

# function, argument, local identifiers
def α(β, γ):
    δ = β + γ
    print(β, γ, δ)


α(1, 2)

            

Reported by Pylint.

Argument name "β" contains a non-ASCII unicode character
Error

Line: 14 Column: 1

              print(α, αβγ, bβ, βb)

# function, argument, local identifiers
def α(β, γ):
    δ = β + γ
    print(β, γ, δ)


α(1, 2)

            

Reported by Pylint.

tests/run-natmodtests.py
25 issues
Unable to import 'pyboard'
Error

Line: 13 Column: 1

              import argparse

sys.path.append("../tools")
import pyboard

# Paths for host executables
CPYTHON3 = os.getenv("MICROPY_CPYTHON3", "python3")
MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", "../ports/unix/micropython-coverage")


            

Reported by Pylint.

Using subprocess.run without explicitly set `check` is not recommended.
Error

Line: 70 Column: 17

              
    def run_script(self, script):
        try:
            p = subprocess.run(
                self.cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, input=script
            )
            return p.stdout, None
        except subprocess.CalledProcessError as er:
            return b"", er

            

Reported by Pylint.

Module name "run-natmodtests" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #!/usr/bin/env python3

# This file is part of the MicroPython project, http://micropython.org/
# The MIT License (MIT)
# Copyright (c) 2019 Damien P. George

import os
import subprocess
import sys

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python3

# This file is part of the MicroPython project, http://micropython.org/
# The MIT License (MIT)
# Copyright (c) 2019 Damien P. George

import os
import subprocess
import sys

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

Line: 8
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              # Copyright (c) 2019 Damien P. George

import os
import subprocess
import sys
import argparse

sys.path.append("../tools")
import pyboard

            

Reported by Bandit.

Import "import pyboard" should be placed at the top of the module
Error

Line: 13 Column: 1

              import argparse

sys.path.append("../tools")
import pyboard

# Paths for host executables
CPYTHON3 = os.getenv("MICROPY_CPYTHON3", "python3")
MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", "../ports/unix/micropython-coverage")


            

Reported by Pylint.

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

Line: 32 Column: 1

              }

# Code to allow a target MicroPython to import an .mpy from RAM
injected_import_hook_code = """\
import usys, uos, uio
class __File(uio.IOBase):
  def __init__(self):
    self.off = 0
  def ioctl(self, request, arg):

            

Reported by Pylint.

Missing class docstring
Error

Line: 61 Column: 1

              """


class TargetSubprocess:
    def __init__(self, cmd):
        self.cmd = cmd

    def close(self):
        pass

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 65 Column: 5

                  def __init__(self, cmd):
        self.cmd = cmd

    def close(self):
        pass

    def run_script(self, script):
        try:
            p = subprocess.run(

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 68 Column: 5

                  def close(self):
        pass

    def run_script(self, script):
        try:
            p = subprocess.run(
                self.cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, input=script
            )
            return p.stdout, None

            

Reported by Pylint.

examples/rp2/pio_1hz.py
25 issues
Unable to import 'machine'
Error

Line: 4 Column: 1

              # Example using PIO to blink an LED and raise an IRQ at 1Hz.

import time
from machine import Pin
import rp2


@rp2.asm_pio(set_init=rp2.PIO.OUT_LOW)
def blink_1hz():

            

Reported by Pylint.

Unable to import 'rp2'
Error

Line: 5 Column: 1

              
import time
from machine import Pin
import rp2


@rp2.asm_pio(set_init=rp2.PIO.OUT_LOW)
def blink_1hz():
    # fmt: off

            

Reported by Pylint.

Undefined variable 'rel'
Error

Line: 12 Column: 9

              def blink_1hz():
    # fmt: off
    # Cycles: 1 + 1 + 6 + 32 * (30 + 1) = 1000
    irq(rel(0))
    set(pins, 1)
    set(x, 31)                  [5]
    label("delay_high")
    nop()                       [29]
    jmp(x_dec, "delay_high")

            

Reported by Pylint.

Undefined variable 'irq'
Error

Line: 12 Column: 5

              def blink_1hz():
    # fmt: off
    # Cycles: 1 + 1 + 6 + 32 * (30 + 1) = 1000
    irq(rel(0))
    set(pins, 1)
    set(x, 31)                  [5]
    label("delay_high")
    nop()                       [29]
    jmp(x_dec, "delay_high")

            

Reported by Pylint.

Undefined variable 'pins'
Error

Line: 13 Column: 9

                  # fmt: off
    # Cycles: 1 + 1 + 6 + 32 * (30 + 1) = 1000
    irq(rel(0))
    set(pins, 1)
    set(x, 31)                  [5]
    label("delay_high")
    nop()                       [29]
    jmp(x_dec, "delay_high")


            

Reported by Pylint.

Value 'set(x, 31)' is unsubscriptable
Error

Line: 14 Column: 5

                  # Cycles: 1 + 1 + 6 + 32 * (30 + 1) = 1000
    irq(rel(0))
    set(pins, 1)
    set(x, 31)                  [5]
    label("delay_high")
    nop()                       [29]
    jmp(x_dec, "delay_high")

    # Cycles: 1 + 7 + 32 * (30 + 1) = 1000

            

Reported by Pylint.

Undefined variable 'x'
Error

Line: 14 Column: 9

                  # Cycles: 1 + 1 + 6 + 32 * (30 + 1) = 1000
    irq(rel(0))
    set(pins, 1)
    set(x, 31)                  [5]
    label("delay_high")
    nop()                       [29]
    jmp(x_dec, "delay_high")

    # Cycles: 1 + 7 + 32 * (30 + 1) = 1000

            

Reported by Pylint.

Undefined variable 'label'
Error

Line: 15 Column: 5

                  irq(rel(0))
    set(pins, 1)
    set(x, 31)                  [5]
    label("delay_high")
    nop()                       [29]
    jmp(x_dec, "delay_high")

    # Cycles: 1 + 7 + 32 * (30 + 1) = 1000
    set(pins, 0)

            

Reported by Pylint.

Undefined variable 'nop'
Error

Line: 16 Column: 5

                  set(pins, 1)
    set(x, 31)                  [5]
    label("delay_high")
    nop()                       [29]
    jmp(x_dec, "delay_high")

    # Cycles: 1 + 7 + 32 * (30 + 1) = 1000
    set(pins, 0)
    set(x, 31)                  [6]

            

Reported by Pylint.

Undefined variable 'jmp'
Error

Line: 17 Column: 5

                  set(x, 31)                  [5]
    label("delay_high")
    nop()                       [29]
    jmp(x_dec, "delay_high")

    # Cycles: 1 + 7 + 32 * (30 + 1) = 1000
    set(pins, 0)
    set(x, 31)                  [6]
    label("delay_low")

            

Reported by Pylint.

tests/extmod/vfs_basic.py
25 issues
Statement seems to have no effect
Error

Line: 6 Column: 5

              try:
    import uos

    uos.mount
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit



            

Reported by Pylint.

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

Line: 9 Column: 5

                  uos.mount
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


class Filesystem:
    def __init__(self, id, fail=0):
        self.id = id

            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 13 Column: 24

              

class Filesystem:
    def __init__(self, id, fail=0):
        self.id = id
        self.fail = fail

    def mount(self, readonly, mkfs):
        print(self.id, "mount", readonly, mkfs)

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 23 Column: 24

                  def umount(self):
        print(self.id, "umount")

    def ilistdir(self, dir):
        print(self.id, "ilistdir", dir)
        return iter([("a%d" % self.id, 0, 0)])

    def chdir(self, dir):
        print(self.id, "chdir", dir)

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 27 Column: 21

                      print(self.id, "ilistdir", dir)
        return iter([("a%d" % self.id, 0, 0)])

    def chdir(self, dir):
        print(self.id, "chdir", dir)
        if self.fail:
            raise OSError(self.fail)

    def getcwd(self):

            

Reported by Pylint.

Redefining name 'path' from outer scope (line 65)
Error

Line: 36 Column: 21

                      print(self.id, "getcwd")
        return "dir%d" % self.id

    def mkdir(self, path):
        print(self.id, "mkdir", path)

    def remove(self, path):
        print(self.id, "remove", path)


            

Reported by Pylint.

Redefining name 'path' from outer scope (line 65)
Error

Line: 39 Column: 22

                  def mkdir(self, path):
        print(self.id, "mkdir", path)

    def remove(self, path):
        print(self.id, "remove", path)

    def rename(self, old_path, new_path):
        print(self.id, "rename", old_path, new_path)


            

Reported by Pylint.

Redefining name 'path' from outer scope (line 65)
Error

Line: 45 Column: 21

                  def rename(self, old_path, new_path):
        print(self.id, "rename", old_path, new_path)

    def rmdir(self, path):
        print(self.id, "rmdir", path)

    def stat(self, path):
        print(self.id, "stat", path)
        return (self.id,)

            

Reported by Pylint.

Redefining name 'path' from outer scope (line 65)
Error

Line: 48 Column: 20

                  def rmdir(self, path):
        print(self.id, "rmdir", path)

    def stat(self, path):
        print(self.id, "stat", path)
        return (self.id,)

    def statvfs(self, path):
        print(self.id, "statvfs", path)

            

Reported by Pylint.

Redefining name 'path' from outer scope (line 65)
Error

Line: 52 Column: 23

                      print(self.id, "stat", path)
        return (self.id,)

    def statvfs(self, path):
        print(self.id, "statvfs", path)
        return (self.id,)

    def open(self, file, mode):
        print(self.id, "open", file, mode)

            

Reported by Pylint.

tests/micropython/import_mpy_native_gc.py
25 issues
Unable to import 'features0'
Error

Line: 74 Column: 1

              
# Import the native function.
gc.collect()
from features0 import factorial

# Free the module that contained the function.
del sys.modules["features0"]

# Run a GC cycle which should reclaim the module but not the function.

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 6 Column: 5

              try:
    import gc, sys, uio, uos

    sys.implementation.mpy
    uio.IOBase
    uos.mount
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 7 Column: 5

                  import gc, sys, uio, uos

    sys.implementation.mpy
    uio.IOBase
    uos.mount
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 8 Column: 5

              
    sys.implementation.mpy
    uio.IOBase
    uos.mount
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit



            

Reported by Pylint.

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

Line: 11 Column: 5

                  uos.mount
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


class UserFile(uio.IOBase):
    def __init__(self, data):
        self.data = memoryview(data)

            

Reported by Pylint.

Unused argument 'req'
Error

Line: 25 Column: 21

                      self.pos += n
        return n

    def ioctl(self, req, arg):
        return 0


class UserFS:
    def __init__(self, files):

            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 25 Column: 26

                      self.pos += n
        return n

    def ioctl(self, req, arg):
        return 0


class UserFS:
    def __init__(self, files):

            

Reported by Pylint.

Unused argument 'mode'
Error

Line: 44 Column: 26

                          return (32768, 0, 0, 0, 0, 0, 0, 0, 0, 0)
        raise OSError

    def open(self, path, mode):
        return UserFile(self.files[path])


# Pre-compiled examples/natmod/features0 example for various architectures, keyed
# by the required value of sys.implementation.mpy.

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 84 Column: 5

              
# Allocate lots of fragmented memory to overwrite anything that was just freed by the GC.
for i in range(1000):
    []

# Run the native function, it should not have been freed or overwritten.
print(factorial(10))

# Unmount and undo path addition.

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test that native code loaded from a .mpy file is retained after a GC.

try:
    import gc, sys, uio, uos

    sys.implementation.mpy
    uio.IOBase
    uos.mount
except (ImportError, AttributeError):

            

Reported by Pylint.

tests/inlineasm/asmshift.py
25 issues
Undefined variable 'micropython'
Error

Line: 1 Column: 2

              @micropython.asm_thumb
def lsl1(r0):
    lsl(r0, r0, 1)


print(hex(lsl1(0x123)))


@micropython.asm_thumb

            

Reported by Pylint.

Undefined variable 'lsl'
Error

Line: 3 Column: 5

              @micropython.asm_thumb
def lsl1(r0):
    lsl(r0, r0, 1)


print(hex(lsl1(0x123)))


@micropython.asm_thumb

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 9 Column: 2

              print(hex(lsl1(0x123)))


@micropython.asm_thumb
def lsl23(r0):
    lsl(r0, r0, 23)


print(hex(lsl23(1)))

            

Reported by Pylint.

Undefined variable 'lsl'
Error

Line: 11 Column: 5

              
@micropython.asm_thumb
def lsl23(r0):
    lsl(r0, r0, 23)


print(hex(lsl23(1)))



            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 17 Column: 2

              print(hex(lsl23(1)))


@micropython.asm_thumb
def lsr1(r0):
    lsr(r0, r0, 1)


print(hex(lsr1(0x123)))

            

Reported by Pylint.

Undefined variable 'lsr'
Error

Line: 19 Column: 5

              
@micropython.asm_thumb
def lsr1(r0):
    lsr(r0, r0, 1)


print(hex(lsr1(0x123)))



            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 25 Column: 2

              print(hex(lsr1(0x123)))


@micropython.asm_thumb
def lsr31(r0):
    lsr(r0, r0, 31)


print(hex(lsr31(0x80000000)))

            

Reported by Pylint.

Undefined variable 'lsr'
Error

Line: 27 Column: 5

              
@micropython.asm_thumb
def lsr31(r0):
    lsr(r0, r0, 31)


print(hex(lsr31(0x80000000)))



            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 33 Column: 2

              print(hex(lsr31(0x80000000)))


@micropython.asm_thumb
def asr1(r0):
    asr(r0, r0, 1)


print(hex(asr1(0x123)))

            

Reported by Pylint.

Undefined variable 'asr'
Error

Line: 35 Column: 5

              
@micropython.asm_thumb
def asr1(r0):
    asr(r0, r0, 1)


print(hex(asr1(0x123)))



            

Reported by Pylint.

tests/extmod/vfs_lfs_corrupt.py
25 issues
Statement seems to have no effect
Error

Line: 6 Column: 5

              try:
    import uos

    uos.VfsLfs1
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 7 Column: 5

                  import uos

    uos.VfsLfs1
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit



            

Reported by Pylint.

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

Line: 10 Column: 5

                  uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


class RAMBlockDevice:
    ERASE_BLOCK_SIZE = 1024


            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 32 Column: 25

                          self.data[addr + i] = buf[i]
        return self.ret

    def ioctl(self, op, arg):
        if op == 4:  # block count
            return len(self.data) // self.ERASE_BLOCK_SIZE
        if op == 5:  # block size
            return self.ERASE_BLOCK_SIZE
        if op == 6:  # erase block

            

Reported by Pylint.

Redefining name 'bdev' from outer scope (line 110)
Error

Line: 41 Column: 13

                          return 0


def corrupt(bdev, block):
    addr = block * bdev.ERASE_BLOCK_SIZE
    for i in range(bdev.ERASE_BLOCK_SIZE):
        bdev.data[addr + i] = i & 0xFF



            

Reported by Pylint.

Redefining name 'bdev' from outer scope (line 110)
Error

Line: 47 Column: 16

                      bdev.data[addr + i] = i & 0xFF


def create_vfs(bdev, vfs_class):
    bdev.ret = 0
    vfs_class.mkfs(bdev)
    vfs = vfs_class(bdev)
    with vfs.open("f", "w") as f:
        for i in range(100):

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 52 Column: 13

                  vfs_class.mkfs(bdev)
    vfs = vfs_class(bdev)
    with vfs.open("f", "w") as f:
        for i in range(100):
            f.write("test")
    return vfs


def test(bdev, vfs_class):

            

Reported by Pylint.

Redefining name 'bdev' from outer scope (line 110)
Error

Line: 57 Column: 10

                  return vfs


def test(bdev, vfs_class):
    print("test", vfs_class)

    # statvfs
    vfs = create_vfs(bdev, vfs_class)
    corrupt(bdev, 0)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test for VfsLittle using a RAM device, testing error handling from corrupt block device

try:
    import uos

    uos.VfsLfs1
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")

            

Reported by Pylint.

Missing class docstring
Error

Line: 13 Column: 1

                  raise SystemExit


class RAMBlockDevice:
    ERASE_BLOCK_SIZE = 1024

    def __init__(self, blocks):
        self.data = bytearray(blocks * self.ERASE_BLOCK_SIZE)
        self.ret = 0

            

Reported by Pylint.

tests/basics/builtin_dir.py
25 issues
Method has no argument
Error

Line: 25 Column: 5

              
# dir of subclass
class A:
    def a():
        pass
class B(A):
    def b():
        pass
d = dir(B())

            

Reported by Pylint.

Method has no argument
Error

Line: 28 Column: 5

                  def a():
        pass
class B(A):
    def b():
        pass
d = dir(B())
print(d.count('a'), d.count('b'))

# dir of class with multiple bases and a common parent

            

Reported by Pylint.

Method has no argument
Error

Line: 35 Column: 5

              
# dir of class with multiple bases and a common parent
class C(A):
    def c():
        pass
class D(B, C):
    def d():
        pass
d = dir(D())

            

Reported by Pylint.

Method has no argument
Error

Line: 38 Column: 5

                  def c():
        pass
class D(B, C):
    def d():
        pass
d = dir(D())
print(d.count('a'), d.count('b'), d.count('c'), d.count('d'))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test builtin dir

# dir of locals
print('__name__' in dir())

# dir of module
try:
    import usys as sys
except ImportError:

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 16 Column: 1

              # dir of type
print('append' in dir(list))

class Foo:
    def __init__(self):
        self.x = 1
foo = Foo()
print('__init__' in dir(foo))
print('x' in dir(foo))

            

Reported by Pylint.

Missing class docstring
Error

Line: 16 Column: 1

              # dir of type
print('append' in dir(list))

class Foo:
    def __init__(self):
        self.x = 1
foo = Foo()
print('__init__' in dir(foo))
print('x' in dir(foo))

            

Reported by Pylint.

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

Line: 18 Column: 9

              
class Foo:
    def __init__(self):
        self.x = 1
foo = Foo()
print('__init__' in dir(foo))
print('x' in dir(foo))

# dir of subclass

            

Reported by Pylint.

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

Line: 24 Column: 1

              print('x' in dir(foo))

# dir of subclass
class A:
    def a():
        pass
class B(A):
    def b():
        pass

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 24 Column: 1

              print('x' in dir(foo))

# dir of subclass
class A:
    def a():
        pass
class B(A):
    def b():
        pass

            

Reported by Pylint.

tests/inlineasm/asmbcc.py
25 issues
Undefined variable 'micropython'
Error

Line: 5 Column: 2

              # at the moment only tests beq, narrow and wide versions


@micropython.asm_thumb
def f(r0):
    mov(r1, r0)

    mov(r0, 10)
    cmp(r1, 1)

            

Reported by Pylint.

Undefined variable 'r1'
Error

Line: 7 Column: 9

              
@micropython.asm_thumb
def f(r0):
    mov(r1, r0)

    mov(r0, 10)
    cmp(r1, 1)
    beq(end)


            

Reported by Pylint.

Undefined variable 'mov'
Error

Line: 7 Column: 5

              
@micropython.asm_thumb
def f(r0):
    mov(r1, r0)

    mov(r0, 10)
    cmp(r1, 1)
    beq(end)


            

Reported by Pylint.

Undefined variable 'mov'
Error

Line: 9 Column: 5

              def f(r0):
    mov(r1, r0)

    mov(r0, 10)
    cmp(r1, 1)
    beq(end)

    mov(r0, 20)
    cmp(r1, 2)

            

Reported by Pylint.

Undefined variable 'r1'
Error

Line: 10 Column: 9

                  mov(r1, r0)

    mov(r0, 10)
    cmp(r1, 1)
    beq(end)

    mov(r0, 20)
    cmp(r1, 2)
    beq_n(end)

            

Reported by Pylint.

Undefined variable 'cmp'
Error

Line: 10 Column: 5

                  mov(r1, r0)

    mov(r0, 10)
    cmp(r1, 1)
    beq(end)

    mov(r0, 20)
    cmp(r1, 2)
    beq_n(end)

            

Reported by Pylint.

Undefined variable 'end'
Error

Line: 11 Column: 9

              
    mov(r0, 10)
    cmp(r1, 1)
    beq(end)

    mov(r0, 20)
    cmp(r1, 2)
    beq_n(end)


            

Reported by Pylint.

Undefined variable 'beq'
Error

Line: 11 Column: 5

              
    mov(r0, 10)
    cmp(r1, 1)
    beq(end)

    mov(r0, 20)
    cmp(r1, 2)
    beq_n(end)


            

Reported by Pylint.

Undefined variable 'mov'
Error

Line: 13 Column: 5

                  cmp(r1, 1)
    beq(end)

    mov(r0, 20)
    cmp(r1, 2)
    beq_n(end)

    mov(r0, 30)
    cmp(r1, 3)

            

Reported by Pylint.

Undefined variable 'r1'
Error

Line: 14 Column: 9

                  beq(end)

    mov(r0, 20)
    cmp(r1, 2)
    beq_n(end)

    mov(r0, 30)
    cmp(r1, 3)
    beq_w(end)

            

Reported by Pylint.