The following issues were found

tests/extmod/uheapq1.py
8 issues
Unable to import 'uheapq'
Error

Line: 2 Column: 5

              try:
    import uheapq as heapq
except:
    try:
        import heapq
    except ImportError:
        print("SKIP")
        raise SystemExit


            

Reported by Pylint.

No exception type(s) specified
Error

Line: 3 Column: 1

              try:
    import uheapq as heapq
except:
    try:
        import heapq
    except ImportError:
        print("SKIP")
        raise SystemExit


            

Reported by Pylint.

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

Line: 8 Column: 9

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

try:
    heapq.heappop([])
except IndexError:
    print("IndexError")

            

Reported by Pylint.

Redefining name 'h' from outer scope (line 28)
Error

Line: 21 Column: 19

                  print("TypeError")


def pop_and_print(h):
    l = []
    while h:
        l.append(str(heapq.heappop(h)))
    print(" ".join(l))


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    import uheapq as heapq
except:
    try:
        import heapq
    except ImportError:
        print("SKIP")
        raise SystemExit


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 1

                  print("TypeError")


def pop_and_print(h):
    l = []
    while h:
        l.append(str(heapq.heappop(h)))
    print(" ".join(l))


            

Reported by Pylint.

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

Line: 21 Column: 1

                  print("TypeError")


def pop_and_print(h):
    l = []
    while h:
        l.append(str(heapq.heappop(h)))
    print(" ".join(l))


            

Reported by Pylint.

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

Line: 22 Column: 5

              

def pop_and_print(h):
    l = []
    while h:
        l.append(str(heapq.heappop(h)))
    print(" ".join(l))



            

Reported by Pylint.

tests/basics/try_finally_return5.py
7 issues
Statement seems to have no effect
Error

Line: 11 Column: 25

                                  print(x, i)
                finally:
                    try:
                        1 / 0
                    finally:
                        return 42
            finally:
                print('return')
                return 43

            

Reported by Pylint.

return statement in finally block may swallow exception
Error

Line: 13 Column: 25

                                  try:
                        1 / 0
                    finally:
                        return 42
            finally:
                print('return')
                return 43
print(foo(4))

            

Reported by Pylint.

return statement in finally block may swallow exception
Error

Line: 16 Column: 17

                                      return 42
            finally:
                print('return')
                return 43
print(foo(4))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def foo(x):
    for i in range(x):
        try:
            pass
        finally:
            try:
                try:
                    print(x, i)
                finally:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 1 Column: 1

              def foo(x):
    for i in range(x):
        try:
            pass
        finally:
            try:
                try:
                    print(x, i)
                finally:

            

Reported by Pylint.

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

Line: 1 Column: 1

              def foo(x):
    for i in range(x):
        try:
            pass
        finally:
            try:
                try:
                    print(x, i)
                finally:

            

Reported by Pylint.

Black listed name "foo"
Error

Line: 1 Column: 1

              def foo(x):
    for i in range(x):
        try:
            pass
        finally:
            try:
                try:
                    print(x, i)
                finally:

            

Reported by Pylint.

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

Line: 1 Column: 1

              # This tests long ints for 32-bit machine

a = 0x1ffffffff
b = 0x100000000
print(a)
print(b)
print(a + b)
print(a - b)
print(b - a)

            

Reported by Pylint.

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

Line: 3 Column: 1

              # This tests long ints for 32-bit machine

a = 0x1ffffffff
b = 0x100000000
print(a)
print(b)
print(a + b)
print(a - b)
print(b - a)

            

Reported by Pylint.

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

Line: 4 Column: 1

              # This tests long ints for 32-bit machine

a = 0x1ffffffff
b = 0x100000000
print(a)
print(b)
print(a + b)
print(a - b)
print(b - a)

            

Reported by Pylint.

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

Line: 42 Column: 1

              print(a)

# Test referential integrity of long ints
a = 0x1ffffffff
b = a
a += 1
print(a)
print(b)


            

Reported by Pylint.

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

Line: 43 Column: 1

              
# Test referential integrity of long ints
a = 0x1ffffffff
b = a
a += 1
print(a)
print(b)

# Bitwise ops on 64-bit

            

Reported by Pylint.

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

Line: 50 Column: 1

              
# Bitwise ops on 64-bit

