The following issues were found
examples/hwapi/soft_pwm_uasyncio.py
8 issues
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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
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.
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: 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.
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: 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: 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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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
Line: 2
Column: 5
try:
import uheapq as heapq
except:
try:
import heapq
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 3
Column: 1
try:
import uheapq as heapq
except:
try:
import heapq
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 8
Column: 9
import heapq
except ImportError:
print("SKIP")
raise SystemExit
try:
heapq.heappop([])
except IndexError:
print("IndexError")
Reported by Pylint.
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.
Line: 1
Column: 1
try:
import uheapq as heapq
except:
try:
import heapq
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
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.
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.
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: 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.
Line: 9
Column: 1
"""
class A:
@property
def p(self):
return {"a": 10}
Reported by Pylint.
Line: 9
Column: 1
"""
class A:
@property
def p(self):
return {"a": 10}
Reported by Pylint.
Line: 9
Column: 1
"""
class A:
@property
def p(self):
return {"a": 10}
Reported by Pylint.
Line: 11
Column: 5
class A:
@property
def p(self):
return {"a": 10}
class AA(A):
@property
Reported by Pylint.
Line: 11
Column: 5
class A:
@property
def p(self):
return {"a": 10}
class AA(A):
@property
Reported by Pylint.
Line: 15
Column: 1
return {"a": 10}
class AA(A):
@property
def p(self):
return super().p
Reported by Pylint.
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
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.
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.
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.
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.
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.
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.
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.
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
Line: 9
Column: 1
"""
class foo(object):
def __enter__(self):
print("Enter")
def __exit__(self, *args):
print("Exit")
Reported by Pylint.
Line: 9
Column: 1
"""
class foo(object):
def __enter__(self):
print("Enter")
def __exit__(self, *args):
print("Exit")
Reported by Pylint.
Line: 9
Column: 1
"""
class foo(object):
def __enter__(self):
print("Enter")
def __exit__(self, *args):
print("Exit")
Reported by Pylint.
Line: 17
Column: 1
print("Exit")
def bar(x):
with foo():
while True:
x += 1
yield x
Reported by Pylint.
Line: 17
Column: 1
print("Exit")
def bar(x):
with foo():
while True:
x += 1
yield x
Reported by Pylint.
Line: 17
Column: 1
print("Exit")
def bar(x):
with foo():
while True:
x += 1
yield x
Reported by Pylint.
Line: 24
Column: 1
yield x
def func():
g = bar(0)
for _ in range(3):
print(next(g))
Reported by Pylint.
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
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.
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.
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.
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.
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.
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.
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.
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
Line: 1
Column: 1
import micropython
@micropython.native
def native_x(x):
print(x + 1)
@micropython.native
Reported by Pylint.
Line: 1
Column: 1
import micropython
@micropython.native
def native_x(x):
print(x + 1)
@micropython.native
Reported by Pylint.
Line: 5
Column: 1
@micropython.native
def native_x(x):
print(x + 1)
@micropython.native
def native_y(x):
Reported by Pylint.
Line: 5
Column: 1
@micropython.native
def native_x(x):
print(x + 1)
@micropython.native
def native_y(x):
Reported by Pylint.
Line: 10
Column: 1
@micropython.native
def native_y(x):
print(x + 1)
@micropython.native
def native_z(x):
Reported by Pylint.
Line: 10
Column: 1
@micropython.native
def native_y(x):
print(x + 1)
@micropython.native
def native_z(x):
Reported by Pylint.
Line: 15
Column: 1
@micropython.native
def native_z(x):
print(x + 1)
Reported by Pylint.
Line: 15
Column: 1
@micropython.native
def native_z(x):
print(x + 1)
Reported by Pylint.