The following issues were found

tests/internal_bench/var-6-instance-attr.py
7 issues
Unused argument 'num'
Error

Line: 9 Column: 10

                      self.num = 20000000


def test(num):
    o = Foo()
    i = 0
    while i < o.num:
        i += 1


            

Reported by Pylint.

Module name "var-6-instance-attr" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              import bench


class Foo:
    def __init__(self):
        self.num = 20000000


def test(num):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import bench


class Foo:
    def __init__(self):
        self.num = 20000000


def test(num):

            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              import bench


class Foo:
    def __init__(self):
        self.num = 20000000


def test(num):

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 4 Column: 1

              import bench


class Foo:
    def __init__(self):
        self.num = 20000000


def test(num):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 9 Column: 1

                      self.num = 20000000


def test(num):
    o = Foo()
    i = 0
    while i < o.num:
        i += 1


            

Reported by Pylint.

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

Line: 10 Column: 5

              

def test(num):
    o = Foo()
    i = 0
    while i < o.num:
        i += 1



            

Reported by Pylint.

tests/basics/subclass_native_containment.py
7 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test containment operator on subclass of a native type

class mylist(list):
    pass

class mydict(dict):
    pass

class mybytes(bytes):

            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              # test containment operator on subclass of a native type

class mylist(list):
    pass

class mydict(dict):
    pass

class mybytes(bytes):

            

Reported by Pylint.

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

Line: 3 Column: 1

              # test containment operator on subclass of a native type

class mylist(list):
    pass

class mydict(dict):
    pass

class mybytes(bytes):

            

Reported by Pylint.

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

Line: 6 Column: 1

              class mylist(list):
    pass

class mydict(dict):
    pass

class mybytes(bytes):
    pass


            

Reported by Pylint.

Missing class docstring
Error

Line: 6 Column: 1

              class mylist(list):
    pass

class mydict(dict):
    pass

class mybytes(bytes):
    pass


            

Reported by Pylint.

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

Line: 9 Column: 1

              class mydict(dict):
    pass

class mybytes(bytes):
    pass

l = mylist([1, 2, 3])
print(0 in l)
print(1 in l)

            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

              class mydict(dict):
    pass

class mybytes(bytes):
    pass

l = mylist([1, 2, 3])
print(0 in l)
print(1 in l)

            

Reported by Pylint.

tests/internal_bench/var-6.1-instance-attr-5.py
7 issues
Unused argument 'num'
Error

Line: 13 Column: 10

                      self.num = 20000000


def test(num):
    o = Foo()
    i = 0
    while i < o.num:
        i += 1


            

Reported by Pylint.

Module name "1-instance-attr-5" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              import bench


class Foo:
    def __init__(self):
        self.num1 = 0
        self.num2 = 0
        self.num3 = 0
        self.num4 = 0

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import bench


class Foo:
    def __init__(self):
        self.num1 = 0
        self.num2 = 0
        self.num3 = 0
        self.num4 = 0

            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              import bench


class Foo:
    def __init__(self):
        self.num1 = 0
        self.num2 = 0
        self.num3 = 0
        self.num4 = 0

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 4 Column: 1

              import bench


class Foo:
    def __init__(self):
        self.num1 = 0
        self.num2 = 0
        self.num3 = 0
        self.num4 = 0

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                      self.num = 20000000


def test(num):
    o = Foo()
    i = 0
    while i < o.num:
        i += 1


            

Reported by Pylint.

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

Line: 14 Column: 5

              

def test(num):
    o = Foo()
    i = 0
    while i < o.num:
        i += 1



            

Reported by Pylint.

drivers/neopixel/neopixel.py
7 issues
Unable to import 'micropython'
Error

Line: 4 Column: 1

              # NeoPixel driver for MicroPython
# MIT license; Copyright (c) 2016 Damien P. George, 2021 Jim Mussared

from micropython import const
from machine import bitstream

_BITSTREAM_TYPE_HIGH_LOW = const(0)
_TIMING_WS2818_800 = (400, 850, 800, 450)
_TIMING_WS2818_400 = (800, 1700, 1600, 900)

            

Reported by Pylint.

Unable to import 'machine'
Error

Line: 5 Column: 1

              # MIT license; Copyright (c) 2016 Damien P. George, 2021 Jim Mussared

from micropython import const
from machine import bitstream

_BITSTREAM_TYPE_HIGH_LOW = const(0)
_TIMING_WS2818_800 = (400, 850, 800, 450)
_TIMING_WS2818_400 = (800, 1700, 1600, 900)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # NeoPixel driver for MicroPython
# MIT license; Copyright (c) 2016 Damien P. George, 2021 Jim Mussared

