The following issues were found

tests/thread/thread_shared1.py
15 issues
Undefined variable 'n_finished'
Error

Line: 17 Column: 9

                      foo(i)
    with lock:
        global n_finished
        n_finished += 1


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

            

Reported by Pylint.

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

Line: 8 Column: 9

              import _thread


def foo(i):
    pass


def thread_entry(n, tup):
    for i in tup:

            

Reported by Pylint.

Unused argument 'i'
Error

Line: 8 Column: 9

              import _thread


def foo(i):
    pass


def thread_entry(n, tup):
    for i in tup:

            

Reported by Pylint.

Unused argument 'n'
Error

Line: 12 Column: 18

                  pass


def thread_entry(n, tup):
    for i in tup:
        foo(i)
    with lock:
        global n_finished
        n_finished += 1

            

Reported by Pylint.

Redefining name 'tup' from outer scope (line 25)
Error

Line: 12 Column: 21

                  pass


def thread_entry(n, tup):
    for i in tup:
        foo(i)
    with lock:
        global n_finished
        n_finished += 1

            

Reported by Pylint.

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

Line: 13 Column: 9

              

def thread_entry(n, tup):
    for i in tup:
        foo(i)
    with lock:
        global n_finished
        n_finished += 1


            

Reported by Pylint.

Using the global statement
Error

Line: 16 Column: 9

                  for i in tup:
        foo(i)
    with lock:
        global n_finished
        n_finished += 1


lock = _thread.allocate_lock()
n_thread = 2

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test capability for threads to access a shared immutable data structure
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

import _thread


def foo(i):
    pass

            

Reported by Pylint.

Black listed name "foo"
Error

Line: 8 Column: 1

              import _thread


def foo(i):
    pass


def thread_entry(n, tup):
    for i in tup:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

              import _thread


def foo(i):
    pass


def thread_entry(n, tup):
    for i in tup:

            

Reported by Pylint.

tests/thread/thread_shared2.py
15 issues
Undefined variable 'n_finished'
Error

Line: 18 Column: 9

                      foo(lst, idx)
    with lock:
        global n_finished
        n_finished += 1


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

            

Reported by Pylint.

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

Line: 9 Column: 14

              import _thread


def foo(lst, i):
    lst[i] += 1


def thread_entry(n, lst, idx):
    for i in range(n):

            

Reported by Pylint.

Redefining name 'lst' from outer scope (line 26)
Error

Line: 9 Column: 9

              import _thread


def foo(lst, i):
    lst[i] += 1


def thread_entry(n, lst, idx):
    for i in range(n):

            

Reported by Pylint.

Redefining name 'lst' from outer scope (line 26)
Error

Line: 13 Column: 21

                  lst[i] += 1


def thread_entry(n, lst, idx):
    for i in range(n):
        foo(lst, idx)
    with lock:
        global n_finished
        n_finished += 1

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 14 Column: 9

              

def thread_entry(n, lst, idx):
    for i in range(n):
        foo(lst, idx)
    with lock:
        global n_finished
        n_finished += 1


            

Reported by Pylint.

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

Line: 14 Column: 9

              

def thread_entry(n, lst, idx):
    for i in range(n):
        foo(lst, idx)
    with lock:
        global n_finished
        n_finished += 1


            

Reported by Pylint.

Using the global statement
Error

Line: 17 Column: 9

                  for i in range(n):
        foo(lst, idx)
    with lock:
        global n_finished
        n_finished += 1


lock = _thread.allocate_lock()
n_thread = 2

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test capability for threads to access a shared mutable data structure
# (without contention because they access different parts of the structure)
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

import _thread


def foo(lst, i):

            

Reported by Pylint.

Black listed name "foo"
Error

Line: 9 Column: 1

              import _thread


def foo(lst, i):
    lst[i] += 1


def thread_entry(n, lst, idx):
    for i in range(n):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 9 Column: 1

              import _thread


def foo(lst, i):
    lst[i] += 1


def thread_entry(n, lst, idx):
    for i in range(n):

            

