The following issues were found

examples/hwapi/soft_pwm_uasyncio.py
8 issues
Unable to import 'uasyncio'
Error

Line: 2 Column: 1

              # See original soft_pwm.py for detailed comments.
import uasyncio
from hwconfig import LED


async def pwm_cycle(led, duty, cycles):
    duty_off = 20 - duty
    for i in range(cycles):
        if duty:

            

Reported by Pylint.

Unable to import 'hwconfig'
Error

Line: 3 Column: 1

              # See original soft_pwm.py for detailed comments.
import uasyncio
from hwconfig import LED


async def pwm_cycle(led, duty, cycles):
    duty_off = 20 - duty
    for i in range(cycles):
        if duty:

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 8 Column: 9

              
async def pwm_cycle(led, duty, cycles):
    duty_off = 20 - duty
    for i in range(cycles):
        if duty:
            led.value(1)
            await uasyncio.sleep_ms(duty)
        if duty_off:
            led.value(0)

            

Reported by Pylint.

Redefining name 'LED' from outer scope (line 3)
Error

Line: 17 Column: 23

                          await uasyncio.sleep_ms(duty_off)


async def fade_in_out(LED):
    while True:
        # Fade in
        for i in range(1, 21):
            await pwm_cycle(LED, i, 2)
        # Fade out

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # See original soft_pwm.py for detailed comments.
import uasyncio
from hwconfig import LED


async def pwm_cycle(led, duty, cycles):
    duty_off = 20 - duty
    for i in range(cycles):
        if duty:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 6 Column: 1

              from hwconfig import LED


async def pwm_cycle(led, duty, cycles):
    duty_off = 20 - duty
    for i in range(cycles):
        if duty:
            led.value(1)
            await uasyncio.sleep_ms(duty)

            

Reported by Pylint.

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

Line: 17 Column: 1

                          await uasyncio.sleep_ms(duty_off)


async def fade_in_out(LED):
    while True:
        # Fade in
        for i in range(1, 21):
            await pwm_cycle(LED, i, 2)
        # Fade out

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

                          await uasyncio.sleep_ms(duty_off)


async def fade_in_out(LED):
    while True:
        # Fade in
        for i in range(1, 21):
            await pwm_cycle(LED, i, 2)
        # Fade out

            

Reported by Pylint.

tests/basics/class_getattr.py
8 issues
An attribute defined in class_getattr line 4 hides this method
Error

Line: 5 Column: 5

              class C:
    def __init__(self):
        self.__add__ = lambda: print('member __add__')
    def __add__(self, x):
        print('__add__')
    def __getattr__(self, attr):
        print('__getattr__', attr)
        return None


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 12 Column: 1

                      return None

c = C()
c.add # should call __getattr__
c.__add__() # should load __add__ instance directly
c + 1 # should call __add__ method directly

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 14 Column: 1

              c = C()
c.add # should call __getattr__
c.__add__() # should load __add__ instance directly
c + 1 # should call __add__ method directly

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test that __getattr__ and instance members don't override builtins
class C:
    def __init__(self):
        self.__add__ = lambda: print('member __add__')
    def __add__(self, x):
        print('__add__')
    def __getattr__(self, attr):
        print('__getattr__', attr)
        return None

            

Reported by Pylint.

Missing class docstring
Error

Line: 2 Column: 1

              # test that __getattr__ and instance members don't override builtins
class C:
    def __init__(self):
        self.__add__ = lambda: print('member __add__')
    def __add__(self, x):
        print('__add__')
    def __getattr__(self, attr):
        print('__getattr__', attr)
        return None

            

Reported by Pylint.

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

Line: 2 Column: 1

              # test that __getattr__ and instance members don't override builtins
class C:
    def __init__(self):
        self.__add__ = lambda: print('member __add__')
    def __add__(self, x):
        print('__add__')
    def __getattr__(self, attr):
        print('__getattr__', attr)
        return None

            

Reported by Pylint.

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

Line: 5 Column: 5

              class C:
    def __init__(self):
        self.__add__ = lambda: print('member __add__')
    def __add__(self, x):
        print('__add__')
    def __getattr__(self, attr):
        print('__getattr__', attr)
        return None


            

Reported by Pylint.

Useless return at end of function or method
Error

Line: 7 Column: 5

                      self.__add__ = lambda: print('member __add__')
    def __add__(self, x):
        print('__add__')
    def __getattr__(self, attr):
        print('__getattr__', attr)
        return None

