The following issues were found

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/basics/equal_class.py
14 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test equality for classes/instances to other types

class A:
    pass

class B:
    pass

class C(A):

            

Reported by Pylint.

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

Line: 3 Column: 1

              # test equality for classes/instances to other types

class A:
    pass

class B:
    pass

class C(A):

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 3 Column: 1

              # test equality for classes/instances to other types

class A:
    pass

class B:
    pass

class C(A):

            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              # test equality for classes/instances to other types

class A:
    pass

class B:
    pass

class C(A):

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 6 Column: 1

              class A:
    pass

class B:
    pass

class C(A):
    pass


            

Reported by Pylint.

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

Line: 6 Column: 1

              class A:
    pass

class B:
    pass

class C(A):
    pass


            

Reported by Pylint.

Missing class docstring
Error

Line: 6 Column: 1

              class A:
    pass

class B:
    pass

class C(A):
    pass


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 9 Column: 1

              class B:
    pass

class C(A):
    pass

print(A == None)
print(None == A)


            

Reported by Pylint.

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

Line: 9 Column: 1

              class B:
    pass

class C(A):
    pass

print(A == None)
print(None == A)


            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

              class B:
    pass

class C(A):
    pass

print(A == None)
print(None == A)


            

Reported by Pylint.

tests/extmod/ticks_diff.py
14 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 5 Column: 5

                  from utime import ticks_diff, ticks_add
except ImportError:
    print("SKIP")
    raise SystemExit

MAX = ticks_add(0, -1)
# Should be done like this to avoid small int overflow
MODULO_HALF = MAX // 2 + 1


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    from utime import ticks_diff, ticks_add
except ImportError:
    print("SKIP")
    raise SystemExit

MAX = ticks_add(0, -1)
# Should be done like this to avoid small int overflow
MODULO_HALF = MAX // 2 + 1

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 15
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              # if ticks_diff(a, b) = c,
# then ticks_diff(b, a) = -c

assert ticks_diff(1, 0) == 1, ticks_diff(1, 0)
assert ticks_diff(0, 1) == -1

assert ticks_diff(0, MAX) == 1
assert ticks_diff(MAX, 0) == -1


            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 16
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              # then ticks_diff(b, a) = -c

assert ticks_diff(1, 0) == 1, ticks_diff(1, 0)
assert ticks_diff(0, 1) == -1

assert ticks_diff(0, MAX) == 1
assert ticks_diff(MAX, 0) == -1

assert ticks_diff(0, MAX - 1) == 2

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 18
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              assert ticks_diff(1, 0) == 1, ticks_diff(1, 0)
assert ticks_diff(0, 1) == -1

assert ticks_diff(0, MAX) == 1
assert ticks_diff(MAX, 0) == -1

assert ticks_diff(0, MAX - 1) == 2

# Maximum "positive" distance

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 19
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              assert ticks_diff(0, 1) == -1

assert ticks_diff(0, MAX) == 1
assert ticks_diff(MAX, 0) == -1

assert ticks_diff(0, MAX - 1) == 2

# Maximum "positive" distance
assert ticks_diff(MODULO_HALF, 1) == MODULO_HALF - 1, ticks_diff(MODULO_HALF, 1)

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 21
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              assert ticks_diff(0, MAX) == 1
assert ticks_diff(MAX, 0) == -1

assert ticks_diff(0, MAX - 1) == 2

# Maximum "positive" distance
assert ticks_diff(MODULO_HALF, 1) == MODULO_HALF - 1, ticks_diff(MODULO_HALF, 1)
# Step further, and it becomes a negative distance
assert ticks_diff(MODULO_HALF, 0) == -MODULO_HALF

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 24
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              assert ticks_diff(0, MAX - 1) == 2

# Maximum "positive" distance
assert ticks_diff(MODULO_HALF, 1) == MODULO_HALF - 1, ticks_diff(MODULO_HALF, 1)
# Step further, and it becomes a negative distance
assert ticks_diff(MODULO_HALF, 0) == -MODULO_HALF

# Offsetting that in either direction doesn't affect the result
off = 100

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 26
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              # Maximum "positive" distance
assert ticks_diff(MODULO_HALF, 1) == MODULO_HALF - 1, ticks_diff(MODULO_HALF, 1)
# Step further, and it becomes a negative distance
assert ticks_diff(MODULO_HALF, 0) == -MODULO_HALF