Reported by Pylint.

tests/misc/sys_settrace_generator.py
15 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 9 Column: 5

                  sys.settrace
except AttributeError:
    print("SKIP")
    raise SystemExit


def print_stacktrace(frame, level=0):
    print(
        "%2d: %s@%s:%s => %s:%d"

            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 33 Column: 38

              trace_count = 0


def trace_tick_handler(frame, event, arg):
    global trace_count
    print("### trace_handler::main event:", event)
    trace_count += 1
    print_stacktrace(frame)
    return trace_tick_handler

            

Reported by Pylint.

Using the global statement
Error

Line: 34 Column: 5

              

def trace_tick_handler(frame, event, arg):
    global trace_count
    print("### trace_handler::main event:", event)
    trace_count += 1
    print_stacktrace(frame)
    return trace_tick_handler


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test sys.settrace with generators

import sys

try:
    sys.settrace
except AttributeError:
    print("SKIP")
    raise SystemExit

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 1

                  raise SystemExit


def print_stacktrace(frame, level=0):
    print(
        "%2d: %s@%s:%s => %s:%d"
        % (
            level,
            "  ",

            

Reported by Pylint.

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

Line: 30 Column: 1

                      print_stacktrace(frame.f_back, level + 1)


trace_count = 0


def trace_tick_handler(frame, event, arg):
    global trace_count
    print("### trace_handler::main event:", event)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 33 Column: 1

              trace_count = 0


def trace_tick_handler(frame, event, arg):
    global trace_count
    print("### trace_handler::main event:", event)
    trace_count += 1
    print_stacktrace(frame)
    return trace_tick_handler

            

Reported by Pylint.

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

Line: 34 Column: 5

              

def trace_tick_handler(frame, event, arg):
    global trace_count
    print("### trace_handler::main event:", event)
    trace_count += 1
    print_stacktrace(frame)
    return trace_tick_handler


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 41 Column: 1

                  return trace_tick_handler


def test_generator():
    def make_gen():
        yield 1 << 0
        yield 1 << 1
        yield 1 << 2
        return 1 << 3

            

Reported by Pylint.

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

Line: 49 Column: 5

                      return 1 << 3

    gen = make_gen()
    r = 0
    try:

        r += gen.send(None)

        while True:

            

Reported by Pylint.

tests/net_inet/tls_num_errors.py
15 issues
Unable to import 'micropython'
Error

Line: 8 Column: 5

              except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:
    print("SKIP")
    raise SystemExit



            

Reported by Pylint.

Unused import sys
Error

Line: 4 Column: 5

              # test that modtls produces a numerical error message when out of heap

try:
    import usocket as socket, ussl as ssl, sys
except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 5 Column: 1

              
try:
    import usocket as socket, ussl as ssl, sys
except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:
    print("SKIP")

            

Reported by Pylint.

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

Line: 11 Column: 5

                  from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:
    print("SKIP")
    raise SystemExit


# test with heap locked to see it switch to number-only error message
def test(addr):
    alloc_emergency_exception_buf(256)

            

Reported by Pylint.

Redefining name 'addr' from outer scope (line 43)
Error

Line: 15 Column: 10

              

# test with heap locked to see it switch to number-only error message
def test(addr):
    alloc_emergency_exception_buf(256)
    s = socket.socket()
    s.connect(addr)
    try:
        s.setblocking(False)

            

Reported by Pylint.

Using deprecated method wrap_socket()
Error

Line: 21 Column: 13

                  s.connect(addr)
    try:
        s.setblocking(False)
        s = ssl.wrap_socket(s, do_handshake=False)
        heap_lock()
        print("heap is locked")
        while True:
            ret = s.write("foo")
            if ret:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test that modtls produces a numerical error message when out of heap

try:
    import usocket as socket, ussl as ssl, sys
except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:

            

Reported by Pylint.

Multiple imports on one line (usocket, ussl, sys)
Error

Line: 4 Column: 5

              # test that modtls produces a numerical error message when out of heap

try:
    import usocket as socket, ussl as ssl, sys
except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:

            

Reported by Pylint.

Imports from package sys are not grouped
Error

Line: 6 Column: 5

              try:
    import usocket as socket, ussl as ssl, sys
except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:
    print("SKIP")
    raise SystemExit

            

Reported by Pylint.

Multiple imports on one line (socket, ssl, sys)
Error

Line: 6 Column: 5

              try:
    import usocket as socket, ussl as ssl, sys
except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:
    print("SKIP")
    raise SystemExit

            

Reported by Pylint.

tests/extmod/uasyncio_cancel_task.py
15 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(s, allow_cancel):
    try:
        print("task start")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test cancelling a task

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

            

Reported by Pylint.

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

Line: 13 Column: 1

                      raise SystemExit


async def task(s, allow_cancel):
    try:
        print("task start")
        await asyncio.sleep(s)
        print("task done")
    except asyncio.CancelledError as er:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                      raise SystemExit


async def task(s, allow_cancel):
    try:
        print("task start")
        await asyncio.sleep(s)
        print("task done")
    except asyncio.CancelledError as er:

            

Reported by Pylint.

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

Line: 18 Column: 5

                      print("task start")
        await asyncio.sleep(s)
        print("task done")
    except asyncio.CancelledError as er:
        print("task cancel")
        if allow_cancel:
            raise er



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 1

                          raise er


async def task2(allow_cancel):
    print("task 2")
    try:
        await asyncio.create_task(task(0.05, allow_cancel))
    except asyncio.CancelledError as er:
        print("task 2 cancel")

            

Reported by Pylint.

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

Line: 28 Column: 5

                  print("task 2")
    try:
        await asyncio.create_task(task(0.05, allow_cancel))
    except asyncio.CancelledError as er:
        print("task 2 cancel")
        raise er
    print("task 2 done")



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 34 Column: 1

                  print("task 2 done")


async def main():
    # Cancel task immediately
    t = asyncio.create_task(task(2, True))
    print(t.cancel())

    # Cancel task after it has started

            

Reported by Pylint.

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

Line: 36 Column: 5

              
async def main():
    # Cancel task immediately
    t = asyncio.create_task(task(2, True))
    print(t.cancel())

    # Cancel task after it has started
    t = asyncio.create_task(task(2, True))
    await asyncio.sleep(0.01)

            

Reported by Pylint.

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

Line: 40 Column: 5

                  print(t.cancel())

    # Cancel task after it has started
    t = asyncio.create_task(task(2, True))
    await asyncio.sleep(0.01)
    print(t.cancel())
    print("main sleep")
    await asyncio.sleep(0.01)


            

Reported by Pylint.

tools/metrics.py
15 issues
Redefining built-in 'dir'
Error

Line: 52 Column: 30

              

class PortData:
    def __init__(self, name, dir, output, make_flags=None):
        self.name = name
        self.dir = dir
        self.output = output
        self.make_flags = make_flags
        self.needs_mpy_cross = dir not in ("bare-arm", "minimal")

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              
"""

import collections, sys, re, subprocess

MAKE_FLAGS = ["-j3", "CFLAGS_EXTRA=-DNDEBUG"]


class PortData:

            

Reported by Bandit.

Multiple imports on one line (collections, sys, re, subprocess)
Error

Line: 46 Column: 1

              
"""

import collections, sys, re, subprocess

MAKE_FLAGS = ["-j3", "CFLAGS_EXTRA=-DNDEBUG"]


class PortData:

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 51 Column: 1

              MAKE_FLAGS = ["-j3", "CFLAGS_EXTRA=-DNDEBUG"]


class PortData:
    def __init__(self, name, dir, output, make_flags=None):
        self.name = name
        self.dir = dir
        self.output = output
        self.make_flags = make_flags

            

Reported by Pylint.

Missing class docstring
Error

Line: 51 Column: 1

              MAKE_FLAGS = ["-j3", "CFLAGS_EXTRA=-DNDEBUG"]


class PortData:
    def __init__(self, name, dir, output, make_flags=None):
        self.name = name
        self.dir = dir
        self.output = output
        self.make_flags = make_flags

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 75 Column: 1

              }


def syscmd(*args):
    sys.stdout.flush()
    a2 = []
    for a in args:
        if isinstance(a, str):
            a2.append(a)

            

Reported by Pylint.

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

Line: 77 Column: 5

              
def syscmd(*args):
    sys.stdout.flush()
    a2 = []
    for a in args:
        if isinstance(a, str):
            a2.append(a)
        elif a:
            a2.extend(a)

            

Reported by Pylint.

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

Line: 78 Column: 9

              def syscmd(*args):
    sys.stdout.flush()
    a2 = []
    for a in args:
        if isinstance(a, str):
            a2.append(a)
        elif a:
            a2.extend(a)
    subprocess.check_call(a2)

            

Reported by Pylint.

subprocess call - check for execution of untrusted input.
Security injection

Line: 83
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html

                          a2.append(a)
        elif a:
            a2.extend(a)
    subprocess.check_call(a2)


def parse_port_list(args):
    if not args:
        return list(port_data.values())

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 86 Column: 1

                  subprocess.check_call(a2)


def parse_port_list(args):
    if not args:
        return list(port_data.values())
    else:
        ports = []
        for arg in args:

            

Reported by Pylint.

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

Line: 3 Column: 1

              # This example demonstrates a peripheral implementing the Nordic UART Service (NUS).

import bluetooth
from ble_advertising import advertising_payload

from micropython import const

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)

            

Reported by Pylint.

Unable to import 'micropython'
Error

Line: 6 Column: 1

              import bluetooth
from ble_advertising import advertising_payload

from micropython import const

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)
_IRQ_GATTS_WRITE = const(3)


            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 109 Column: 13

                      while True:
            uart.write(str(nums[i]) + "\n")
            i = (i + 1) % len(nums)
            time.sleep_ms(1000)
    except KeyboardInterrupt:
        pass

    uart.close()


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # This example demonstrates a peripheral implementing the Nordic UART Service (NUS).

