The following issues were found

tests/basics/struct2.py
14 issues
Unable to import 'ustruct'
Error

Line: 4 Column: 5

              # test ustruct with a count specified before the type

try:
    import ustruct as struct
except:
    try:
        import struct
    except ImportError:
        print("SKIP")

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 5 Column: 1

              
try:
    import ustruct as struct
except:
    try:
        import struct
    except ImportError:
        print("SKIP")
        raise SystemExit

            

Reported by Pylint.

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

Line: 10 Column: 9

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

print(struct.calcsize('0s'))
print(struct.unpack('0s', b''))
print(struct.pack('0s', b'123'))


            

Reported by Pylint.

No exception type(s) specified
Error

Line: 31 Column: 1

              # check that we get an error if the buffer is too small
try:
    struct.unpack('2H', b'\x00\x00')
except:
    print('Exception')
try:
    struct.pack_into('2I', bytearray(4), 0, 0)
except:
    print('Exception')

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 35 Column: 1

                  print('Exception')
try:
    struct.pack_into('2I', bytearray(4), 0, 0)
except:
    print('Exception')

# check that unknown types raise an exception
try:
    struct.unpack('z', b'1')

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 41 Column: 1

              # check that unknown types raise an exception
try:
    struct.unpack('z', b'1')
except:
    print('Exception')

try:
    struct.pack('z', (b'1',))
except:

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 46 Column: 1

              
try:
    struct.pack('z', (b'1',))
except:
    print('Exception')

try:
    struct.calcsize('0z')
except:

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 51 Column: 1

              
try:
    struct.calcsize('0z')
except:
    print('Exception')

# check that a count without a type specifier raises an exception

try:

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 58 Column: 1

              
try:
    struct.calcsize('1')
except:
    print('Exception')

try:
    struct.pack('1')
except:

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 63 Column: 1

              
try:
    struct.pack('1')
except:
    print('Exception')

try:
    struct.pack_into('1', bytearray(4), 0, 'xx')
except:

            

Reported by Pylint.

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

Line: 8 Column: 9

                      import uzlib as zlib
    except ImportError:
        print("SKIP")
        raise SystemExit

