The following issues were found

tests/basics/try_else_finally.py
11 issues
No exception type(s) specified
Error

Line: 6 Column: 1

              # base case
try:
    print(1)
except:
    print(2)
else:
    print(3)
finally:
    print(4)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 17 Column: 1

              try:
    print(1)
    raise Exception
except:
    print(2)
else:
    print(3)
finally:
    print(4)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 35 Column: 1

                      print(3)
    finally:
        print(4)
except:
    print('caught')

# nested within outer try
try:
    print(1)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 44 Column: 5

                  try:
        print(2)
        raise Exception
    except:
        print(3)
    else:
        print(4)
    finally:
        print(5)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 50 Column: 1

                      print(4)
    finally:
        print(5)
except:
    print(6)
else:
    print(7)
finally:
    print(8)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 61 Column: 1

              try:
    print(1)
    raise Exception
except:
    print(2)
    try:
        print(3)
    except:
        print(4)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 65 Column: 5

                  print(2)
    try:
        print(3)
    except:
        print(4)
    else:
        print(5)
    finally:
        print(6)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 80 Column: 1

              try:
    print(1)
    raise Exception
except:
    print(2)
    try:
        print(3)
        raise Exception
    except:

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 84 Column: 9

                  print(2)
    try:
        print(3)
        raise Exception
    except:
        print(4)
    else:
        print(5)
    finally:

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 85 Column: 5

                  try:
        print(3)
        raise Exception
    except:
        print(4)
    else:
        print(5)
    finally:
        print(6)

            

Reported by Pylint.

tests/extmod/btree_error.py
11 issues
Statement seems to have no effect
Error

Line: 6 Column: 5

              try:
    import btree, uio, uerrno

    uio.IOBase
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit



            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 9 Column: 5

                  uio.IOBase
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


class Device(uio.IOBase):
    def __init__(self, read_ret=0, ioctl_ret=0):
        self.read_ret = read_ret

            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 21 Column: 26

                      print("read", len(buf))
        return self.read_ret

    def ioctl(self, cmd, arg):
        print("ioctl", cmd)
        return self.ioctl_ret


# Invalid pagesize; errno comes from btree library

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test that errno's propagate correctly through btree module.

try:
    import btree, uio, uerrno

    uio.IOBase
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit

            

Reported by Pylint.

Multiple imports on one line (btree, uio, uerrno)
Error

Line: 4 Column: 5

              # Test that errno's propagate correctly through btree module.

try:
    import btree, uio, uerrno

    uio.IOBase
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit

            

Reported by Pylint.

Missing class docstring
Error

Line: 12 Column: 1

                  raise SystemExit


class Device(uio.IOBase):
    def __init__(self, read_ret=0, ioctl_ret=0):
        self.read_ret = read_ret
        self.ioctl_ret = ioctl_ret

    def readinto(self, buf):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 5

                      self.read_ret = read_ret
        self.ioctl_ret = ioctl_ret

    def readinto(self, buf):
        print("read", len(buf))
        return self.read_ret

    def ioctl(self, cmd, arg):
        print("ioctl", cmd)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 5

                      print("read", len(buf))
        return self.read_ret

    def ioctl(self, cmd, arg):
        print("ioctl", cmd)
        return self.ioctl_ret


# Invalid pagesize; errno comes from btree library

            

Reported by Pylint.

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

Line: 29 Column: 1

              # Invalid pagesize; errno comes from btree library
try:
    db = btree.open(Device(), pagesize=511)
except OSError as er:
    print("OSError", er.errno == uerrno.EINVAL)

# Valid pagesize, device returns error on read; errno comes from Device.readinto
try:
    db = btree.open(Device(-1000), pagesize=512)

            

Reported by Pylint.

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

Line: 35 Column: 1

              # Valid pagesize, device returns error on read; errno comes from Device.readinto
try:
    db = btree.open(Device(-1000), pagesize=512)
except OSError as er:
    print(repr(er))

