The following issues were found

tests/basics/del_deref.py
7 issues
Function name "f" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              def f():
    x = 1
    y = 2
    def g():
        nonlocal x
        print(y)
        try:
            print(x)
        except NameError:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def f():
    x = 1
    y = 2
    def g():
        nonlocal x
        print(y)
        try:
            print(x)
        except NameError:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 1 Column: 1

              def f():
    x = 1
    y = 2
    def g():
        nonlocal x
        print(y)
        try:
            print(x)
        except NameError:

            

Reported by Pylint.

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

Line: 2 Column: 5

              def f():
    x = 1
    y = 2
    def g():
        nonlocal x
        print(y)
        try:
            print(x)
        except NameError:

            

Reported by Pylint.

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

Line: 3 Column: 5

              def f():
    x = 1
    y = 2
    def g():
        nonlocal x
        print(y)
        try:
            print(x)
        except NameError:

            

Reported by Pylint.

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

Line: 4 Column: 5

              def f():
    x = 1
    y = 2
    def g():
        nonlocal x
        print(y)
        try:
            print(x)
        except NameError:

            

Reported by Pylint.

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

Line: 11 Column: 5

                          print(x)
        except NameError:
            print("NameError")
    def h():
        nonlocal x
        print(y)
        try:
            del x
        except NameError:

            

Reported by Pylint.

tests/basics/comprehension1.py
7 issues
Function name "f" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              def f():
    # list comprehension

    print([a + 1 for a in range(5)])
    print([(a, b) for a in range(3) for b in range(2)])
    print([a * 2 for a in range(7) if a > 3])

    print([a for a in [1, 3, 5]])
    print([a for a in [a for a in range(4)]])

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 1 Column: 1

              def f():
    # list comprehension

    print([a + 1 for a in range(5)])
    print([(a, b) for a in range(3) for b in range(2)])
    print([a * 2 for a in range(7) if a > 3])

    print([a for a in [1, 3, 5]])
    print([a for a in [a for a in range(4)]])

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def f():
    # list comprehension

    print([a + 1 for a in range(5)])
    print([(a, b) for a in range(3) for b in range(2)])
    print([a * 2 for a in range(7) if a > 3])

    print([a for a in [1, 3, 5]])
    print([a for a in [a for a in range(4)]])

            

Reported by Pylint.

Unnecessary use of a comprehension
Error

Line: 8 Column: 1

                  print([(a, b) for a in range(3) for b in range(2)])
    print([a * 2 for a in range(7) if a > 3])

    print([a for a in [1, 3, 5]])
    print([a for a in [a for a in range(4)]])

    # dict comprehension

    d = {a : 2 * a for a in range(5)}

            

Reported by Pylint.

Unnecessary use of a comprehension
Error

Line: 9 Column: 1

                  print([a * 2 for a in range(7) if a > 3])

    print([a for a in [1, 3, 5]])
    print([a for a in [a for a in range(4)]])

    # dict comprehension

    d = {a : 2 * a for a in range(5)}
    print(d[0], d[1], d[2], d[3], d[4])

            

Reported by Pylint.

Unnecessary use of a comprehension
Error

Line: 9 Column: 1

                  print([a * 2 for a in range(7) if a > 3])

    print([a for a in [1, 3, 5]])
    print([a for a in [a for a in range(4)]])

    # dict comprehension

    d = {a : 2 * a for a in range(5)}
    print(d[0], d[1], d[2], d[3], d[4])

            

Reported by Pylint.

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

Line: 13 Column: 5

              
    # dict comprehension

    d = {a : 2 * a for a in range(5)}
    print(d[0], d[1], d[2], d[3], d[4])

    # set comprehension
    # see set_comprehension.py


            

Reported by Pylint.

tests/thread/thread_ident1.py
7 issues
Using the global statement
Error

Line: 11 Column: 5

              def thread_entry():
    tid = _thread.get_ident()
    print("thread", type(tid) == int, tid != 0, tid != tid_main)
    global finished
    finished = True


tid_main = _thread.get_ident()
print("main", type(tid_main) == int, tid_main != 0)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test _thread.get_ident() function
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

import _thread


def thread_entry():
    tid = _thread.get_ident()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

              import _thread


def thread_entry():
    tid = _thread.get_ident()
    print("thread", type(tid) == int, tid != 0, tid != tid_main)
    global finished
    finished = True


            

Reported by Pylint.

Using type() instead of isinstance() for a typecheck.
Error

Line: 10 Column: 21

              
def thread_entry():
    tid = _thread.get_ident()
    print("thread", type(tid) == int, tid != 0, tid != tid_main)
    global finished
    finished = True


tid_main = _thread.get_ident()

            

Reported by Pylint.

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

Line: 11 Column: 5

              def thread_entry():
    tid = _thread.get_ident()
    print("thread", type(tid) == int, tid != 0, tid != tid_main)
    global finished
    finished = True


tid_main = _thread.get_ident()
print("main", type(tid_main) == int, tid_main != 0)

            

