The following issues were found

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.

tests/thread/stress_recurse.py
7 issues
Using the global statement
Error

Line: 17 Column: 5

                      foo()
    except RuntimeError:
        print("RuntimeError")
    global finished
    finished = True


finished = False


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test hitting the function recursion limit within a thread
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

import _thread


def foo():
    foo()

            

Reported by Pylint.

Black listed name "foo"
Error

Line: 8 Column: 1

              import _thread


def foo():
    foo()


def thread_entry():
    try:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

              import _thread


def foo():
    foo()


def thread_entry():
    try:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 1

                  foo()


def thread_entry():
    try:
        foo()
    except RuntimeError:
        print("RuntimeError")
    global finished

            

Reported by Pylint.

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

Line: 17 Column: 5

                      foo()
    except RuntimeError:
        print("RuntimeError")
    global finished
    finished = True


finished = False


            

Reported by Pylint.

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

Line: 21 Column: 1

                  finished = True


finished = False

_thread.start_new_thread(thread_entry, ())

# busy wait for thread to finish
while not finished:

            

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.

tests/basics/generator1.py
7 issues
Useless return at end of function or method
Error

Line: 1 Column: 1

              def f(x):
    print('a')
    y = x
    print('b')
    while y > 0:
        print('c')
        y -= 1
        print('d')
        yield y

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 1 Column: 1

              def f(x):
    print('a')
    y = x
    print('b')
    while y > 0:
        print('c')
        y -= 1
        print('d')
        yield y

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def f(x):
    print('a')
    y = x
    print('b')
    while y > 0:
        print('c')
        y -= 1
        print('d')
        yield y

            

Reported by Pylint.

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

Line: 1 Column: 1

              def f(x):
    print('a')
    y = x
    print('b')
    while y > 0:
        print('c')
        y -= 1
        print('d')
        yield y

            

Reported by Pylint.

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

Line: 1 Column: 1

              def f(x):
    print('a')
    y = x
    print('b')
    while y > 0:
        print('c')
        y -= 1
        print('d')
        yield y

            

Reported by Pylint.

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

Line: 3 Column: 5

              def f(x):
    print('a')
    y = x
    print('b')
    while y > 0:
        print('c')
        y -= 1
        print('d')
        yield y

            

Reported by Pylint.

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

Line: 7 Column: 9

                  print('b')
    while y > 0:
        print('c')
        y -= 1
        print('d')
        yield y
        print('e')
    print('f')
    return None

            

Reported by Pylint.

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

Line: 1 Column: 1

              # test waiting within async with enter/exit functions

try:
    import usys as sys
except ImportError:
    import sys
if sys.implementation.name == 'micropython':
    # uPy allows normal generators to be awaitables
    coroutine = lambda f: f

            

Reported by Pylint.

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

Line: 15 Column: 1

                  coroutine = types.coroutine

@coroutine
def f(x):
    print('f start:', x)
    yield x + 1
    yield x + 2
    return x + 3


            

Reported by Pylint.

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

Line: 15 Column: 1

                  coroutine = types.coroutine

@coroutine
def f(x):
    print('f start:', x)
    yield x + 1
    yield x + 2
    return x + 3


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 1

                  coroutine = types.coroutine

@coroutine
def f(x):
    print('f start:', x)
    yield x + 1
    yield x + 2
    return x + 3


            

Reported by Pylint.

Missing class docstring
Error

Line: 21 Column: 1

                  yield x + 2
    return x + 3

class AContext:
    async def __aenter__(self):
        print('enter')
        print('f returned:', await f(10))
    async def __aexit__(self, exc_type, exc, tb):
        print('exit', exc_type, exc)

            

Reported by Pylint.

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

Line: 25 Column: 5

                  async def __aenter__(self):
        print('enter')
        print('f returned:', await f(10))
    async def __aexit__(self, exc_type, exc, tb):
        print('exit', exc_type, exc)
        print('f returned:', await f(20))

async def coro():
    async with AContext():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 29 Column: 1

                      print('exit', exc_type, exc)
        print('f returned:', await f(20))

async def coro():
    async with AContext():
        print('body start')
        print('body f returned:', await f(30))
        print('body end')


            

Reported by Pylint.

tests/import/import_star_error.py
7 issues
Use of exec detected.
Security

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

              
# 'import *' is not allowed in function scope
try:
    exec("def foo(): from x import *")
except SyntaxError as er:
    print("function", "SyntaxError")

# 'import *' is not allowed in class scope
try:

            

Reported by Bandit.

Use of exec
Error

Line: 5 Column: 5

              
# 'import *' is not allowed in function scope
try:
    exec("def foo(): from x import *")
except SyntaxError as er:
    print("function", "SyntaxError")

# 'import *' is not allowed in class scope
try:

            