# Valid pagesize, device returns error on seek; errno comes from Device.ioctl
try:
    db = btree.open(Device(0, -1001), pagesize=512)

            

Reported by Pylint.

tests/basics/try_else.py
11 issues
No exception type(s) specified
Error

Line: 6 Column: 1

              # base case
try:
    print(1)
except:
    print(2)
else:
    print(3)

# basic case that should skip else

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 15 Column: 1

              try:
    print(1)
    raise Exception
except:
    print(2)
else:
    print(3)

# uncaught exception should skip else

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 29 Column: 1

                      print(2)
    else:
        print(3)
except:
    print('caught')

# nested within outer try
try:
    print(1)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 38 Column: 5

                  try:
        print(2)
        raise Exception
    except:
        print(3)
    else:
        print(4)
except:
    print(5)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 42 Column: 1

                      print(3)
    else:
        print(4)
except:
    print(5)
else:
    print(6)

# nested within outer except, one else should be skipped

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 51 Column: 1

              try:
    print(1)
    raise Exception
except:
    print(2)
    try:
        print(3)
    except:
        print(4)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 55 Column: 5

                  print(2)
    try:
        print(3)
    except:
        print(4)
    else:
        print(5)
else:
    print(6)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 66 Column: 1

              try:
    print(1)
    raise Exception
except:
    print(2)
    try:
        print(3)
        raise Exception
    except:

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 70 Column: 9

                  print(2)
    try:
        print(3)
        raise Exception
    except:
        print(4)
    else:
        print(5)
else:

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 71 Column: 5

                  try:
        print(3)
        raise Exception
    except:
        print(4)
    else:
        print(5)
else:
    print(6)

            

Reported by Pylint.

tests/basics/del_local.py
11 issues
Unnecessary semicolon
Error

Line: 11 Column: 1

                  try:
        print(x)
    except NameError:
        print("NameError");
f()

# delete local then try to delete it again
def g():
    x = 3

            

Reported by Pylint.

Unnecessary semicolon
Error

Line: 24 Column: 1

                  try:
        del x
    except NameError:
        print("NameError");
g()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # delete local then try to reference it
def f():
    x = 1
    y = 2
    print(x, y)
    del x
    print(y)
    try:
        print(x)

            

Reported by Pylint.

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

Line: 2 Column: 1

              # delete local then try to reference it
def f():
    x = 1
    y = 2
    print(x, y)
    del x
    print(y)
    try:
        print(x)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 2 Column: 1

              # delete local then try to reference it
def f():
    x = 1
    y = 2
    print(x, y)
    del x
    print(y)
    try:
        print(x)

            

Reported by Pylint.

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

Line: 3 Column: 5

              # delete local then try to reference it
def f():
    x = 1
    y = 2
    print(x, y)
    del x
    print(y)
    try:
        print(x)

            

Reported by Pylint.

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

Line: 4 Column: 5

              # delete local then try to reference it
def f():
    x = 1
    y = 2
    print(x, y)
    del x
    print(y)
    try:
        print(x)

            

Reported by Pylint.

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

Line: 15 Column: 1

              f()

# delete local then try to delete it again
def g():
    x = 3
    y = 4
    print(x, y)
    del x
    print(y)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 1

              f()

# delete local then try to delete it again
def g():
    x = 3
    y = 4
    print(x, y)
    del x
    print(y)

            

Reported by Pylint.

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

Line: 16 Column: 5

              
# delete local then try to delete it again
def g():
    x = 3
    y = 4
    print(x, y)
    del x
    print(y)
    try:

            

Reported by Pylint.

tests/basics/try4.py
11 issues
Undefined variable 'foo'
Error

Line: 5 Column: 9

              
def f():
    try:
        foo()
    except:
        print("except 1")
        try:
            bar()
        except:

            

Reported by Pylint.

Undefined variable 'bar'
Error