a = 0x1ffffffffffffffff
b = 0x10000000000000000
print("&", a & b)
print(a | b)
print(a ^ b)

            

Reported by Pylint.

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

Line: 51 Column: 1

              # Bitwise ops on 64-bit

a = 0x1ffffffffffffffff
b = 0x10000000000000000
print("&", a & b)
print(a | b)
print(a ^ b)

            

Reported by Pylint.

ports/mimxrt/modules/_boot.py
7 issues
Unable to import 'mimxrt'
Error

Line: 6 Column: 1

              # Note: the flash requires the programming size to be aligned to 256 bytes.

import os
import mimxrt

bdev = mimxrt.Flash()

try:
    vfs = os.VfsLfs2(bdev, progsize=256)

            

Reported by Pylint.

Module 'os' has no 'VfsLfs2' member
Error

Line: 11 Column: 11

              bdev = mimxrt.Flash()

try:
    vfs = os.VfsLfs2(bdev, progsize=256)
except:
    os.VfsLfs2.mkfs(bdev, progsize=256)
    vfs = os.VfsLfs2(bdev, progsize=256)
os.mount(vfs, "/")

            

Reported by Pylint.

Module 'os' has no 'VfsLfs2' member
Error

Line: 13 Column: 5

              try:
    vfs = os.VfsLfs2(bdev, progsize=256)
except:
    os.VfsLfs2.mkfs(bdev, progsize=256)
    vfs = os.VfsLfs2(bdev, progsize=256)
os.mount(vfs, "/")

            

Reported by Pylint.

Module 'os' has no 'VfsLfs2' member
Error

Line: 14 Column: 11

                  vfs = os.VfsLfs2(bdev, progsize=256)
except:
    os.VfsLfs2.mkfs(bdev, progsize=256)
    vfs = os.VfsLfs2(bdev, progsize=256)
os.mount(vfs, "/")

            

Reported by Pylint.

Module 'os' has no 'mount' member
Error

Line: 15 Column: 1

              except:
    os.VfsLfs2.mkfs(bdev, progsize=256)
    vfs = os.VfsLfs2(bdev, progsize=256)
os.mount(vfs, "/")

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 12 Column: 1

              
try:
    vfs = os.VfsLfs2(bdev, progsize=256)
except:
    os.VfsLfs2.mkfs(bdev, progsize=256)
    vfs = os.VfsLfs2(bdev, progsize=256)
os.mount(vfs, "/")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # _boot.py
# Try to mount the filesystem, and format the flash if it doesn't exist.
# Note: the flash requires the programming size to be aligned to 256 bytes.

import os
import mimxrt

bdev = mimxrt.Flash()


            

Reported by Pylint.

tests/micropython/heapalloc_exc_compressed_emg_exc.py
7 issues
Unable to import 'micropython'
Error

Line: 1 Column: 1

              import micropython

# Does the full test from heapalloc_exc_compressed.py but while the heap is
# locked (this can only work when the emergency exception buf is enabled).

# Some ports need to allocate heap for the emgergency exception buffer.
try:
    micropython.alloc_emergency_exception_buf(256)
except AttributeError:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import micropython

# Does the full test from heapalloc_exc_compressed.py but while the heap is
# locked (this can only work when the emergency exception buf is enabled).

# Some ports need to allocate heap for the emgergency exception buffer.
try:
    micropython.alloc_emergency_exception_buf(256)
except AttributeError:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 1

              a = set()


def test():
    micropython.heap_lock()

    try:
        name()
    except NameError as e:

            

Reported by Pylint.

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

Line: 20 Column: 5

              
    try:
        name()
    except NameError as e:
        print(type(e).__name__, e)

    try:
        a.pop()
    except KeyError as e:

            

Reported by Pylint.

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

Line: 25 Column: 5

              
    try:
        a.pop()
    except KeyError as e:
        print(type(e).__name__, e)

    try:
        name()
    except NameError as e:

            

Reported by Pylint.

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

Line: 30 Column: 5

              
    try:
        name()
    except NameError as e:
        print(e.args[0])

    try:
        a.pop()
    except KeyError as e:

            

Reported by Pylint.

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

Line: 35 Column: 5

              
    try:
        a.pop()
    except KeyError as e:
        print(e.args[0])

    micropython.heap_unlock()



            

Reported by Pylint.

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

Line: 1 Column: 1

              print(0 | (1 << 80))

