The following issues were found
ports/esp32/boards/UM_TINYS2/modules/tinys2.py
13 issues
Line: 10
Column: 1
# 2021-Apr-10 - v0.1 - Initial implementation
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time
# TinyS2 Hardware Pin Assignments
Reported by Pylint.
Line: 11
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time
# TinyS2 Hardware Pin Assignments
# Sense Pins
Reported by Pylint.
Line: 12
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time
# TinyS2 Hardware Pin Assignments
# Sense Pins
VBUS_SENSE = const(21)
Reported by Pylint.
Line: 11
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time
# TinyS2 Hardware Pin Assignments
# Sense Pins
Reported by Pylint.
Line: 12
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time
# TinyS2 Hardware Pin Assignments
# Sense Pins
VBUS_SENSE = const(21)
Reported by Pylint.
Line: 1
Column: 1
# TinyS2 MicroPython Helper Library
# 2021 Seon Rozenblum - Unexpected Maker
#
# Project home:
# https://tinys2.io
#
# 2021-Apr-10 - v0.1 - Initial implementation
# Import required libraries
Reported by Pylint.
Line: 12
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time
# TinyS2 Hardware Pin Assignments
# Sense Pins
VBUS_SENSE = const(21)
Reported by Pylint.
Line: 12
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time
# TinyS2 Hardware Pin Assignments
# Sense Pins
VBUS_SENSE = const(21)
Reported by Pylint.
Line: 41
Column: 1
# Helper functions
def set_pixel_power(state):
"""Enable or Disable power to the onboard NeoPixel to either show colour, or to reduce power for deep sleep."""
Pin(RGB_PWR, Pin.OUT).value(state)
def get_battery_voltage():
"""
Reported by Pylint.
Line: 47
Column: 1
def get_battery_voltage():
"""
Returns the current battery voltage. If no battery is connected, returns 4.2V which is the charge voltage
This is an approximation only, but useful to detect if the charge state of the battery is getting low.
"""
adc = ADC(Pin(VBAT_SENSE)) # Assign the ADC pin to read
measuredvbat = adc.read() # Read the value
measuredvbat /= 8192 # divide by 8192 as we are using the default ADC voltage range of 0-1V
Reported by Pylint.
tests/basics/decorator.py
13 issues
Line: 3
Column: 9
# test decorators
def dec(f):
print('dec')
return f
def dec_arg(x):
print(x)
return lambda f:f
Reported by Pylint.
Line: 1
Column: 1
# test decorators
def dec(f):
print('dec')
return f
def dec_arg(x):
print(x)
return lambda f:f
Reported by Pylint.
Line: 3
Column: 1
# test decorators
def dec(f):
print('dec')
return f
def dec_arg(x):
print(x)
return lambda f:f
Reported by Pylint.
Line: 3
Column: 1
# test decorators
def dec(f):
print('dec')
return f
def dec_arg(x):
print(x)
return lambda f:f
Reported by Pylint.
Line: 7
Column: 1
print('dec')
return f
def dec_arg(x):
print(x)
return lambda f:f
# plain decorator
@dec
Reported by Pylint.
Line: 7
Column: 1
print('dec')
return f
def dec_arg(x):
print(x)
return lambda f:f
# plain decorator
@dec
Reported by Pylint.
Line: 13
Column: 1
# plain decorator
@dec
def f():
pass
# decorator with arg
@dec_arg('dec_arg')
def g():
Reported by Pylint.
Line: 13
Column: 1
# plain decorator
@dec
def f():
pass
# decorator with arg
@dec_arg('dec_arg')
def g():
Reported by Pylint.
Line: 18
Column: 1
# decorator with arg
@dec_arg('dec_arg')
def g():
pass
# decorator of class
@dec
class A:
Reported by Pylint.
Line: 18
Column: 1
# decorator with arg
@dec_arg('dec_arg')
def g():
pass
# decorator of class
@dec
class A:
Reported by Pylint.
tests/basics/subclass_native1.py
13 issues
Line: 6
Column: 1
a = mylist([1, 2, 5])
# Test setting instance attr
a.attr = "something"
# Test base type __str__
print(a)
# Test getting instance attr
print(a.attr)
# Test base type ->subscr
Reported by Pylint.
Line: 21
Column: 3
# Test binary op of base type, with 2nd arg being raw base type
print(a + [20, 30, 40])
# Test binary op of base type, with 2nd arg being same class as 1st arg
# TODO: Faults
#print(a + a)
def foo():
print("hello from foo")
Reported by Pylint.
Line: 36
Column: 9
# multiple bases with layout conflict
try:
class A(type, tuple):
None
except TypeError:
print('TypeError')
Reported by Pylint.
Line: 1
Column: 1
class mylist(list):
pass
a = mylist([1, 2, 5])
# Test setting instance attr
a.attr = "something"
# Test base type __str__
print(a)
# Test getting instance attr
Reported by Pylint.
Line: 1
Column: 1
class mylist(list):
pass
a = mylist([1, 2, 5])
# Test setting instance attr
a.attr = "something"
# Test base type __str__
print(a)
# Test getting instance attr
Reported by Pylint.
Line: 1
Column: 1
class mylist(list):
pass
a = mylist([1, 2, 5])
# Test setting instance attr
a.attr = "something"
# Test base type __str__
print(a)
# Test getting instance attr
Reported by Pylint.
Line: 24
Column: 1
# TODO: Faults
#print(a + a)
def foo():
print("hello from foo")
try:
class myfunc(type(foo)):
pass
Reported by Pylint.
Line: 24
Column: 1
# TODO: Faults
#print(a + a)
def foo():
print("hello from foo")
try:
class myfunc(type(foo)):
pass
Reported by Pylint.
Line: 28
Column: 5
print("hello from foo")
try:
class myfunc(type(foo)):
pass
except TypeError:
print("TypeError")
# multiple bases with layout conflict
Reported by Pylint.
Line: 28
Column: 5
print("hello from foo")
try:
class myfunc(type(foo)):
pass
except TypeError:
print("TypeError")
# multiple bases with layout conflict
Reported by Pylint.
tests/basics/with1.py
13 issues
Line: 7
Column: 24
print("__enter__")
return self
def __exit__(self, a, b, c):
print("__exit__", repr(a), repr(b))
with CtxMgr() as a:
print(isinstance(a, CtxMgr))
Reported by Pylint.
Line: 27
Column: 24
print("__enter__")
return self
def __exit__(self, a, b, c):
print("__exit__", repr(a), repr(b))
return True
try:
with CtxMgr2() as a:
Reported by Pylint.
Line: 50
Column: 13
try:
try:
raise ValueError
print("No ValueError3")
finally:
print("finally1")
finally:
print("finally2")
Reported by Pylint.
Line: 63
Column: 21
try:
try:
raise ValueError
print("No ValueError3")
finally:
print("finally1")
finally:
print("finally2")
finally:
Reported by Pylint.
Line: 1
Column: 1
class CtxMgr:
def __enter__(self):
print("__enter__")
return self
def __exit__(self, a, b, c):
print("__exit__", repr(a), repr(b))
Reported by Pylint.
Line: 1
Column: 1
class CtxMgr:
def __enter__(self):
print("__enter__")
return self
def __exit__(self, a, b, c):
print("__exit__", repr(a), repr(b))
Reported by Pylint.
Line: 7
Column: 5
print("__enter__")
return self
def __exit__(self, a, b, c):
print("__exit__", repr(a), repr(b))
with CtxMgr() as a:
print(isinstance(a, CtxMgr))
Reported by Pylint.
Line: 7
Column: 5
print("__enter__")
return self
def __exit__(self, a, b, c):
print("__exit__", repr(a), repr(b))
with CtxMgr() as a:
print(isinstance(a, CtxMgr))
Reported by Pylint.
Line: 7
Column: 5
print("__enter__")
return self
def __exit__(self, a, b, c):
print("__exit__", repr(a), repr(b))
with CtxMgr() as a:
print(isinstance(a, CtxMgr))
Reported by Pylint.
Line: 21
Column: 1
print("ValueError")
class CtxMgr2:
def __enter__(self):
print("__enter__")
return self
Reported by Pylint.
examples/mandel.py
13 issues
Line: 27
Column: 1
# PC testing
import lcd
lcd = lcd.LCD(128, 32)
mandelbrot()
Reported by Pylint.
Line: 2
Column: 5
try:
import micropython
except:
pass
def mandelbrot():
# returns True if c, complex, is in the Mandelbrot set
# @micropython.native
Reported by Pylint.
Line: 3
Column: 1
try:
import micropython
except:
pass
def mandelbrot():
# returns True if c, complex, is in the Mandelbrot set
# @micropython.native
Reported by Pylint.
Line: 12
Column: 13
# @micropython.native
def in_set(c):
z = 0
for i in range(40):
z = z * z + c
if abs(z) > 60:
return False
return True
Reported by Pylint.
Line: 1
Column: 1
try:
import micropython
except:
pass
def mandelbrot():
# returns True if c, complex, is in the Mandelbrot set
# @micropython.native
Reported by Pylint.
Line: 3
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b110_try_except_pass.html
try:
import micropython
except:
pass
def mandelbrot():
# returns True if c, complex, is in the Mandelbrot set
# @micropython.native
Reported by Bandit.
Line: 7
Column: 1
pass
def mandelbrot():
# returns True if c, complex, is in the Mandelbrot set
# @micropython.native
def in_set(c):
z = 0
for i in range(40):
Reported by Pylint.
Line: 10
Column: 5
def mandelbrot():
# returns True if c, complex, is in the Mandelbrot set
# @micropython.native
def in_set(c):
z = 0
for i in range(40):
z = z * z + c
if abs(z) > 60:
return False
Reported by Pylint.
Line: 11
Column: 9
# returns True if c, complex, is in the Mandelbrot set
# @micropython.native
def in_set(c):
z = 0
for i in range(40):
z = z * z + c
if abs(z) > 60:
return False
return True
Reported by Pylint.
Line: 13
Column: 13
def in_set(c):
z = 0
for i in range(40):
z = z * z + c
if abs(z) > 60:
return False
return True
lcd.clear()
Reported by Pylint.
tests/extmod/uasyncio_event_fair.py
13 issues
Line: 11
Column: 9
import asyncio
except ImportError:
print("SKIP")
raise SystemExit
async def task1(id):
for i in range(4):
print("sleep", id)
Reported by Pylint.
Line: 14
Column: 17
raise SystemExit
async def task1(id):
for i in range(4):
print("sleep", id)
await asyncio.sleep(0)
Reported by Pylint.
Line: 15
Column: 9
async def task1(id):
for i in range(4):
print("sleep", id)
await asyncio.sleep(0)
async def task2(id, ev):
Reported by Pylint.
Line: 20
Column: 17
await asyncio.sleep(0)
async def task2(id, ev):
for i in range(4):
ev.set()
ev.clear()
print("wait", id)
await ev.wait()
Reported by Pylint.
Line: 21
Column: 9
async def task2(id, ev):
for i in range(4):
ev.set()
ev.clear()
print("wait", id)
await ev.wait()
Reported by Pylint.
Line: 1
Column: 1
# Test fairness of Event.set()
# That tasks which continuously wait on events don't take over the scheduler
try:
import uasyncio as asyncio
except ImportError:
try:
import asyncio
except ImportError:
Reported by Pylint.
Line: 14
Column: 1
raise SystemExit
async def task1(id):
for i in range(4):
print("sleep", id)
await asyncio.sleep(0)
Reported by Pylint.
Line: 14
Column: 1
raise SystemExit
async def task1(id):
for i in range(4):
print("sleep", id)
await asyncio.sleep(0)
Reported by Pylint.
Line: 20
Column: 1
await asyncio.sleep(0)
async def task2(id, ev):
for i in range(4):
ev.set()
ev.clear()
print("wait", id)
await ev.wait()
Reported by Pylint.
Line: 20
Column: 1
await asyncio.sleep(0)
async def task2(id, ev):
for i in range(4):
ev.set()
ev.clear()
print("wait", id)
await ev.wait()
Reported by Pylint.
tests/inlineasm/asmdiv.py
13 issues
Line: 1
Column: 2
@micropython.asm_thumb
def sdiv(r0, r1):
sdiv(r0, r0, r1)
@micropython.asm_thumb
def udiv(r0, r1):
udiv(r0, r0, r1)
Reported by Pylint.
Line: 3
Column: 5
@micropython.asm_thumb
def sdiv(r0, r1):
sdiv(r0, r0, r1)
@micropython.asm_thumb
def udiv(r0, r1):
udiv(r0, r0, r1)
Reported by Pylint.
Line: 6
Column: 2
sdiv(r0, r0, r1)
@micropython.asm_thumb
def udiv(r0, r1):
udiv(r0, r0, r1)
print(sdiv(1234, 3))
Reported by Pylint.
Line: 8
Column: 5
@micropython.asm_thumb
def udiv(r0, r1):
udiv(r0, r0, r1)
print(sdiv(1234, 3))
print(sdiv(-1234, 3))
print(sdiv(1234, -3))
Reported by Pylint.
Line: 3
Column: 5
@micropython.asm_thumb
def sdiv(r0, r1):
sdiv(r0, r0, r1)
@micropython.asm_thumb
def udiv(r0, r1):
udiv(r0, r0, r1)
Reported by Pylint.
Line: 8
Column: 5
@micropython.asm_thumb
def udiv(r0, r1):
udiv(r0, r0, r1)
print(sdiv(1234, 3))
print(sdiv(-1234, 3))
print(sdiv(1234, -3))
Reported by Pylint.
Line: 1
Column: 1
@micropython.asm_thumb
def sdiv(r0, r1):
sdiv(r0, r0, r1)
@micropython.asm_thumb
def udiv(r0, r1):
udiv(r0, r0, r1)
Reported by Pylint.
Line: 2
Column: 1
@micropython.asm_thumb
def sdiv(r0, r1):
sdiv(r0, r0, r1)
@micropython.asm_thumb
def udiv(r0, r1):
udiv(r0, r0, r1)
Reported by Pylint.
Line: 2
Column: 1
@micropython.asm_thumb
def sdiv(r0, r1):
sdiv(r0, r0, r1)
@micropython.asm_thumb
def udiv(r0, r1):
udiv(r0, r0, r1)
Reported by Pylint.
Line: 2
Column: 1
@micropython.asm_thumb
def sdiv(r0, r1):
sdiv(r0, r0, r1)
@micropython.asm_thumb
def udiv(r0, r1):
udiv(r0, r0, r1)
Reported by Pylint.
tests/net_inet/tls_text_errors.py
13 issues
Line: 4
Column: 5
# test that modtls produces a text error message
try:
import usocket as socket, ussl as ssl, sys
except:
import socket, ssl, sys
def test(addr):
Reported by Pylint.
Line: 5
Column: 1
try:
import usocket as socket, ussl as ssl, sys
except:
import socket, ssl, sys
def test(addr):
s = socket.socket()
Reported by Pylint.
Line: 9
Column: 10
import socket, ssl, sys
def test(addr):
s = socket.socket()
s.connect(addr)
try:
s = ssl.wrap_socket(s)
print("wrap: no exception")
Reported by Pylint.
Line: 13
Column: 13
s = socket.socket()
s.connect(addr)
try:
s = ssl.wrap_socket(s)
print("wrap: no exception")
except OSError as e:
# mbedtls produces "mbedtls -0x7200: SSL - An invalid SSL record was received"
# axtls produces "RECORD_OVERFLOW" but also prints "TLS buffer overflow,..."
# CPython produces "[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1108)"
Reported by Pylint.
Line: 1
Column: 1
# test that modtls produces a text error message
try:
import usocket as socket, ussl as ssl, sys
except:
import socket, ssl, sys
def test(addr):
Reported by Pylint.
Line: 4
Column: 5
# test that modtls produces a text error message
try:
import usocket as socket, ussl as ssl, sys
except:
import socket, ssl, sys
def test(addr):
Reported by Pylint.
Line: 6
Column: 5
try:
import usocket as socket, ussl as ssl, sys
except:
import socket, ssl, sys
def test(addr):
s = socket.socket()
s.connect(addr)
Reported by Pylint.
Line: 6
Column: 5
try:
import usocket as socket, ussl as ssl, sys
except:
import socket, ssl, sys
def test(addr):
s = socket.socket()
s.connect(addr)
Reported by Pylint.
Line: 9
Column: 1
import socket, ssl, sys
def test(addr):
s = socket.socket()
s.connect(addr)
try:
s = ssl.wrap_socket(s)
print("wrap: no exception")
Reported by Pylint.
Line: 10
Column: 5
def test(addr):
s = socket.socket()
s.connect(addr)
try:
s = ssl.wrap_socket(s)
print("wrap: no exception")
except OSError as e:
Reported by Pylint.
tests/float/string_format2.py
13 issues
Line: 155
Column: 36
for prec in ("1", "2", "3"):
for num in f_nums:
test_fmt("", fill, alignment, sign, "", width, prec, type, num)
for num in int_nums2:
test_fmt("", fill, alignment, sign, "", width, "", type, num)
pct_nums1 = (0.1, 0.58, 0.99, -0.1, -0.58, -0.99)
pct_nums2 = (True, False, 1, 0, -1)
Reported by Pylint.
Line: 11
Column: 69
print("{:8s}".format(fmt) + ">" + fmt.format(*args) + "<")
def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg):
fmt = "{"
if conv:
fmt += "!"
fmt += conv
fmt += ":"
Reported by Pylint.
Line: 11
Column: 20
print("{:8s}".format(fmt) + ">" + fmt.format(*args) + "<")
def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg):
fmt = "{"
if conv:
fmt += "!"
fmt += conv
fmt += ":"
Reported by Pylint.
Line: 11
Column: 37
print("{:8s}".format(fmt) + ">" + fmt.format(*args) + "<")
def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg):
fmt = "{"
if conv:
fmt += "!"
fmt += conv
fmt += ":"
Reported by Pylint.
Line: 11
Column: 26
print("{:8s}".format(fmt) + ">" + fmt.format(*args) + "<")
def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg):
fmt = "{"
if conv:
fmt += "!"
fmt += conv
fmt += ":"
Reported by Pylint.
Line: 11
Column: 51
print("{:8s}".format(fmt) + ">" + fmt.format(*args) + "<")
def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg):
fmt = "{"
if conv:
fmt += "!"
fmt += conv
fmt += ":"
Reported by Pylint.
Line: 102
Column: 9
)
if full_tests:
for type in ("e", "E", "g", "G", "n"):
for width in ("", "4", "6", "8", "10"):
for alignment in ("", "<", ">", "=", "^"):
for fill in ("", "@", "0", " "):
for sign in ("", "+", "-", " "):
for prec in ("", "1", "3", "6"):
Reported by Pylint.
Line: 1
Column: 1
# Change the following to True to get a much more comprehensive set of tests
# to run, albeit, which take considerably longer.
full_tests = False
def test(fmt, *args):
print("{:8s}".format(fmt) + ">" + fmt.format(*args) + "<")
Reported by Pylint.
Line: 4
Column: 1
# Change the following to True to get a much more comprehensive set of tests
# to run, albeit, which take considerably longer.
full_tests = False
def test(fmt, *args):
print("{:8s}".format(fmt) + ">" + fmt.format(*args) + "<")
Reported by Pylint.
Line: 7
Column: 1
full_tests = False
def test(fmt, *args):
print("{:8s}".format(fmt) + ">" + fmt.format(*args) + "<")
def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg):
fmt = "{"
Reported by Pylint.
tests/basics/class_inherit1.py
13 issues
Line: 7
Column: 23
self.x = x
def f(self):
print(self.x, self.y)
class B(A):
def __init__(self, x, y):
A.__init__(self, x)
print('B init', x, y)
Reported by Pylint.
Line: 1
Column: 1
class A:
def __init__(self, x):
print('A init', x)
self.x = x
def f(self):
print(self.x, self.y)
class B(A):
Reported by Pylint.
Line: 1
Column: 1
class A:
def __init__(self, x):
print('A init', x)
self.x = x
def f(self):
print(self.x, self.y)
class B(A):
Reported by Pylint.
Line: 1
Column: 1
class A:
def __init__(self, x):
print('A init', x)
self.x = x
def f(self):
print(self.x, self.y)
class B(A):
Reported by Pylint.
Line: 1
Column: 1
class A:
def __init__(self, x):
print('A init', x)
self.x = x
def f(self):
print(self.x, self.y)
class B(A):
Reported by Pylint.
Line: 4
Column: 9
class A:
def __init__(self, x):
print('A init', x)
self.x = x
def f(self):
print(self.x, self.y)
class B(A):
Reported by Pylint.
Line: 6
Column: 5
print('A init', x)
self.x = x
def f(self):
print(self.x, self.y)
class B(A):
def __init__(self, x, y):
A.__init__(self, x)
Reported by Pylint.
Line: 6
Column: 5
print('A init', x)
self.x = x
def f(self):
print(self.x, self.y)
class B(A):
def __init__(self, x, y):
A.__init__(self, x)
Reported by Pylint.
Line: 9
Column: 1
def f(self):
print(self.x, self.y)
class B(A):
def __init__(self, x, y):
A.__init__(self, x)
print('B init', x, y)
self.y = y
Reported by Pylint.
Line: 9
Column: 1
def f(self):
print(self.x, self.y)
class B(A):
def __init__(self, x, y):
A.__init__(self, x)
print('B init', x, y)
self.y = y
Reported by Pylint.