c = C()
c.add # should call __getattr__

            

Reported by Pylint.

tests/cpydiff/core_import_split_ns_pkgs.py
8 issues
Unable to import 'subpkg.foo'
Error

Line: 12 Column: 1

              sys.path.append(sys.path[1] + "/modules")
sys.path.append(sys.path[1] + "/modules2")

import subpkg.foo
import subpkg.bar

print("Two modules of a split namespace package imported")

            

Reported by Pylint.

Unable to import 'subpkg.bar'
Error

Line: 13 Column: 1

              sys.path.append(sys.path[1] + "/modules2")

import subpkg.foo
import subpkg.bar

print("Two modules of a split namespace package imported")

            

Reported by Pylint.

Unused import subpkg.foo
Error

Line: 12 Column: 1

              sys.path.append(sys.path[1] + "/modules")
sys.path.append(sys.path[1] + "/modules2")

import subpkg.foo
import subpkg.bar

print("Two modules of a split namespace package imported")

            

Reported by Pylint.

Unused import subpkg.bar
Error

Line: 13 Column: 1

              sys.path.append(sys.path[1] + "/modules2")

import subpkg.foo
import subpkg.bar

print("Two modules of a split namespace package imported")

            

Reported by Pylint.

Line too long (132/100)
Error

Line: 4 Column: 1

              """
categories: Core,import
description: MicroPython does't support namespace packages split across filesystem.
cause: MicroPython's import system is highly optimized for simplicity, minimal memory usage, and minimal filesystem search overhead.
workaround: Don't install modules belonging to the same namespace package in different directories. For MicroPython, it's recommended to have at most 3-component module search paths: for your current application, per-user (writable), system-wide (non-writable).
"""
import sys

sys.path.append(sys.path[1] + "/modules")

            

Reported by Pylint.

Line too long (261/100)
Error

Line: 5 Column: 1

              categories: Core,import
description: MicroPython does't support namespace packages split across filesystem.
cause: MicroPython's import system is highly optimized for simplicity, minimal memory usage, and minimal filesystem search overhead.
workaround: Don't install modules belonging to the same namespace package in different directories. For MicroPython, it's recommended to have at most 3-component module search paths: for your current application, per-user (writable), system-wide (non-writable).
"""
import sys

sys.path.append(sys.path[1] + "/modules")
sys.path.append(sys.path[1] + "/modules2")

            

Reported by Pylint.

Import "import subpkg.foo" should be placed at the top of the module
Error

Line: 12 Column: 1

              sys.path.append(sys.path[1] + "/modules")
sys.path.append(sys.path[1] + "/modules2")

import subpkg.foo
import subpkg.bar

print("Two modules of a split namespace package imported")

            

Reported by Pylint.

Import "import subpkg.bar" should be placed at the top of the module
Error

Line: 13 Column: 1

              sys.path.append(sys.path[1] + "/modules2")

import subpkg.foo
import subpkg.bar

print("Two modules of a split namespace package imported")

            

Reported by Pylint.

examples/hwapi/soft_pwm2_uasyncio.py
8 issues
Unable to import 'uasyncio'
Error

Line: 3 Column: 1

              # Like soft_pwm_uasyncio.py, but fading 2 LEDs with different phase.
# Also see original soft_pwm.py.
import uasyncio
from hwconfig import LED, LED2


async def pwm_cycle(led, duty, cycles):
    duty_off = 20 - duty
    for i in range(cycles):

            

Reported by Pylint.

Unable to import 'hwconfig'
Error

Line: 4 Column: 1

              # Like soft_pwm_uasyncio.py, but fading 2 LEDs with different phase.
# Also see original soft_pwm.py.
import uasyncio
from hwconfig import LED, LED2


async def pwm_cycle(led, duty, cycles):
    duty_off = 20 - duty
    for i in range(cycles):

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 9 Column: 9

              
async def pwm_cycle(led, duty, cycles):
    duty_off = 20 - duty
    for i in range(cycles):
        if duty:
            led.value(1)
            await uasyncio.sleep_ms(duty)
        if duty_off:
            led.value(0)

            

Reported by Pylint.

Redefining name 'LED' from outer scope (line 4)
Error

Line: 18 Column: 23

                          await uasyncio.sleep_ms(duty_off)


async def fade_in_out(LED):
    while True:
        # Fade in
        for i in range(1, 21):
            await pwm_cycle(LED, i, 2)
        # Fade out

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Like soft_pwm_uasyncio.py, but fading 2 LEDs with different phase.
# Also see original soft_pwm.py.
import uasyncio
from hwconfig import LED, LED2


async def pwm_cycle(led, duty, cycles):
    duty_off = 20 - duty
    for i in range(cycles):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              from hwconfig import LED, LED2


async def pwm_cycle(led, duty, cycles):
    duty_off = 20 - duty
    for i in range(cycles):
        if duty:
            led.value(1)
            await uasyncio.sleep_ms(duty)

            

Reported by Pylint.

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

Line: 18 Column: 1

                          await uasyncio.sleep_ms(duty_off)


async def fade_in_out(LED):
    while True:
        # Fade in
        for i in range(1, 21):
            await pwm_cycle(LED, i, 2)
        # Fade out

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 1

                          await uasyncio.sleep_ms(duty_off)


async def fade_in_out(LED):
    while True:
        # Fade in
        for i in range(1, 21):
            await pwm_cycle(LED, i, 2)
        # Fade out

            

Reported by Pylint.

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/cpydiff/core_class_superproperty.py
8 issues
Line too long (101/100)
Error

Line: 3 Column: 1

              """