import bluetooth
from ble_advertising import advertising_payload

from micropython import const

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)

            

Reported by Pylint.

third party import "from micropython import const" should be placed before "import bluetooth"
Error

Line: 6 Column: 1

              import bluetooth
from ble_advertising import advertising_payload

from micropython import const

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)
_IRQ_GATTS_WRITE = const(3)


            

Reported by Pylint.

Missing class docstring
Error

Line: 33 Column: 1

              _ADV_APPEARANCE_GENERIC_COMPUTER = const(128)


class BLEUART:
    def __init__(self, ble, name="mpy-uart", rxbuf=100):
        self._ble = ble
        self._ble.active(True)
        self._ble.irq(self._irq)
        ((self._tx_handle, self._rx_handle),) = self._ble.gatts_register_services((_UART_SERVICE,))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 48 Column: 5

                      self._payload = advertising_payload(name=name, appearance=_ADV_APPEARANCE_GENERIC_COMPUTER)
        self._advertise()

    def irq(self, handler):
        self._handler = handler

    def _irq(self, event, data):
        # Track connections so we can send notifications.
        if event == _IRQ_CENTRAL_CONNECT:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 69 Column: 5

                              if self._handler:
                    self._handler()

    def any(self):
        return len(self._rx_buffer)

    def read(self, sz=None):
        if not sz:
            sz = len(self._rx_buffer)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 72 Column: 5

                  def any(self):
        return len(self._rx_buffer)

    def read(self, sz=None):
        if not sz:
            sz = len(self._rx_buffer)
        result = self._rx_buffer[0:sz]
        self._rx_buffer = self._rx_buffer[sz:]
        return result

            

Reported by Pylint.

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

Line: 72 Column: 5

                  def any(self):
        return len(self._rx_buffer)

    def read(self, sz=None):
        if not sz:
            sz = len(self._rx_buffer)
        result = self._rx_buffer[0:sz]
        self._rx_buffer = self._rx_buffer[sz:]
        return result

            

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/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/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.