a = 0xfffffffffffffffffffffffffffff
print(a | (1 << 200))

# test + + 

print(0 | (1 << 80))
print((1 << 80) | (1 << 80))

            

Reported by Pylint.

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

Line: 3 Column: 1

              print(0 | (1 << 80))

a = 0xfffffffffffffffffffffffffffff
print(a | (1 << 200))

# test + + 

print(0 | (1 << 80))
print((1 << 80) | (1 << 80))

            

Reported by Pylint.

Trailing whitespace
Error

Line: 6 Column: 11

              a = 0xfffffffffffffffffffffffffffff
print(a | (1 << 200))

# test + + 

print(0 | (1 << 80))
print((1 << 80) | (1 << 80))
print((1 << 80) | 0)


            

Reported by Pylint.

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

Line: 12 Column: 1

              print((1 << 80) | (1 << 80))
print((1 << 80) | 0)

a = 0xfffffffffffffffffffffffffffff
print(a | (1 << 100))
print(a | (1 << 200))
print(a | a == 0)
print(bool(a | a))


            

Reported by Pylint.

Trailing whitespace
Error

Line: 18 Column: 11

              print(a | a == 0)
print(bool(a | a))

# test - + 

print((-1 << 80) | (1 << 80))
print((-1 << 80) | 0)

print((-a) | (1 << 100))

            

Reported by Pylint.

Trailing whitespace
Error

Line: 28 Column: 11

              print((-a) | a == 0)
print(bool((-a) | a))

# test + - 

print(0 | (-1 << 80))
print((1 << 80) | (-1 << 80))

print(a | (-1 << 100))

            

Reported by Pylint.

Trailing whitespace
Error

Line: 38 Column: 11

              print(a | (-a) == 0)
print(bool(a | (-a)))

# test - - 

print((-1 << 80) | (-1 << 80))

print((-a) | (-1 << 100))
print((-a) | (-1 << 200))

            

Reported by Pylint.

tests/basics/globals_del.py
7 issues
Access to a protected member _m of a client class
Error

Line: 18 Column: 19

              
class _C:
    def _m(self): pass
MethodType = type(_C()._m)

BuiltinFunctionType = type(len)
BuiltinMethodType = type([].append)

del _f

            

Reported by Pylint.

More than one statement on a single line
Error

Line: 5 Column: 11

              1