categories: Core,Classes
description: Calling super() getter property in subclass will return a property object, not the value
cause: Unknown
workaround: Unknown
"""


class A:

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 9 Column: 1

              """


class A:
    @property
    def p(self):
        return {"a": 10}



            

Reported by Pylint.

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

Line: 9 Column: 1

              """


class A:
    @property
    def p(self):
        return {"a": 10}



            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

              """


class A:
    @property
    def p(self):
        return {"a": 10}



            

Reported by Pylint.

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

Line: 11 Column: 5

              
class A:
    @property
    def p(self):
        return {"a": 10}


class AA(A):
    @property

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 5

              
class A:
    @property
    def p(self):
        return {"a": 10}


class AA(A):
    @property

            

Reported by Pylint.

Missing class docstring
Error

Line: 15 Column: 1

                      return {"a": 10}


class AA(A):
    @property
    def p(self):
        return super().p



            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 15 Column: 1

                      return {"a": 10}


class AA(A):
    @property
    def p(self):
        return super().p



            

Reported by Pylint.

tests/cmdline/cmd_parsetree.py
8 issues
Missing module docstring
Error

Line: 1 Column: 1

              # cmdline: -v -v -v
# test printing of the parse-tree

for i in ():
    pass
a = None
b = "str"
c = "a very long str that will not be interned"
d = b"bytes"

            

Reported by Pylint.

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

Line: 6 Column: 1

              
for i in ():
    pass
a = None
b = "str"
c = "a very long str that will not be interned"
d = b"bytes"
e = b"a very long bytes that will not be interned"
f = 123456789012345678901234567890

            

Reported by Pylint.

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

Line: 7 Column: 1

              for i in ():
    pass
a = None
b = "str"
c = "a very long str that will not be interned"
d = b"bytes"
e = b"a very long bytes that will not be interned"
f = 123456789012345678901234567890
g = 123

            

Reported by Pylint.

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

Line: 8 Column: 1

                  pass
a = None
b = "str"
c = "a very long str that will not be interned"
d = b"bytes"
e = b"a very long bytes that will not be interned"
f = 123456789012345678901234567890
g = 123
h = f"fstring: '{b}'"

            

Reported by Pylint.

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

Line: 9 Column: 1

              a = None
b = "str"
c = "a very long str that will not be interned"
d = b"bytes"
e = b"a very long bytes that will not be interned"
f = 123456789012345678901234567890
g = 123
h = f"fstring: '{b}'"

            

Reported by Pylint.

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

Line: 10 Column: 1

              b = "str"
c = "a very long str that will not be interned"
d = b"bytes"
e = b"a very long bytes that will not be interned"
f = 123456789012345678901234567890
g = 123
h = f"fstring: '{b}'"

            

Reported by Pylint.

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

Line: 11 Column: 1

              c = "a very long str that will not be interned"
d = b"bytes"
e = b"a very long bytes that will not be interned"
f = 123456789012345678901234567890
g = 123
h = f"fstring: '{b}'"

            

Reported by Pylint.

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

Line: 12 Column: 1

              d = b"bytes"
e = b"a very long bytes that will not be interned"
f = 123456789012345678901234567890
g = 123
h = f"fstring: '{b}'"

            

Reported by Pylint.