# Offsetting that in either direction doesn't affect the result
off = 100
# Cheating and skipping to use ticks_add() when we know there's no wraparound
# Real apps should use always it.

            

Reported by Bandit.

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

Line: 29 Column: 1

              assert ticks_diff(MODULO_HALF, 0) == -MODULO_HALF

# Offsetting that in either direction doesn't affect the result
off = 100
# Cheating and skipping to use ticks_add() when we know there's no wraparound
# Real apps should use always it.
assert ticks_diff(MODULO_HALF + off, 1 + off) == MODULO_HALF - 1
assert ticks_diff(MODULO_HALF + off, 0 + off) == -MODULO_HALF
assert ticks_diff(MODULO_HALF - off, ticks_add(1, -off)) == MODULO_HALF - 1

            

Reported by Pylint.

tests/inlineasm/asmspecialregs.py
13 issues
Undefined variable 'micropython'
Error

Line: 1 Column: 2

              @micropython.asm_thumb
def getIPSR():
    mrs(r0, IPSR)


@micropython.asm_thumb
def getBASEPRI():
    mrs(r0, BASEPRI)


            

Reported by Pylint.

Undefined variable 'IPSR'
Error

Line: 3 Column: 13

              @micropython.asm_thumb
def getIPSR():
    mrs(r0, IPSR)


@micropython.asm_thumb
def getBASEPRI():
    mrs(r0, BASEPRI)


            

Reported by Pylint.

Undefined variable 'r0'
Error

Line: 3 Column: 9

              @micropython.asm_thumb
def getIPSR():
    mrs(r0, IPSR)


@micropython.asm_thumb
def getBASEPRI():
    mrs(r0, BASEPRI)


            

Reported by Pylint.

Undefined variable 'mrs'
Error

Line: 3 Column: 5

              @micropython.asm_thumb
def getIPSR():
    mrs(r0, IPSR)


@micropython.asm_thumb
def getBASEPRI():
    mrs(r0, BASEPRI)


            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 6 Column: 2

                  mrs(r0, IPSR)


@micropython.asm_thumb
def getBASEPRI():
    mrs(r0, BASEPRI)


print(getBASEPRI())

            

Reported by Pylint.

Undefined variable 'mrs'
Error

Line: 8 Column: 5

              
@micropython.asm_thumb
def getBASEPRI():
    mrs(r0, BASEPRI)


print(getBASEPRI())
print(getIPSR())

            

Reported by Pylint.

Undefined variable 'r0'
Error

Line: 8 Column: 9

              
@micropython.asm_thumb
def getBASEPRI():
    mrs(r0, BASEPRI)


print(getBASEPRI())
print(getIPSR())

            

Reported by Pylint.

Undefined variable 'BASEPRI'
Error

Line: 8 Column: 13

              
@micropython.asm_thumb
def getBASEPRI():
    mrs(r0, BASEPRI)


print(getBASEPRI())
print(getIPSR())

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              @micropython.asm_thumb
def getIPSR():
    mrs(r0, IPSR)


@micropython.asm_thumb
def getBASEPRI():
    mrs(r0, BASEPRI)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 2 Column: 1

              @micropython.asm_thumb
def getIPSR():
    mrs(r0, IPSR)


@micropython.asm_thumb
def getBASEPRI():
    mrs(r0, BASEPRI)


            

Reported by Pylint.

tests/basics/decorator.py
13 issues
Redefining name 'f' from outer scope (line 13)
Error

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.

Missing module docstring
Error

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.

Missing function or method docstring
Error

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.

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

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.

Missing function or method docstring
Error

Line: 7 Column: 1

                  print('dec')
    return f

def dec_arg(x):
    print(x)
    return lambda f:f

# plain decorator
@dec

            

Reported by Pylint.

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

Line: 7 Column: 1

                  print('dec')
    return f

def dec_arg(x):
    print(x)
    return lambda f:f

# plain decorator
@dec

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

              
# plain decorator
@dec
def f():
    pass

# decorator with arg
@dec_arg('dec_arg')
def g():

            

Reported by Pylint.

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

Line: 13 Column: 1

              
# plain decorator
@dec
def f():
    pass

# decorator with arg
@dec_arg('dec_arg')
def g():

            

Reported by Pylint.

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