from micropython import const
from machine import bitstream

_BITSTREAM_TYPE_HIGH_LOW = const(0)
_TIMING_WS2818_800 = (400, 850, 800, 450)
_TIMING_WS2818_400 = (800, 1700, 1600, 900)

            

Reported by Pylint.

Missing class docstring
Error

Line: 12 Column: 1

              _TIMING_WS2818_400 = (800, 1700, 1600, 900)


class NeoPixel:
    ORDER = (1, 0, 2, 3)

    def __init__(self, pin, n, bpp=3, timing=1):
        self.pin = pin
        self.n = n

            

Reported by Pylint.

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

Line: 17 Column: 9

              
    def __init__(self, pin, n, bpp=3, timing=1):
        self.pin = pin
        self.n = n
        self.bpp = bpp
        self.buf = bytearray(n * bpp)
        self.pin.init(pin.OUT)
        self.timing = (
            (_TIMING_WS2818_800 if timing else _TIMING_WS2818_400)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 39 Column: 5

                      offset = index * self.bpp
        return tuple(self.buf[offset + self.ORDER[i]] for i in range(self.bpp))

    def fill(self, color):
        for i in range(self.n):
            self[i] = color

    def write(self):
        bitstream(self.pin, _BITSTREAM_TYPE_HIGH_LOW, self.timing, self.buf)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 43 Column: 5

                      for i in range(self.n):
            self[i] = color

    def write(self):
        bitstream(self.pin, _BITSTREAM_TYPE_HIGH_LOW, self.timing, self.buf)

            

Reported by Pylint.

tests/basics/builtin_reversed.py
7 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 6 Column: 5

                  reversed
except:
    print("SKIP")
    raise SystemExit

# list
print(list(reversed([])))
print(list(reversed([1])))
print(list(reversed([1, 2, 3])))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test the builtin reverse() function
try:
    reversed
except:
    print("SKIP")
    raise SystemExit

# list
print(list(reversed([])))

            

Reported by Pylint.

Missing class docstring
Error

Line: 30 Column: 1

                  print(i)

# user object
class A:
    def __init__(self):
        pass
    def __len__(self):
        return 3
    def __getitem__(self, pos):

            

Reported by Pylint.

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

Line: 30 Column: 1

                  print(i)

# user object
class A:
    def __init__(self):
        pass
    def __len__(self):
        return 3
    def __getitem__(self, pos):

            

Reported by Pylint.

Missing class docstring
Error

Line: 41 Column: 1

                  print(a)

# user object with __reversed__
class B:
    def __reversed__(self):
        return [1, 2, 3]
print(reversed(B()))

            

Reported by Pylint.

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

Line: 41 Column: 1

                  print(a)

# user object with __reversed__
class B:
    def __reversed__(self):
        return [1, 2, 3]
print(reversed(B()))

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 41 Column: 1

                  print(a)

# user object with __reversed__
class B:
    def __reversed__(self):
        return [1, 2, 3]
print(reversed(B()))

            

Reported by Pylint.

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

Line: 10 Column: 9

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


async def task():
    print("task start")
    global_task.cancel()

            

Reported by Pylint.

Global variable 'global_task' undefined at the module level
Error

Line: 19 Column: 5

              

async def main():
    global global_task
    global_task = asyncio.create_task(task())
    try:
        await global_task
    except asyncio.CancelledError:
        print("main cancel")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test a task cancelling itself (currently unsupported)

try:
    import uasyncio as asyncio
except ImportError:
    try:
        import asyncio
    except ImportError:
        print("SKIP")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                      raise SystemExit


async def task():
    print("task start")
    global_task.cancel()


async def main():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 1

                  global_task.cancel()


async def main():
    global global_task
    global_task = asyncio.create_task(task())
    try:
        await global_task
    except asyncio.CancelledError:

            

Reported by Pylint.

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

Line: 19 Column: 5

              

async def main():
    global global_task
    global_task = asyncio.create_task(task())
    try:
        await global_task
    except asyncio.CancelledError:
        print("main cancel")

            

Reported by Pylint.

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

Line: 30 Column: 1

              
try:
    asyncio.run(main())
except RuntimeError as er:
    print(er)

            

Reported by Pylint.

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

Line: 5 Column: 5

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


def printbuf():
    print("--8<--")
    for y in range(h):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    import framebuf
except ImportError:
    print("SKIP")
    raise SystemExit


def printbuf():
    print("--8<--")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

                  raise SystemExit


def printbuf():
    print("--8<--")
    for y in range(h):
        for x in range(w):
            print("%02x" % buf[(x + y * w)], end="")
        print()

            

Reported by Pylint.

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

Line: 10 Column: 9

              
def printbuf():
    print("--8<--")
    for y in range(h):
        for x in range(w):
            print("%02x" % buf[(x + y * w)], end="")
        print()
    print("-->8--")


            

Reported by Pylint.

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

Line: 11 Column: 13

              def printbuf():
    print("--8<--")
    for y in range(h):
        for x in range(w):
            print("%02x" % buf[(x + y * w)], end="")
        print()
    print("-->8--")



            

Reported by Pylint.

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

Line: 17 Column: 1

                  print("-->8--")


w = 8
h = 5
buf = bytearray(w * h)
fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS8)