tests/cpydiff/core_generator_noexit.py
8 issues
Class 'foo' inherits from object, can be safely removed from bases in python3
Error

Line: 9 Column: 1

              """


class foo(object):
    def __enter__(self):
        print("Enter")

    def __exit__(self, *args):
        print("Exit")

            

Reported by Pylint.

Black listed name "foo"
Error

Line: 9 Column: 1

              """


class foo(object):
    def __enter__(self):
        print("Enter")

    def __exit__(self, *args):
        print("Exit")

            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

              """


class foo(object):
    def __enter__(self):
        print("Enter")

    def __exit__(self, *args):
        print("Exit")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

                      print("Exit")


def bar(x):
    with foo():
        while True:
            x += 1
            yield x


            

Reported by Pylint.

Black listed name "bar"
Error

Line: 17 Column: 1

                      print("Exit")


def bar(x):
    with foo():
        while True:
            x += 1
            yield x


            

Reported by Pylint.

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

Line: 17 Column: 1

                      print("Exit")


def bar(x):
    with foo():
        while True:
            x += 1
            yield x


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 1

                          yield x


def func():
    g = bar(0)
    for _ in range(3):
        print(next(g))



            

Reported by Pylint.

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

Line: 25 Column: 5

              

def func():
    g = bar(0)
    for _ in range(3):
        print(next(g))


func()

            

Reported by Pylint.

tests/float/float_divmod_relaxed.py
8 issues
Redefining name 'x' from outer scope (line 26)
Error

Line: 8 Column: 10

              # correct) answers for certain combinations of divmod arguments.


def test(x, y):
    div, mod = divmod(x, y)
    print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-6)


test(1.23456, 0.7)

            

Reported by Pylint.

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

Line: 8 Column: 13

              # correct) answers for certain combinations of divmod arguments.


def test(x, y):
    div, mod = divmod(x, y)
    print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-6)


test(1.23456, 0.7)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test floating point floor divide and modulus
# it has some tricky corner cases

# pyboard has 32-bit floating point and gives different (but still
# correct) answers for certain combinations of divmod arguments.


def test(x, y):
    div, mod = divmod(x, y)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

              # correct) answers for certain combinations of divmod arguments.


def test(x, y):
    div, mod = divmod(x, y)
    print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-6)


test(1.23456, 0.7)

            

Reported by Pylint.

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

Line: 8 Column: 1

              # correct) answers for certain combinations of divmod arguments.


def test(x, y):
    div, mod = divmod(x, y)
    print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-6)


test(1.23456, 0.7)

            

Reported by Pylint.

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

Line: 8 Column: 1

              # correct) answers for certain combinations of divmod arguments.


def test(x, y):
    div, mod = divmod(x, y)
    print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-6)


test(1.23456, 0.7)

            

Reported by Pylint.

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

Line: 18 Column: 1

              test(1.23456, -0.7)
test(-1.23456, -0.7)

a = 1.23456
b = 0.7
test(a, b)
test(a, -b)
test(-a, b)
test(-a, -b)

            

Reported by Pylint.

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

Line: 19 Column: 1

              test(-1.23456, -0.7)

a = 1.23456
b = 0.7
test(a, b)
test(a, -b)
test(-a, b)
test(-a, -b)


            

Reported by Pylint.

ports/qemu-arm/test-frzmpy/native_frozen_align.py
8 issues
Unable to import 'micropython'
Error

Line: 1 Column: 1

              import micropython


@micropython.native
def native_x(x):
    print(x + 1)


@micropython.native

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import micropython


@micropython.native
def native_x(x):
    print(x + 1)


@micropython.native

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 1

              

@micropython.native
def native_x(x):
    print(x + 1)


@micropython.native
def native_y(x):

            

Reported by Pylint.

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

Line: 5 Column: 1

              

@micropython.native
def native_x(x):
    print(x + 1)


@micropython.native
def native_y(x):

            

Reported by Pylint.

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

Line: 10 Column: 1

              

@micropython.native
def native_y(x):
    print(x + 1)


@micropython.native
def native_z(x):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 10 Column: 1

              

@micropython.native
def native_y(x):
    print(x + 1)


@micropython.native
def native_z(x):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 1

              

@micropython.native
def native_z(x):
    print(x + 1)

            

Reported by Pylint.

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

Line: 15 Column: 1

              

@micropython.native
def native_z(x):
    print(x + 1)

            

Reported by Pylint.