Line: 18 Column: 1

              
# decorator with arg
@dec_arg('dec_arg')
def g():
    pass

# decorator of class
@dec
class A:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 1

              
# decorator with arg
@dec_arg('dec_arg')
def g():
    pass

# decorator of class
@dec
class A:

            

Reported by Pylint.

ports/esp8266/modules/inisetup.py
13 issues
Unable to import 'uos'
Error

Line: 1 Column: 1

              import uos
import network
from flashbdev import bdev


def wifi():
    import ubinascii

    ap_if = network.WLAN(network.AP_IF)

            

Reported by Pylint.

Unable to import 'network'
Error

Line: 2 Column: 1

              import uos
import network
from flashbdev import bdev


def wifi():
    import ubinascii

    ap_if = network.WLAN(network.AP_IF)

            

Reported by Pylint.

Unable to import 'ubinascii'
Error

Line: 7 Column: 5

              

def wifi():
    import ubinascii

    ap_if = network.WLAN(network.AP_IF)
    essid = b"MicroPython-%s" % ubinascii.hexlify(ap_if.config("mac")[-3:])
    ap_if.config(essid=essid, authmode=network.AUTH_WPA_WPA2_PSK, password=b"micropythoN")


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import uos
import network
from flashbdev import bdev


def wifi():
    import ubinascii

    ap_if = network.WLAN(network.AP_IF)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 6 Column: 1

              from flashbdev import bdev


def wifi():
    import ubinascii

    ap_if = network.WLAN(network.AP_IF)
    essid = b"MicroPython-%s" % ubinascii.hexlify(ap_if.config("mac")[-3:])
    ap_if.config(essid=essid, authmode=network.AUTH_WPA_WPA2_PSK, password=b"micropythoN")

            

Reported by Pylint.

Import outside toplevel (ubinascii)
Error

Line: 7 Column: 5

              

def wifi():
    import ubinascii

    ap_if = network.WLAN(network.AP_IF)
    essid = b"MicroPython-%s" % ubinascii.hexlify(ap_if.config("mac")[-3:])
    ap_if.config(essid=essid, authmode=network.AUTH_WPA_WPA2_PSK, password=b"micropythoN")


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 14 Column: 1

                  ap_if.config(essid=essid, authmode=network.AUTH_WPA_WPA2_PSK, password=b"micropythoN")


def check_bootsec():
    buf = bytearray(bdev.SEC_SIZE)
    bdev.readblocks(0, buf)
    empty = True
    for b in buf:
        if b != 0xFF:

            

Reported by Pylint.

Either all return statements in a function should return an expression, or none of them should.
Error

Line: 14 Column: 1

                  ap_if.config(essid=essid, authmode=network.AUTH_WPA_WPA2_PSK, password=b"micropythoN")


def check_bootsec():
    buf = bytearray(bdev.SEC_SIZE)
    bdev.readblocks(0, buf)
    empty = True
    for b in buf:
        if b != 0xFF:

            

Reported by Pylint.

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

Line: 18 Column: 9

                  buf = bytearray(bdev.SEC_SIZE)
    bdev.readblocks(0, buf)
    empty = True
    for b in buf:
        if b != 0xFF:
            empty = False
            break
    if empty:
        return True

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 27 Column: 1

                  fs_corrupted()