Reported by Pylint.

Use of exec detected.
Security

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

              
# 'import *' is not allowed in class scope
try:
    exec("class C: from x import *")
except SyntaxError as er:
    print("class", "SyntaxError")

            

Reported by Bandit.

Use of exec
Error

Line: 11 Column: 5

              
# 'import *' is not allowed in class scope
try:
    exec("class C: from x import *")
except SyntaxError as er:
    print("class", "SyntaxError")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test errors with import *

# 'import *' is not allowed in function scope
try:
    exec("def foo(): from x import *")
except SyntaxError as er:
    print("function", "SyntaxError")

# 'import *' is not allowed in class scope

            

Reported by Pylint.

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

Line: 6 Column: 1

              # 'import *' is not allowed in function scope
try:
    exec("def foo(): from x import *")
except SyntaxError as er:
    print("function", "SyntaxError")

# 'import *' is not allowed in class scope
try:
    exec("class C: from x import *")

            

Reported by Pylint.

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

Line: 12 Column: 1

              # 'import *' is not allowed in class scope
try:
    exec("class C: from x import *")
except SyntaxError as er:
    print("class", "SyntaxError")

            

Reported by Pylint.

ports/esp8266/boards/manifest.py
7 issues
Undefined variable 'freeze'
Error

Line: 1 Column: 1

              freeze("$(PORT_DIR)/modules")
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

Undefined variable 'freeze'
Error

Line: 2 Column: 1

              freeze("$(PORT_DIR)/modules")
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

Undefined variable 'freeze'
Error

Line: 3 Column: 1

              freeze("$(PORT_DIR)/modules")
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

Undefined variable 'freeze'
Error

Line: 4 Column: 1

              freeze("$(PORT_DIR)/modules")
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

Undefined variable 'include'
Error

Line: 5 Column: 1

              freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

Undefined variable 'include'
Error

Line: 6 Column: 1

              freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              freeze("$(PORT_DIR)/modules")
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

tests/thread/thread_sleep1.py
7 issues
Using the global statement
Error

Line: 22 Column: 5

              

def thread_entry(t):
    global n_finished
    sleep_ms(t)
    sleep_ms(2 * t)
    with lock:
        n_finished += 1


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test threads sleeping
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

try:
    import utime

    sleep_ms = utime.sleep_ms
except ImportError:

            

Reported by Pylint.

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

Line: 17 Column: 1

              import _thread

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


def thread_entry(t):
    global n_finished

            

Reported by Pylint.

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

Line: 18 Column: 1

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


def thread_entry(t):
    global n_finished
    sleep_ms(t)

            

Reported by Pylint.

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

Line: 21 Column: 1

              n_finished = 0


def thread_entry(t):
    global n_finished
    sleep_ms(t)
    sleep_ms(2 * t)
    with lock:
        n_finished += 1

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 1

              n_finished = 0


def thread_entry(t):
    global n_finished
    sleep_ms(t)
    sleep_ms(2 * t)
    with lock:
        n_finished += 1

            

Reported by Pylint.

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

Line: 22 Column: 5

              

def thread_entry(t):
    global n_finished
    sleep_ms(t)
    sleep_ms(2 * t)
    with lock:
        n_finished += 1


            

Reported by Pylint.

ports/esp8266/boards/GENERIC_512K/manifest.py
7 issues
Undefined variable 'freeze'
Error

Line: 1 Column: 1

              freeze("$(BOARD_DIR)", "_boot.py", opt=3)
freeze("$(PORT_DIR)/modules", ("apa102.py", "ntptime.py", "port_diag.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

Undefined variable 'freeze'
Error

Line: 2 Column: 1

              freeze("$(BOARD_DIR)", "_boot.py", opt=3)
freeze("$(PORT_DIR)/modules", ("apa102.py", "ntptime.py", "port_diag.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

Undefined variable 'freeze'
Error

Line: 3 Column: 1

              freeze("$(BOARD_DIR)", "_boot.py", opt=3)
freeze("$(PORT_DIR)/modules", ("apa102.py", "ntptime.py", "port_diag.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

Undefined variable 'freeze'
Error

Line: 4 Column: 1

              freeze("$(BOARD_DIR)", "_boot.py", opt=3)
freeze("$(PORT_DIR)/modules", ("apa102.py", "ntptime.py", "port_diag.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

Undefined variable 'include'
Error

Line: 5 Column: 1

              freeze("$(PORT_DIR)/modules", ("apa102.py", "ntptime.py", "port_diag.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

Undefined variable 'include'
Error

Line: 6 Column: 1

              freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              freeze("$(BOARD_DIR)", "_boot.py", opt=3)
freeze("$(PORT_DIR)/modules", ("apa102.py", "ntptime.py", "port_diag.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

            

Reported by Pylint.