Line: 9 Column: 13

                  except:
        print("except 1")
        try:
            bar()
        except:
            print("except 2")
            try:
                baz()
            except:

            

Reported by Pylint.

Undefined variable 'baz'
Error

Line: 13 Column: 17

                      except:
            print("except 2")
            try:
                baz()
            except:
                print("except 3")
            bak()

try:

            

Reported by Pylint.

Undefined variable 'bak'
Error

Line: 16 Column: 13

                              baz()
            except:
                print("except 3")
            bak()

try:
    f()
except:
    print("f except")

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 6 Column: 5

              def f():
    try:
        foo()
    except:
        print("except 1")
        try:
            bar()
        except:
            print("except 2")

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 10 Column: 9

                      print("except 1")
        try:
            bar()
        except:
            print("except 2")
            try:
                baz()
            except:
                print("except 3")

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 14 Column: 13

                          print("except 2")
            try:
                baz()
            except:
                print("except 3")
            bak()

try:
    f()

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 20 Column: 1

              
try:
    f()
except:
    print("f except")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # triple nested exceptions

def f():
    try:
        foo()
    except:
        print("except 1")
        try:
            bar()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 3 Column: 1

              # triple nested exceptions

def f():
    try:
        foo()
    except:
        print("except 1")
        try:
            bar()

            

Reported by Pylint.

tests/pyb/timer_callback.py
11 issues
Unable to import 'pyb'
Error

Line: 3 Column: 1

              # check callback feature of the timer class

import pyb
from pyb import Timer

# callback function that disables the callback when called
def cb1(t):
    print("cb1")
    t.callback(None)

            

Reported by Pylint.

Unable to import 'pyb'
Error

Line: 4 Column: 1

              # check callback feature of the timer class

import pyb
from pyb import Timer

# callback function that disables the callback when called
def cb1(t):
    print("cb1")
    t.callback(None)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # check callback feature of the timer class

import pyb
from pyb import Timer

# callback function that disables the callback when called
def cb1(t):
    print("cb1")
    t.callback(None)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              from pyb import Timer

# callback function that disables the callback when called
def cb1(t):
    print("cb1")
    t.callback(None)


# callback function that disables the timer when called

            

Reported by Pylint.

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

Line: 7 Column: 1

              from pyb import Timer

# callback function that disables the callback when called
def cb1(t):
    print("cb1")
    t.callback(None)


# callback function that disables the timer when called

            

Reported by Pylint.

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

Line: 13 Column: 1

              

# callback function that disables the timer when called
def cb2(t):
    print("cb2")
    t.deinit()


# callback where cb4 closes over cb3.y

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

              

# callback function that disables the timer when called
def cb2(t):
    print("cb2")
    t.deinit()


# callback where cb4 closes over cb3.y

            

Reported by Pylint.

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

Line: 19 Column: 1

              

# callback where cb4 closes over cb3.y
def cb3(x):
    y = x

    def cb4(t):
        print("cb4", y)
        t.callback(None)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 1

              

# callback where cb4 closes over cb3.y
def cb3(x):
    y = x

    def cb4(t):
        print("cb4", y)
        t.callback(None)

            

Reported by Pylint.

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

Line: 20 Column: 5

              
# callback where cb4 closes over cb3.y
def cb3(x):
    y = x

    def cb4(t):
        print("cb4", y)
        t.callback(None)


            

Reported by Pylint.

ports/cc3200/tools/smoke.py
11 issues
Unable to import 'machine'
Error

Line: 1 Column: 1

              from machine import Pin
from machine import RTC
import time
import os

"""
Execute it like this:

python3 run-tests.py --target wipy --device 192.168.1.1 ../cc3200/tools/smoke.py

            

Reported by Pylint.

Unable to import 'machine'
Error

Line: 2 Column: 1

              from machine import Pin
from machine import RTC
import time
import os

"""
Execute it like this:

python3 run-tests.py --target wipy --device 192.168.1.1 ../cc3200/tools/smoke.py

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 75 Column: 1

                  pass