def fs_corrupted():
    import time

    while 1:
        print(
            """\

            

Reported by Pylint.

tests/basics/subclass_native1.py
13 issues
Attribute 'attr' defined outside __init__
Error

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.

TODO: Faults
Error

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.

Statement seems to have no effect
Error

Line: 36 Column: 9

              # multiple bases with layout conflict
try:
    class A(type, tuple):
        None
except TypeError:
    print('TypeError')

            

Reported by Pylint.

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

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.

Missing class docstring
Error

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.

Missing module docstring
Error

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.

Black listed name "foo"
Error

Line: 24 Column: 1

              # TODO: Faults
#print(a + a)

def foo():
    print("hello from foo")

try:
    class myfunc(type(foo)):
        pass

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 1

              # TODO: Faults
#print(a + a)

def foo():
    print("hello from foo")

try:
    class myfunc(type(foo)):
        pass

            

Reported by Pylint.

Too few public methods (0/2)
Error

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.

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

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
Redefining name 'a' from outer scope (line 11)
Error

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.

Redefining name 'a' from outer scope (line 11)
Error

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.

Unreachable code
Error

Line: 50 Column: 13

                  try:
        try:
            raise ValueError
            print("No ValueError3")
        finally:
            print("finally1")
    finally:
        print("finally2")


            

Reported by Pylint.

Unreachable code
Error

Line: 63 Column: 21

                          try:
                try:
                    raise ValueError
                    print("No ValueError3")
                finally:
                    print("finally1")
            finally:
                print("finally2")
    finally:

            

Reported by Pylint.

Missing module docstring
Error

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.

Missing class docstring
Error

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.

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

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.

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

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.

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

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.

Missing class docstring
Error

Line: 21 Column: 1

                  print("ValueError")


class CtxMgr2:

    def __enter__(self):
        print("__enter__")
        return self


            

Reported by Pylint.

tests/extmod/websocket_basic.py
13 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 7 Column: 5

                  import uwebsocket
except ImportError:
    print("SKIP")
    raise SystemExit

# put raw data in the stream and do a websocket read
def ws_read(msg, sz):
    ws = uwebsocket.websocket(uio.BytesIO(msg))
    return ws.read(sz)

            

Reported by Pylint.

Redefining name 'ws' from outer scope (line 41)
Error

Line: 11 Column: 5

              
# put raw data in the stream and do a websocket read
def ws_read(msg, sz):
    ws = uwebsocket.websocket(uio.BytesIO(msg))
    return ws.read(sz)


# do a websocket write and then return the raw data from the stream
def ws_write(msg, sz):

            

Reported by Pylint.

Redefining name 's' from outer scope (line 40)
Error

Line: 17 Column: 5

              
# do a websocket write and then return the raw data from the stream
def ws_write(msg, sz):
    s = uio.BytesIO()
    ws = uwebsocket.websocket(s)
    ws.write(msg)
    s.seek(0)
    return s.read(sz)


            

Reported by Pylint.

Redefining name 'ws' from outer scope (line 41)
Error

Line: 18 Column: 5

              # do a websocket write and then return the raw data from the stream
def ws_write(msg, sz):
    s = uio.BytesIO()
    ws = uwebsocket.websocket(s)
    ws.write(msg)
    s.seek(0)
    return s.read(sz)



            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    import uio
    import uerrno
    import uwebsocket
except ImportError:
    print("SKIP")
    raise SystemExit

# put raw data in the stream and do a websocket read

            

Reported by Pylint.

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

Line: 10 Column: 1

                  raise SystemExit

# put raw data in the stream and do a websocket read
def ws_read(msg, sz):
    ws = uwebsocket.websocket(uio.BytesIO(msg))
    return ws.read(sz)


# do a websocket write and then return the raw data from the stream

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 10 Column: 1

                  raise SystemExit

# put raw data in the stream and do a websocket read
def ws_read(msg, sz):
    ws = uwebsocket.websocket(uio.BytesIO(msg))
    return ws.read(sz)


# do a websocket write and then return the raw data from the stream

            

Reported by Pylint.

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

Line: 11 Column: 5

              
# put raw data in the stream and do a websocket read
def ws_read(msg, sz):
    ws = uwebsocket.websocket(uio.BytesIO(msg))
    return ws.read(sz)


# do a websocket write and then return the raw data from the stream
def ws_write(msg, sz):

            

Reported by Pylint.

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

Line: 16 Column: 1

              

# do a websocket write and then return the raw data from the stream
def ws_write(msg, sz):
    s = uio.BytesIO()
    ws = uwebsocket.websocket(s)
    ws.write(msg)
    s.seek(0)
    return s.read(sz)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 1

              

# do a websocket write and then return the raw data from the stream
def ws_write(msg, sz):
    s = uio.BytesIO()
    ws = uwebsocket.websocket(s)
    ws.write(msg)
    s.seek(0)
    return s.read(sz)

            

Reported by Pylint.

ports/esp32/boards/UM_TINYS2/modules/tinys2.py
13 issues
Unable to import 'micropython'
Error

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.

Unable to import 'machine'
Error

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.

Unable to import 'machine'
Error

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.

Unused SPI imported from machine
Error

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.

Unused import time
Error

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.

Missing module docstring
Error

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.

Multiple imports on one line (machine, time)
Error

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.

standard import "import machine, time" should be placed before "from micropython import const"
Error

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 too long (115/100)
Error

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 too long (109/100)
Error

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.