PATTERNS = [
    # Packed results produced by CPy's zlib.compress()
    (b"0", b"x\x9c3\x00\x00\x001\x001"),
    (b"a", b"x\x9cK\x04\x00\x00b\x00b"),

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 53 Column: 8

              # this should error
try:
    zlib.decompress(b"abc")
except Exception:
    print("Exception")

# invalid block type
try:
    zlib.decompress(b"\x07", -15)  # final-block, block-type=3 (invalid)

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 59 Column: 8

              # invalid block type
try:
    zlib.decompress(b"\x07", -15)  # final-block, block-type=3 (invalid)
except Exception as er:
    print("Exception")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    import zlib
except ImportError:
    try:
        import uzlib as zlib
    except ImportError:
        print("SKIP")
        raise SystemExit


            

Reported by Pylint.

Line too long (225/100)
Error

Line: 17 Column: 1

                  (b"0" * 100, b"x\x9c30\xa0=\x00\x00\xb3q\x12\xc1"),
    (
        bytes(range(64)),
        b"x\x9cc`dbfaec\xe7\xe0\xe4\xe2\xe6\xe1\xe5\xe3\x17\x10\x14\x12\x16\x11\x15\x13\x97\x90\x94\x92\x96\x91\x95\x93WPTRVQUS\xd7\xd0\xd4\xd2\xd6\xd1\xd5\xd370426153\xb7\xb0\xb4\xb2\xb6\xb1\xb5\xb3\x07\x00\xaa\xe0\x07\xe1",
    ),
    (b"hello", b"x\x01\x01\x05\x00\xfa\xffhello\x06,\x02\x15"),  # compression level 0
    # adaptive/dynamic huffman tree
    (
        b"13371813150|13764518736|12345678901",

            

Reported by Pylint.

Line too long (123/100)
Error

Line: 23 Column: 1

                  # adaptive/dynamic huffman tree
    (
        b"13371813150|13764518736|12345678901",
        b"x\x9c\x05\xc1\x81\x01\x000\x04\x04\xb1\x95\\\x1f\xcfn\x86o\x82d\x06Qq\xc8\x9d\xc5X}<e\xb5g\x83\x0f\x89X\x07\xab",
    ),
    # dynamic Huffman tree with "case 17" (repeat code for 3-10 times)
    (
        b">I}\x00\x951D>I}\x00\x951D>I}\x00\x951D>I}\x00\x951D",
        b"x\x9c\x05\xc11\x01\x00\x00\x00\x010\x95\x14py\x84\x12C_\x9bR\x8cV\x8a\xd1J1Z)F\x1fw`\x089",

            

Reported by Pylint.

Line too long (101/100)
Error

Line: 28 Column: 1

                  # dynamic Huffman tree with "case 17" (repeat code for 3-10 times)
    (
        b">I}\x00\x951D>I}\x00\x951D>I}\x00\x951D>I}\x00\x951D",
        b"x\x9c\x05\xc11\x01\x00\x00\x00\x010\x95\x14py\x84\x12C_\x9bR\x8cV\x8a\xd1J1Z)F\x1fw`\x089",
    ),
]

for unpacked, packed in PATTERNS:
    assert zlib.decompress(packed) == unpacked

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 33
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              ]

for unpacked, packed in PATTERNS:
    assert zlib.decompress(packed) == unpacked
    print(unpacked)


# Raw DEFLATE bitstream
v = b"\xcbH\xcd\xc9\xc9\x07\x00"

            

Reported by Bandit.

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

Line: 38 Column: 1

              

# Raw DEFLATE bitstream
v = b"\xcbH\xcd\xc9\xc9\x07\x00"
exp = b"hello"
out = zlib.decompress(v, -15)
assert out == exp
print(exp)
# Even when you ask CPython zlib.compress to produce Raw DEFLATE stream,

            

Reported by Pylint.

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

Line: 39 Column: 1

              
# Raw DEFLATE bitstream
v = b"\xcbH\xcd\xc9\xc9\x07\x00"
exp = b"hello"
out = zlib.decompress(v, -15)
assert out == exp
print(exp)
# Even when you ask CPython zlib.compress to produce Raw DEFLATE stream,
# it returns it with adler2 and oriignal size appended, as if it was a

            

Reported by Pylint.

tests/thread/stress_heap.py
14 issues
Undefined variable 'n_finished'
Error

Line: 36 Column: 9

                  with lock:
        print(sum, lst[-1])
        global n_finished
        n_finished += 1


lock = _thread.allocate_lock()
n_thread = 10
n_finished = 0

            

Reported by Pylint.

Redefining built-in 'sum'
Error

Line: 23 Column: 5

              
    # run a loop which allocates a small list and uses it each iteration
    lst = 8 * [0]
    sum = 0
    for i in range(n):
        sum += last(lst)
        lst = [0, 0, 0, 0, 0, 0, 0, i + 1]

    # check that the bytearray still has the right data

            

Reported by Pylint.

Redefining name 'i' from outer scope (line 44)
Error

Line: 24 Column: 9

                  # run a loop which allocates a small list and uses it each iteration
    lst = 8 * [0]
    sum = 0
    for i in range(n):
        sum += last(lst)
        lst = [0, 0, 0, 0, 0, 0, 0, i + 1]

    # check that the bytearray still has the right data
    for i, b in enumerate(data):

            

Reported by Pylint.

Using the global statement
Error

Line: 35 Column: 9

                  # print the result of the loop and indicate we are finished
    with lock:
        print(sum, lst[-1])
        global n_finished
        n_finished += 1


lock = _thread.allocate_lock()
n_thread = 10

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # stress test for the heap by allocating lots of objects within threads
# allocates about 5mb on the heap
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

try:
    import utime as time
except ImportError:
    import time

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

              import _thread


def last(l):
    return l[-1]


def thread_entry(n):
    # allocate a bytearray and fill it

            

Reported by Pylint.

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

Line: 13 Column: 1

              import _thread


def last(l):
    return l[-1]


def thread_entry(n):
    # allocate a bytearray and fill it

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

                  return l[-1]


def thread_entry(n):
    # allocate a bytearray and fill it
    data = bytearray(i for i in range(256))

    # run a loop which allocates a small list and uses it each iteration
    lst = 8 * [0]

            

Reported by Pylint.

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

Line: 17 Column: 1

                  return l[-1]


def thread_entry(n):
    # allocate a bytearray and fill it
    data = bytearray(i for i in range(256))

    # run a loop which allocates a small list and uses it each iteration
    lst = 8 * [0]

            

Reported by Pylint.

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

Line: 29 Column: 12

                      lst = [0, 0, 0, 0, 0, 0, 0, i + 1]

    # check that the bytearray still has the right data
    for i, b in enumerate(data):
        assert i == b

    # print the result of the loop and indicate we are finished
    with lock:
        print(sum, lst[-1])

            

Reported by Pylint.

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

Line: 5 Column: 5

                  from utime import ticks_diff, ticks_add
except ImportError:
    print("SKIP")
    raise SystemExit

MAX = ticks_add(0, -1)
# Should be done like this to avoid small int overflow
MODULO_HALF = MAX // 2 + 1


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    from utime import ticks_diff, ticks_add
except ImportError:
    print("SKIP")
    raise SystemExit

MAX = ticks_add(0, -1)
# Should be done like this to avoid small int overflow
MODULO_HALF = MAX // 2 + 1

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 15
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              # if ticks_diff(a, b) = c,
# then ticks_diff(b, a) = -c

assert ticks_diff(1, 0) == 1, ticks_diff(1, 0)
assert ticks_diff(0, 1) == -1

assert ticks_diff(0, MAX) == 1
assert ticks_diff(MAX, 0) == -1


            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 16
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              # then ticks_diff(b, a) = -c

assert ticks_diff(1, 0) == 1, ticks_diff(1, 0)
assert ticks_diff(0, 1) == -1

assert ticks_diff(0, MAX) == 1
assert ticks_diff(MAX, 0) == -1

assert ticks_diff(0, MAX - 1) == 2

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

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

              assert ticks_diff(1, 0) == 1, ticks_diff(1, 0)
assert ticks_diff(0, 1) == -1

assert ticks_diff(0, MAX) == 1
assert ticks_diff(MAX, 0) == -1

assert ticks_diff(0, MAX - 1) == 2

# Maximum "positive" distance

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

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

              assert ticks_diff(0, 1) == -1

assert ticks_diff(0, MAX) == 1
assert ticks_diff(MAX, 0) == -1

assert ticks_diff(0, MAX - 1) == 2

# Maximum "positive" distance
assert ticks_diff(MODULO_HALF, 1) == MODULO_HALF - 1, ticks_diff(MODULO_HALF, 1)

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 21
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              assert ticks_diff(0, MAX) == 1
assert ticks_diff(MAX, 0) == -1

assert ticks_diff(0, MAX - 1) == 2

# Maximum "positive" distance
assert ticks_diff(MODULO_HALF, 1) == MODULO_HALF - 1, ticks_diff(MODULO_HALF, 1)
# Step further, and it becomes a negative distance
assert ticks_diff(MODULO_HALF, 0) == -MODULO_HALF

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 24
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              assert ticks_diff(0, MAX - 1) == 2

# Maximum "positive" distance
assert ticks_diff(MODULO_HALF, 1) == MODULO_HALF - 1, ticks_diff(MODULO_HALF, 1)
# Step further, and it becomes a negative distance
assert ticks_diff(MODULO_HALF, 0) == -MODULO_HALF

# Offsetting that in either direction doesn't affect the result
off = 100

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 26
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              # Maximum "positive" distance
assert ticks_diff(MODULO_HALF, 1) == MODULO_HALF - 1, ticks_diff(MODULO_HALF, 1)
# Step further, and it becomes a negative distance
assert ticks_diff(MODULO_HALF, 0) == -MODULO_HALF

# Offsetting that in either direction doesn't affect the result
off = 100
# Cheating and skipping to use ticks_add() when we know there's no wraparound
# Real apps should use always it.

            

Reported by Bandit.

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

Line: 29 Column: 1

              assert ticks_diff(MODULO_HALF, 0) == -MODULO_HALF

# Offsetting that in either direction doesn't affect the result
off = 100
# Cheating and skipping to use ticks_add() when we know there's no wraparound
# Real apps should use always it.
assert ticks_diff(MODULO_HALF + off, 1 + off) == MODULO_HALF - 1
assert ticks_diff(MODULO_HALF + off, 0 + off) == -MODULO_HALF
assert ticks_diff(MODULO_HALF - off, ticks_add(1, -off)) == MODULO_HALF - 1

            

Reported by Pylint.

tests/basics/try_finally1.py
14 issues
Undefined variable 'foo'
Error

Line: 38 Column: 9

                  print("try1")
    try:
        print("try2")
        foo()
    except:
        print("except2")
finally:
    print("finally1")
print()

            

Reported by Pylint.

Undefined variable 'foo'
Error

Line: 64 Column: 13

                      print("try1")
        try:
            print("try2")
            foo()
        finally:
            print("finally2")
    finally:
        print("finally1")
except:

            

Reported by Pylint.

Undefined variable 'foo'
Error

Line: 80 Column: 9

              finally:
    try:
        print("try2")
        foo
    except:
        print("except2")
    print("finally1")
print()


            

Reported by Pylint.

Undefined variable 'foo'
Error

Line: 92 Column: 5

                      print("try")
    finally:
        print("finally")
    foo
try:
    func()
except:
    print("except")

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 39 Column: 5

                  try:
        print("try2")
        foo()
    except:
        print("except2")
finally:
    print("finally1")
print()


            

Reported by Pylint.

No exception type(s) specified
Error

Line: 69 Column: 1

                          print("finally2")
    finally:
        print("finally1")
except:
    print("catch-all except")
print()

# case where a try-except within a finally cancels the exception
print("exc-finally-subexcept")

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 80 Column: 9

              finally:
    try:
        print("try2")
        foo
    except:
        print("except2")
    print("finally1")
print()


            

Reported by Pylint.

No exception type(s) specified
Error

Line: 81 Column: 5

                  try:
        print("try2")
        foo
    except:
        print("except2")
    print("finally1")
print()

# case where exception is raised after a finally has finished (tests that the finally doesn't run again)

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 92 Column: 5

                      print("try")
    finally:
        print("finally")
    foo
try:
    func()
except:
    print("except")

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 95 Column: 1

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

            

Reported by Pylint.

examples/bluetooth/ble_advertising.py
14 issues
Unable to import 'micropython'
Error

Line: 3 Column: 1

              # Helpers for generating BLE advertising payloads.

from micropython import const
import struct
import bluetooth

# Advertising payloads are repeated packets of the following form:
#   1 byte data length (N + 1)
#   1 byte type (see constants below)

            

Reported by Pylint.

Unable to import 'bluetooth'
Error

Line: 5 Column: 1

              
from micropython import const
import struct
import bluetooth

# Advertising payloads are repeated packets of the following form:
#   1 byte data length (N + 1)
#   1 byte type (see constants below)
#   N bytes type-specific data

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Helpers for generating BLE advertising payloads.

from micropython import const
import struct
import bluetooth

# Advertising payloads are repeated packets of the following form:
#   1 byte data length (N + 1)
#   1 byte type (see constants below)

            

Reported by Pylint.

standard import "import struct" should be placed before "from micropython import const"
Error

Line: 4 Column: 1

              # Helpers for generating BLE advertising payloads.

from micropython import const
import struct
import bluetooth

# Advertising payloads are repeated packets of the following form:
#   1 byte data length (N + 1)
#   1 byte type (see constants below)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 1

              

# Generate a payload to be passed to gap_advertise(adv_data=...).
def advertising_payload(limited_disc=False, br_edr=False, name=None, services=None, appearance=0):
    payload = bytearray()

    def _append(adv_type, value):
        nonlocal payload
        payload += struct.pack("BB", len(value) + 1, adv_type) + value

            

Reported by Pylint.

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

Line: 41 Column: 13

              
    if services:
        for uuid in services:
            b = bytes(uuid)
            if len(b) == 2:
                _append(_ADV_TYPE_UUID16_COMPLETE, b)
            elif len(b) == 4:
                _append(_ADV_TYPE_UUID32_COMPLETE, b)
            elif len(b) == 16:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 56 Column: 1

                  return payload


def decode_field(payload, adv_type):
    i = 0
    result = []
    while i + 1 < len(payload):
        if payload[i + 1] == adv_type:
            result.append(payload[i + 2 : i + payload[i] + 1])

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 66 Column: 1

                  return result


def decode_name(payload):
    n = decode_field(payload, _ADV_TYPE_NAME)
    return str(n[0], "utf-8") if n else ""


def decode_services(payload):

            

Reported by Pylint.

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

Line: 67 Column: 5

              

def decode_name(payload):
    n = decode_field(payload, _ADV_TYPE_NAME)
    return str(n[0], "utf-8") if n else ""


def decode_services(payload):
    services = []

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 71 Column: 1

                  return str(n[0], "utf-8") if n else ""


def decode_services(payload):
    services = []
    for u in decode_field(payload, _ADV_TYPE_UUID16_COMPLETE):
        services.append(bluetooth.UUID(struct.unpack("<h", u)[0]))
    for u in decode_field(payload, _ADV_TYPE_UUID32_COMPLETE):
        services.append(bluetooth.UUID(struct.unpack("<d", u)[0]))

            

Reported by Pylint.

tests/micropython/viper_with.py
14 issues
Undefined variable 'micropython'
Error

Line: 16 Column: 2

              

# basic with
@micropython.viper
def f():
    with C():
        print(1)



            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 25 Column: 2

              f()

# nested with and try-except
@micropython.viper
def f():
    try:
        with C():
            print(1)
            fail

            

Reported by Pylint.

function already defined line 17
Error

Line: 26 Column: 1

              
# nested with and try-except
@micropython.viper
def f():
    try:
        with C():
            print(1)
            fail
            print(2)

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 30 Column: 13

                  try:
        with C():
            print(1)
            fail
            print(2)
    except NameError:
        print("NameError")



            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test with handling within a viper function


class C:
    def __init__(self):
        print("__init__")

    def __enter__(self):
        print("__enter__")

            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              # test with handling within a viper function


class C:
    def __init__(self):
        print("__init__")

    def __enter__(self):
        print("__enter__")

            

Reported by Pylint.

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

Line: 4 Column: 1

              # test with handling within a viper function


class C:
    def __init__(self):
        print("__init__")

    def __enter__(self):
        print("__enter__")

            

Reported by Pylint.

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

Line: 11 Column: 5

                  def __enter__(self):
        print("__enter__")

    def __exit__(self, a, b, c):
        print("__exit__", a, b, c)


# basic with
@micropython.viper

            

Reported by Pylint.

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

Line: 11 Column: 5

                  def __enter__(self):
        print("__enter__")

    def __exit__(self, a, b, c):
        print("__exit__", a, b, c)


# basic with
@micropython.viper

            

Reported by Pylint.

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

Line: 11 Column: 5

                  def __enter__(self):
        print("__enter__")

    def __exit__(self, a, b, c):
        print("__exit__", a, b, c)


# basic with
@micropython.viper

            

Reported by Pylint.

tests/basics/class_bind_self.py
14 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test for correct binding of self when accessing attr of an instance

class A:
    def __init__(self, arg):
        self.val = arg
    def __str__(self):
        return 'A.__str__ ' + str(self.val)
    def __call__(self, arg):
        return 'A.__call__', arg

            

Reported by Pylint.

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

Line: 3 Column: 1

              # test for correct binding of self when accessing attr of an instance

class A:
    def __init__(self, arg):
        self.val = arg
    def __str__(self):
        return 'A.__str__ ' + str(self.val)
    def __call__(self, arg):
        return 'A.__call__', arg

            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              # test for correct binding of self when accessing attr of an instance

class A:
    def __init__(self, arg):
        self.val = arg
    def __str__(self):
        return 'A.__str__ ' + str(self.val)
    def __call__(self, arg):
        return 'A.__call__', arg

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 10 Column: 5

                      return 'A.__str__ ' + str(self.val)
    def __call__(self, arg):
        return 'A.__call__', arg
    def foo(self, arg):
        return 'A.foo', self.val, arg

def make_closure(x_in):
    x = x_in
    def closure(y):

            

Reported by Pylint.

Black listed name "foo"
Error

Line: 10 Column: 5

                      return 'A.__str__ ' + str(self.val)
    def __call__(self, arg):
        return 'A.__call__', arg
    def foo(self, arg):
        return 'A.foo', self.val, arg

def make_closure(x_in):
    x = x_in
    def closure(y):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                  def foo(self, arg):
        return 'A.foo', self.val, arg

def make_closure(x_in):
    x = x_in
    def closure(y):
        return x, y is c
    return closure


            

Reported by Pylint.

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

Line: 14 Column: 5

                      return 'A.foo', self.val, arg

def make_closure(x_in):
    x = x_in
    def closure(y):
        return x, y is c
    return closure

class C:

            

Reported by Pylint.

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

Line: 15 Column: 5

              
def make_closure(x_in):
    x = x_in
    def closure(y):
        return x, y is c
    return closure

class C:
    # these act like methods and bind self

            

Reported by Pylint.

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

Line: 19 Column: 1

                      return x, y is c
    return closure

class C:
    # these act like methods and bind self

    def f1(self, arg):
        return 'C.f1', self is c, arg
    f2 = lambda self, arg: ('C.f2', self is c, arg)

            

Reported by Pylint.

Missing class docstring
Error

Line: 19 Column: 1

                      return x, y is c
    return closure

class C:
    # these act like methods and bind self

    def f1(self, arg):
        return 'C.f1', self is c, arg
    f2 = lambda self, arg: ('C.f2', self is c, arg)

            

Reported by Pylint.

tests/basics/equal_class.py
14 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test equality for classes/instances to other types

class A:
    pass

class B:
    pass

class C(A):

            

Reported by Pylint.

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

Line: 3 Column: 1

              # test equality for classes/instances to other types

class A:
    pass

class B:
    pass

class C(A):

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 3 Column: 1

              # test equality for classes/instances to other types

class A:
    pass

class B:
    pass

class C(A):

            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              # test equality for classes/instances to other types

class A:
    pass

class B:
    pass

class C(A):

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 6 Column: 1

              class A:
    pass

class B:
    pass

class C(A):
    pass


            

Reported by Pylint.

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

Line: 6 Column: 1

              class A:
    pass

class B:
    pass

class C(A):
    pass


            

Reported by Pylint.

Missing class docstring
Error

Line: 6 Column: 1

              class A:
    pass

class B:
    pass

class C(A):
    pass


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 9 Column: 1

              class B:
    pass

class C(A):
    pass

print(A == None)
print(None == A)


            

Reported by Pylint.

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

Line: 9 Column: 1

              class B:
    pass

class C(A):
    pass

print(A == None)
print(None == A)


            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

              class B:
    pass

class C(A):
    pass

print(A == None)
print(None == A)


            

Reported by Pylint.

tests/extmod/uasyncio_heaplock.py
14 issues
Unable to import 'micropython'
Error

Line: 3 Column: 1

              # test that basic scheduling of tasks, and uasyncio.sleep_ms, does not use the heap

import micropython

# strict stackless builds can't call functions without allocating a frame on the heap
try:
    f = lambda: 0
    micropython.heap_lock()
    f()

            

Reported by Pylint.

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

Line: 13 Column: 5

                  micropython.heap_unlock()
except RuntimeError:
    print("SKIP")
    raise SystemExit

try:
    import uasyncio as asyncio
except ImportError:
    try:

            

Reported by Pylint.

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

Line: 22 Column: 9

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


async def task(id, n, t):
    for i in range(n):
        print(id, i)

            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 25 Column: 16

                      raise SystemExit


async def task(id, n, t):
    for i in range(n):
        print(id, i)
        await asyncio.sleep_ms(t)



            

Reported by Pylint.

Unused variable 't1'
Error

Line: 32 Column: 5

              

async def main():
    t1 = asyncio.create_task(task(1, 4, 20))
    t2 = asyncio.create_task(task(2, 2, 50))

    micropython.heap_lock()

    print("start")

            

Reported by Pylint.

Unused variable 't2'
Error

Line: 33 Column: 5

              
async def main():
    t1 = asyncio.create_task(task(1, 4, 20))
    t2 = asyncio.create_task(task(2, 2, 50))

    micropython.heap_lock()

    print("start")
    await asyncio.sleep_ms(1)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test that basic scheduling of tasks, and uasyncio.sleep_ms, does not use the heap

import micropython

# strict stackless builds can't call functions without allocating a frame on the heap
try:
    f = lambda: 0
    micropython.heap_lock()
    f()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 25 Column: 1

                      raise SystemExit


async def task(id, n, t):
    for i in range(n):
        print(id, i)
        await asyncio.sleep_ms(t)



            

Reported by Pylint.

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

Line: 25 Column: 1

                      raise SystemExit


async def task(id, n, t):
    for i in range(n):
        print(id, i)
        await asyncio.sleep_ms(t)



            

Reported by Pylint.

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

Line: 25 Column: 1

                      raise SystemExit


async def task(id, n, t):
    for i in range(n):
        print(id, i)
        await asyncio.sleep_ms(t)



            

Reported by Pylint.