"""

def _f(): pass
FunctionType = type(_f)
LambdaType = type(lambda: None)
CodeType = None
MappingProxyType = None
SimpleNamespace = None

            

Reported by Pylint.

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

Line: 8 Column: 1

              def _f(): pass
FunctionType = type(_f)
LambdaType = type(lambda: None)
CodeType = None
MappingProxyType = None
SimpleNamespace = None

def _g():
    yield 1

            

Reported by Pylint.

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

Line: 9 Column: 1

              FunctionType = type(_f)
LambdaType = type(lambda: None)
CodeType = None
MappingProxyType = None
SimpleNamespace = None

def _g():
    yield 1
GeneratorType = type(_g())

            

Reported by Pylint.

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

Line: 10 Column: 1

              LambdaType = type(lambda: None)
CodeType = None
MappingProxyType = None
SimpleNamespace = None

def _g():
    yield 1
GeneratorType = type(_g())


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 16 Column: 1

                  yield 1
GeneratorType = type(_g())

class _C:
    def _m(self): pass
MethodType = type(_C()._m)

BuiltinFunctionType = type(len)
BuiltinMethodType = type([].append)

            

Reported by Pylint.

More than one statement on a single line
Error

Line: 17 Column: 19

              GeneratorType = type(_g())

class _C:
    def _m(self): pass
MethodType = type(_C()._m)

BuiltinFunctionType = type(len)
BuiltinMethodType = type([].append)


            

Reported by Pylint.

tests/basics/generator_send.py
7 issues
Missing function or method docstring
Error

Line: 1 Column: 1

              def f():
    n = 0
    while True:
        n = yield n + 1
        print(n)

g = f()
try:
    g.send(1)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def f():
    n = 0
    while True:
        n = yield n + 1
        print(n)

g = f()
try:
    g.send(1)

            

Reported by Pylint.

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

Line: 1 Column: 1

              def f():
    n = 0
    while True:
        n = yield n + 1
        print(n)

g = f()
try:
    g.send(1)

            

Reported by Pylint.

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

Line: 2 Column: 5

              def f():
    n = 0
    while True:
        n = yield n + 1
        print(n)

g = f()
try:
    g.send(1)

            

Reported by Pylint.

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

Line: 4 Column: 9

              def f():
    n = 0
    while True:
        n = yield n + 1
        print(n)

g = f()
try:
    g.send(1)

            

Reported by Pylint.

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

Line: 18 Column: 1

              print(g.send(200))


def f2():
    print("entering")
    for i in range(3):
        print(i)
        yield
    print("returning 1")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 1

              print(g.send(200))


def f2():
    print("entering")
    for i in range(3):
        print(i)
        yield
    print("returning 1")

            

Reported by Pylint.

tests/basics/generator_pep479.py
7 issues
function already defined line 4
Error

Line: 21 Column: 1

                  print('StopIteration')

# throwing a StopIteration which is uncaught will be converted into a RuntimeError
def gen():
    yield 1
    yield 2
g = gen()
print(next(g))
try:

            

Reported by Pylint.

function already defined line 4
Error

Line: 32 Column: 1

                  print('RuntimeError')

# throwing a StopIteration through yield from, will be converted to a RuntimeError
def gen():
    yield from range(2)
    print('should not get here')
g = gen()
print(next(g))
try:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # tests for correct PEP479 behaviour (introduced in Python 3.5)

# basic case: StopIteration is converted into a RuntimeError
def gen():
    yield 1
    raise StopIteration
g = gen()
print(next(g))
try:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 4 Column: 1

              # tests for correct PEP479 behaviour (introduced in Python 3.5)

# basic case: StopIteration is converted into a RuntimeError
def gen():
    yield 1
    raise StopIteration
g = gen()
print(next(g))
try:

            

Reported by Pylint.

Do not raise StopIteration in generator, use return statement instead
Error

Line: 6 Column: 5

              # basic case: StopIteration is converted into a RuntimeError
def gen():
    yield 1
    raise StopIteration
g = gen()
print(next(g))
try:
    next(g)
except RuntimeError:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 1

                  print('StopIteration')

# throwing a StopIteration which is uncaught will be converted into a RuntimeError
def gen():
    yield 1
    yield 2
g = gen()
print(next(g))
try:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 32 Column: 1

                  print('RuntimeError')

# throwing a StopIteration through yield from, will be converted to a RuntimeError
def gen():
    yield from range(2)
    print('should not get here')
g = gen()
print(next(g))
try:

            

Reported by Pylint.

ports/esp8266/modules/apa102.py
7 issues
Unable to import 'esp'
Error

Line: 4 Column: 1

              # APA102 driver for MicroPython on ESP8266
# MIT license; Copyright (c) 2016 Robert Foss, Daniel Busch

from esp import apa102_write
from neopixel import NeoPixel


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

            

Reported by Pylint.

Unable to import 'neopixel'
Error

Line: 5 Column: 1

              # MIT license; Copyright (c) 2016 Robert Foss, Daniel Busch

from esp import apa102_write
from neopixel import NeoPixel


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


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # APA102 driver for MicroPython on ESP8266
# MIT license; Copyright (c) 2016 Robert Foss, Daniel Busch

from esp import apa102_write
from neopixel import NeoPixel


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

            

Reported by Pylint.

Missing class docstring
Error

Line: 8 Column: 1

              from neopixel import NeoPixel


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

    def __init__(self, clock_pin, data_pin, n, bpp=4):
        super().__init__(data_pin, n, bpp)
        self.clock_pin = clock_pin

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 8 Column: 1

              from neopixel import NeoPixel


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

    def __init__(self, clock_pin, data_pin, n, bpp=4):
        super().__init__(data_pin, n, bpp)
        self.clock_pin = clock_pin

            

Reported by Pylint.

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

Line: 11 Column: 5

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

    def __init__(self, clock_pin, data_pin, n, bpp=4):
        super().__init__(data_pin, n, bpp)
        self.clock_pin = clock_pin
        self.clock_pin.init(clock_pin.OUT)

    def write(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 5

                      self.clock_pin = clock_pin
        self.clock_pin.init(clock_pin.OUT)

    def write(self):
        apa102_write(self.clock_pin, self.pin, self.buf)

            

Reported by Pylint.