Reported by Pylint.

Using type() instead of isinstance() for a typecheck.
Error

Line: 16 Column: 15

              

tid_main = _thread.get_ident()
print("main", type(tid_main) == int, tid_main != 0)

finished = False
_thread.start_new_thread(thread_entry, ())

while not finished:

            

Reported by Pylint.

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

Line: 18 Column: 1

              tid_main = _thread.get_ident()
print("main", type(tid_main) == int, tid_main != 0)

finished = False
_thread.start_new_thread(thread_entry, ())

while not finished:
    pass
print("done")

            

Reported by Pylint.

tests/basics/closure_defargs.py
7 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test closure with default args

def f():
    a = 1
    def bar(b = 10, c = 20):
        print(a + b + c)
    bar()
    bar(2)
    bar(2, 3)

            

Reported by Pylint.

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

Line: 3 Column: 1

              # test closure with default args

def f():
    a = 1
    def bar(b = 10, c = 20):
        print(a + b + c)
    bar()
    bar(2)
    bar(2, 3)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 3 Column: 1

              # test closure with default args

def f():
    a = 1
    def bar(b = 10, c = 20):
        print(a + b + c)
    bar()
    bar(2)
    bar(2, 3)

            

Reported by Pylint.

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

Line: 4 Column: 5

              # test closure with default args

def f():
    a = 1
    def bar(b = 10, c = 20):
        print(a + b + c)
    bar()
    bar(2)
    bar(2, 3)

            

Reported by Pylint.

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

Line: 5 Column: 5

              
def f():
    a = 1
    def bar(b = 10, c = 20):
        print(a + b + c)
    bar()
    bar(2)
    bar(2, 3)


            

Reported by Pylint.

Black listed name "bar"
Error

Line: 5 Column: 5

              
def f():
    a = 1
    def bar(b = 10, c = 20):
        print(a + b + c)
    bar()
    bar(2)
    bar(2, 3)


            

Reported by Pylint.

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

Line: 5 Column: 5

              
def f():
    a = 1
    def bar(b = 10, c = 20):
        print(a + b + c)
    bar()
    bar(2)
    bar(2, 3)


            

Reported by Pylint.

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

Line: 8 Column: 5

                  object.__init__
except AttributeError:
    print("SKIP")
    raise SystemExit

class Test(object):
    def __init__(self):
        super().__init__()
        print("Test.__init__")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Calling object.__init__() via super().__init__
try:
    # If we don't expose object.__init__ (small ports), there's
    # nothing to test.
    object.__init__
except AttributeError:
    print("SKIP")
    raise SystemExit


            

Reported by Pylint.

Class 'Test' inherits from object, can be safely removed from bases in python3
Error

Line: 10 Column: 1

                  print("SKIP")
    raise SystemExit

class Test(object):
    def __init__(self):
        super().__init__()
        print("Test.__init__")

t = Test()

            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

                  print("SKIP")
    raise SystemExit

class Test(object):
    def __init__(self):
        super().__init__()
        print("Test.__init__")

t = Test()

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 10 Column: 1

                  print("SKIP")
    raise SystemExit

class Test(object):
    def __init__(self):
        super().__init__()
        print("Test.__init__")

t = Test()

            

Reported by Pylint.

Missing class docstring
Error

Line: 17 Column: 1

              
t = Test()

class Test2:
    def __init__(self):
        super().__init__()
        print("Test2.__init__")

t = Test2()

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 17 Column: 1

              
t = Test()

class Test2:
    def __init__(self):
        super().__init__()
        print("Test2.__init__")

t = Test2()

            

Reported by Pylint.

tests/micropython/const.py
7 issues
Unable to import 'micropython'
Error

Line: 3 Column: 1

              # test constant optimisation

from micropython import const

X = const(123)
Y = const(X + 456)

print(X, Y + 1)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test constant optimisation

from micropython import const

X = const(123)
Y = const(X + 456)

print(X, Y + 1)


            

Reported by Pylint.

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

Line: 11 Column: 1

              print(X, Y + 1)


def f():
    print(X, Y + 1)


f()


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 1

              print(X, Y + 1)


def f():
    print(X, Y + 1)


f()


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 23 Column: 1

              print(_X, _Y)


class A:
    Z = const(1)
    _Z = const(2)
    print(Z, _Z)



            

Reported by Pylint.

Missing class docstring
Error

Line: 23 Column: 1

              print(_X, _Y)


class A:
    Z = const(1)
    _Z = const(2)
    print(Z, _Z)



            

Reported by Pylint.

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

Line: 23 Column: 1

              print(_X, _Y)


class A:
    Z = const(1)
    _Z = const(2)
    print(Z, _Z)



            

Reported by Pylint.

tests/thread/stress_recurse.py
7 issues
Using the global statement
Error

Line: 17 Column: 5

                      foo()
    except RuntimeError:
        print("RuntimeError")
    global finished
    finished = True


finished = False


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test hitting the function recursion limit within a thread
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