time1 = rtc.now()
time.sleep_ms(1000)
time2 = rtc.now()
print(time2[5] - time1[5] == 1)
print(time2[6] - time1[6] < 5000)  # microseconds

            

Reported by Pylint.

String statement has no effect
Error

Line: 6 Column: 1

              import time
import os

"""
Execute it like this:

python3 run-tests.py --target wipy --device 192.168.1.1 ../cc3200/tools/smoke.py
"""


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from machine import Pin
from machine import RTC
import time
import os

"""
Execute it like this:

python3 run-tests.py --target wipy --device 192.168.1.1 ../cc3200/tools/smoke.py

            

Reported by Pylint.

standard import "import time" should be placed before "from machine import Pin"
Error

Line: 3 Column: 1

              from machine import Pin
from machine import RTC
import time
import os

"""
Execute it like this:

python3 run-tests.py --target wipy --device 192.168.1.1 ../cc3200/tools/smoke.py

            

Reported by Pylint.

standard import "import os" should be placed before "from machine import Pin"
Error

Line: 4 Column: 1

              from machine import Pin
from machine import RTC
import time
import os

"""
Execute it like this:

python3 run-tests.py --target wipy --device 192.168.1.1 ../cc3200/tools/smoke.py

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 1

              test_bytes = os.urandom(1024)


def test_pin_read(pull):
    # enable the pull resistor on all pins, then read the value
    for p in pin_map:
        pin = Pin("GP" + str(p), mode=Pin.IN, pull=pull)
        # read the pin value
        print(pin())

            

Reported by Pylint.

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

Line: 18 Column: 9

              
def test_pin_read(pull):
    # enable the pull resistor on all pins, then read the value
    for p in pin_map:
        pin = Pin("GP" + str(p), mode=Pin.IN, pull=pull)
        # read the pin value
        print(pin())



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 1

                      print(pin())


def test_pin_shorts(pull):
    if pull == Pin.PULL_UP:
        pull_inverted = Pin.PULL_DOWN
    else:
        pull_inverted = Pin.PULL_UP
    # enable all pulls of the specified type

            

Reported by Pylint.

tests/basics/fun_name.py
11 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 17 Column: 5

                  print(A().Fun.__name__)
except AttributeError:
    print('SKIP')
    raise SystemExit

# __name__ of a bound native method is not implemented in uPy
# the test here is to make sure it doesn't crash
try:
    str((1).to_bytes.__name__)

            

Reported by Pylint.

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

Line: 1 Column: 1

              def Fun():
    pass

class A:
    def __init__(self):
        pass
    def Fun(self):
        pass


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def Fun():
    pass

class A:
    def __init__(self):
        pass
    def Fun(self):
        pass


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 1 Column: 1

              def Fun():
    pass

class A:
    def __init__(self):
        pass
    def Fun(self):
        pass


            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              def Fun():
    pass

class A:
    def __init__(self):
        pass
    def Fun(self):
        pass


            

Reported by Pylint.

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

Line: 4 Column: 1

              def Fun():
    pass

class A:
    def __init__(self):
        pass
    def Fun(self):
        pass


            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 4 Column: 1

              def Fun():
    pass

class A:
    def __init__(self):
        pass
    def Fun(self):
        pass


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 5

              class A:
    def __init__(self):
        pass
    def Fun(self):
        pass

try:
    print(Fun.__name__)
    print(A.__init__.__name__)

            

Reported by Pylint.

Method name "Fun" doesn't conform to snake_case naming style
Error

Line: 7 Column: 5

              class A:
    def __init__(self):
        pass
    def Fun(self):
        pass

try:
    print(Fun.__name__)
    print(A.__init__.__name__)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 27 Column: 1

                  pass

# name of a function that has closed over variables
def outer():
    x = 1
    def inner():
        return x
    return inner
print(outer.__name__)

            

Reported by Pylint.

tests/perf_bench/viper_call2a.py
11 issues
Undefined variable 'micropython'
Error

Line: 1 Column: 2

              @micropython.viper
def f2a(x, y):
    return x


@micropython.native
def call(r):
    f = f2a
    for _ in r:

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 6 Column: 2

                  return x


@micropython.native
def call(r):
    f = f2a
    for _ in r:
        f(1, 2)


            

Reported by Pylint.

Unused argument 'y'
Error

Line: 2 Column: 12

              @micropython.viper
def f2a(x, y):
    return x


@micropython.native
def call(r):
    f = f2a
    for _ in r:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              @micropython.viper
def f2a(x, y):
    return x


@micropython.native
def call(r):
    f = f2a
    for _ in r:

            

Reported by Pylint.

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

Line: 2 Column: 1

              @micropython.viper
def f2a(x, y):
    return x


@micropython.native
def call(r):
    f = f2a
    for _ in r:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 2 Column: 1

              @micropython.viper
def f2a(x, y):
    return x


@micropython.native
def call(r):
    f = f2a
    for _ in r:

            

Reported by Pylint.

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

Line: 2 Column: 1

              @micropython.viper
def f2a(x, y):
    return x


@micropython.native
def call(r):
    f = f2a
    for _ in r:

            

Reported by Pylint.

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

Line: 7 Column: 1

              

@micropython.native
def call(r):
    f = f2a
    for _ in r:
        f(1, 2)



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              

@micropython.native
def call(r):
    f = f2a
    for _ in r:
        f(1, 2)



            

Reported by Pylint.

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

Line: 8 Column: 5

              
@micropython.native
def call(r):
    f = f2a
    for _ in r:
        f(1, 2)


bm_params = {

            

Reported by Pylint.

tests/basics/class_staticclassmethod.py
11 issues
Statement seems to have no effect
Error

Line: 36 Column: 1

              
c.f(0)
c.g(0)
c - 1
c + 2
print(c[1])
c[1] = 2
del c[3]

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 37 Column: 1

              c.f(0)
c.g(0)
c - 1
c + 2
print(c[1])
c[1] = 2
del c[3]

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test static and class methods

class C:
    @staticmethod
    def f(rhs):
        print('f', rhs)
    @classmethod
    def g(self, rhs):
        print('g', rhs)

            

Reported by Pylint.

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

Line: 3 Column: 1

              # test static and class methods

class C:
    @staticmethod
    def f(rhs):
        print('f', rhs)
    @classmethod
    def g(self, rhs):
        print('g', rhs)

            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              # test static and class methods

class C:
    @staticmethod
    def f(rhs):
        print('f', rhs)
    @classmethod
    def g(self, rhs):
        print('g', rhs)

            

Reported by Pylint.

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

Line: 5 Column: 5

              
class C:
    @staticmethod
    def f(rhs):
        print('f', rhs)
    @classmethod
    def g(self, rhs):
        print('g', rhs)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 5

              
class C:
    @staticmethod
    def f(rhs):
        print('f', rhs)
    @classmethod
    def g(self, rhs):
        print('g', rhs)


            

Reported by Pylint.

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

Line: 8 Column: 5

                  def f(rhs):
        print('f', rhs)
    @classmethod
    def g(self, rhs):
        print('g', rhs)

    # builtin wrapped in staticmethod
    @staticmethod
    def __sub__(rhs):

            

Reported by Pylint.

Class method g should have 'cls' as first argument
Error

Line: 8 Column: 5

                  def f(rhs):
        print('f', rhs)
    @classmethod
    def g(self, rhs):
        print('g', rhs)

    # builtin wrapped in staticmethod
    @staticmethod
    def __sub__(rhs):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 5

                  def f(rhs):
        print('f', rhs)
    @classmethod
    def g(self, rhs):
        print('g', rhs)

    # builtin wrapped in staticmethod
    @staticmethod
    def __sub__(rhs):

            

Reported by Pylint.