# fill

            

Reported by Pylint.

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

Line: 18 Column: 1

              

w = 8
h = 5
buf = bytearray(w * h)
fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS8)

# fill
fbuf.fill(0x55)

            

Reported by Pylint.

tests/basics/memoryview_gc.py
7 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 6 Column: 5

                  memoryview
except:
    print("SKIP")
    raise SystemExit

b = bytearray(10)
m = memoryview(b)[1:]
for i in range(len(m)):
    m[i] = i

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 20 Column: 5

              
# allocate lots of memory
for i in range(100000):
    [42, 42, 42, 42]

# check that the memoryview is still what we want
print(list(m))

# check that creating a memoryview of a memoryview retains the underlying data

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test memoryview retains pointer to original object/buffer
try:
    memoryview
except:
    print("SKIP")
    raise SystemExit

b = bytearray(10)
m = memoryview(b)[1:]

            

Reported by Pylint.

Consider using enumerate instead of iterating with range and len
Error

Line: 10 Column: 1

              
b = bytearray(10)
m = memoryview(b)[1:]
for i in range(len(m)):
    m[i] = i

# reclaim b, but hopefully not the buffer
b = None
import gc

            

Reported by Pylint.

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

Line: 14 Column: 1

                  m[i] = i

# reclaim b, but hopefully not the buffer
b = None
import gc
gc.collect()

# allocate lots of memory
for i in range(100000):

            

Reported by Pylint.

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

Line: 15 Column: 1

              
# reclaim b, but hopefully not the buffer
b = None
import gc
gc.collect()

# allocate lots of memory
for i in range(100000):
    [42, 42, 42, 42]

            

Reported by Pylint.

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

Line: 26 Column: 1

              print(list(m))

# check that creating a memoryview of a memoryview retains the underlying data
m = None
gc.collect()  # cleanup from previous test
m = memoryview(memoryview(bytearray(i for i in range(50)))[5:-5])
print(sum(m), list(m[:10]))
gc.collect()
for i in range(10):

            

Reported by Pylint.

tests/internal_bench/from_iter-7-bytearray_bound.py
7 issues
Unused variable 'i'
Error

Line: 5 Column: 9

              

def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(l)


bench.run(test)

            

Reported by Pylint.

Unused variable 'l2'
Error

Line: 7 Column: 9

              def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(l)


bench.run(test)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import bench


def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(l)



            

Reported by Pylint.

Module name "from_iter-7-bytearray_bound" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              import bench


def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(l)



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 4 Column: 1

              import bench


def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(l)



            

Reported by Pylint.

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

Line: 6 Column: 9

              
def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(l)


bench.run(test)

            

Reported by Pylint.

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

Line: 7 Column: 9

              def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(l)


bench.run(test)

            

Reported by Pylint.

tests/internal_bench/from_iter-8-bytearray_unbound.py
7 issues
Unused variable 'i'
Error

Line: 5 Column: 9

              

def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(map(lambda x: x, l))


bench.run(test)

            

Reported by Pylint.

Unused variable 'l2'
Error

Line: 7 Column: 9

              def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(map(lambda x: x, l))


bench.run(test)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import bench


def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(map(lambda x: x, l))



            

Reported by Pylint.

Module name "from_iter-8-bytearray_unbound" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              import bench


def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(map(lambda x: x, l))



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 4 Column: 1

              import bench


def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(map(lambda x: x, l))



            

Reported by Pylint.

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

Line: 6 Column: 9

              
def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(map(lambda x: x, l))


bench.run(test)

            

Reported by Pylint.

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

Line: 7 Column: 9

              def test(num):
    for i in iter(range(num // 10000)):
        l = [0] * 1000
        l2 = bytearray(map(lambda x: x, l))


bench.run(test)

            

Reported by Pylint.