import _thread


def foo():
    foo()

            

Reported by Pylint.

Black listed name "foo"
Error

Line: 8 Column: 1

              import _thread


def foo():
    foo()


def thread_entry():
    try:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

              import _thread


def foo():
    foo()


def thread_entry():
    try:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 1

                  foo()


def thread_entry():
    try:
        foo()
    except RuntimeError:
        print("RuntimeError")
    global finished

            

Reported by Pylint.

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

Line: 17 Column: 5

                      foo()
    except RuntimeError:
        print("RuntimeError")
    global finished
    finished = True


finished = False


            

Reported by Pylint.

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

Line: 21 Column: 1

                  finished = True


finished = False

_thread.start_new_thread(thread_entry, ())

# busy wait for thread to finish
while not finished:

            

Reported by Pylint.

tests/basics/class_item.py
7 issues
Value 'a' is unsubscriptable
Error

Line: 24 Column: 5

                  pass
a = A()
try:
    a[1]
except TypeError:
    print('TypeError')

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test class with __getitem__, __setitem__, __delitem__ methods

class C:
    def __getitem__(self, item):
        print('get', item)
        return 'item'

    def __setitem__(self, item, value):
        print('set', item, value)

            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              # test class with __getitem__, __setitem__, __delitem__ methods

class C:
    def __getitem__(self, item):
        print('get', item)
        return 'item'

    def __setitem__(self, item, value):
        print('set', item, value)

            

Reported by Pylint.

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

Line: 3 Column: 1

              # test class with __getitem__, __setitem__, __delitem__ methods

class C:
    def __getitem__(self, item):
        print('get', item)
        return 'item'

    def __setitem__(self, item, value):
        print('set', item, value)

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 20 Column: 1

              del c[3]

# index not supported
class A:
    pass
a = A()
try:
    a[1]
except TypeError:

            

Reported by Pylint.

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

Line: 20 Column: 1

              del c[3]

# index not supported
class A:
    pass
a = A()
try:
    a[1]
except TypeError:

            

Reported by Pylint.

Missing class docstring
Error

Line: 20 Column: 1

              del c[3]

# index not supported
class A:
    pass
a = A()
try:
    a[1]
except TypeError:

            

Reported by Pylint.

tests/internal_bench/var-6.1-instance-attr-5.py
7 issues
Unused argument 'num'
Error

Line: 13 Column: 10

                      self.num = 20000000


def test(num):
    o = Foo()
    i = 0
    while i < o.num:
        i += 1


            

Reported by Pylint.

Module name "1-instance-attr-5" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              import bench


class Foo:
    def __init__(self):
        self.num1 = 0
        self.num2 = 0
        self.num3 = 0
        self.num4 = 0

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import bench


class Foo:
    def __init__(self):
        self.num1 = 0
        self.num2 = 0
        self.num3 = 0
        self.num4 = 0

            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              import bench


class Foo:
    def __init__(self):
        self.num1 = 0
        self.num2 = 0
        self.num3 = 0
        self.num4 = 0

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 4 Column: 1

              import bench


class Foo:
    def __init__(self):
        self.num1 = 0
        self.num2 = 0
        self.num3 = 0
        self.num4 = 0

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                      self.num = 20000000


def test(num):
    o = Foo()
    i = 0
    while i < o.num:
        i += 1


            

Reported by Pylint.

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

Line: 14 Column: 5

              

def test(num):
    o = Foo()
    i = 0
    while i < o.num:
        i += 1



            

Reported by Pylint.

tests/basics/class_contains.py
7 issues
Missing module docstring
Error

Line: 1 Column: 1

              # A contains everything
class A:
    def __contains__(self, key):
        return True

a = A()
print(True in a)
print(1 in a)
print(() in a)

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 2 Column: 1

              # A contains everything
class A:
    def __contains__(self, key):
        return True

a = A()
print(True in a)
print(1 in a)
print(() in a)

            

Reported by Pylint.

Missing class docstring
Error

Line: 2 Column: 1

              # A contains everything
class A:
    def __contains__(self, key):
        return True

a = A()
print(True in a)
print(1 in a)
print(() in a)

            

Reported by Pylint.

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

Line: 2 Column: 1

              # A contains everything
class A:
    def __contains__(self, key):
        return True

a = A()
print(True in a)
print(1 in a)
print(() in a)

            

Reported by Pylint.

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

Line: 12 Column: 1

              print(() in a)

# B contains given things
class B:
    def __init__(self, items):
        self.items = items
    def __contains__(self, key):
        return key in self.items


            

Reported by Pylint.

Missing class docstring
Error

Line: 12 Column: 1

              print(() in a)

# B contains given things
class B:
    def __init__(self, items):
        self.items = items
    def __contains__(self, key):
        return key in self.items


            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 12 Column: 1

              print(() in a)

# B contains given things
class B:
    def __init__(self, items):
        self.items = items
    def __contains__(self, key):
        return key in self.items


            

Reported by Pylint.