The following issues were found

tests/basics/class_store_class.py
16 issues
Instance of '_ResultMixinStr' has no '_encoded_counterpart' member
Error

Line: 18 Column: 16

              
class _ResultMixinStr(object):
    def encode(self):
        return self._encoded_counterpart(*(x.encode() for x in self))

class _ResultMixinBytes(object):
    def decode(self):
        return self._decoded_counterpart(*(x.decode() for x in self))


            

Reported by Pylint.

Non-iterable value self is used in an iterating context
Error

Line: 18 Column: 64

              
class _ResultMixinStr(object):
    def encode(self):
        return self._encoded_counterpart(*(x.encode() for x in self))

class _ResultMixinBytes(object):
    def decode(self):
        return self._decoded_counterpart(*(x.decode() for x in self))


            

Reported by Pylint.

Instance of '_ResultMixinBytes' has no '_decoded_counterpart' member
Error

Line: 22 Column: 16

              
class _ResultMixinBytes(object):
    def decode(self):
        return self._decoded_counterpart(*(x.decode() for x in self))

class DefragResult(_DefragResultBase, _ResultMixinStr):
    pass

class DefragResultBytes(_DefragResultBase, _ResultMixinBytes):

            

Reported by Pylint.

Non-iterable value self is used in an iterating context
Error

Line: 22 Column: 64

              
class _ResultMixinBytes(object):
    def decode(self):
        return self._decoded_counterpart(*(x.decode() for x in self))

class DefragResult(_DefragResultBase, _ResultMixinStr):
    pass

class DefragResultBytes(_DefragResultBase, _ResultMixinBytes):

            

Reported by Pylint.

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

Line: 12 Column: 9

                      from ucollections import namedtuple
    except ImportError:
        print("SKIP")
        raise SystemExit

_DefragResultBase = namedtuple('DefragResult', [ 'foo', 'bar' ])

class _ResultMixinStr(object):
    def encode(self):

            

Reported by Pylint.

Access to a protected member _encoded_counterpart of a client class
Error

Line: 31 Column: 1

                  pass


DefragResult._encoded_counterpart = DefragResultBytes
DefragResultBytes._decoded_counterpart = DefragResult

# Due to differences in type and native subclass printing,
# the best thing we can do here is to just test that no exceptions
# happen

            

Reported by Pylint.

Access to a protected member _decoded_counterpart of a client class
Error

Line: 32 Column: 1

              

DefragResult._encoded_counterpart = DefragResultBytes
DefragResultBytes._decoded_counterpart = DefragResult

# Due to differences in type and native subclass printing,
# the best thing we can do here is to just test that no exceptions
# happen


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Inspired by urlparse.py from CPython 3.3 stdlib
# There was a bug in MicroPython that under some conditions class stored
# in instance attribute later was returned "bound" as if it was a method,
# which caused class constructor to receive extra argument.
try:
    from collections import namedtuple
except ImportError:
    try:
        from ucollections import namedtuple

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 16 Column: 1

              
_DefragResultBase = namedtuple('DefragResult', [ 'foo', 'bar' ])

class _ResultMixinStr(object):
    def encode(self):
        return self._encoded_counterpart(*(x.encode() for x in self))

class _ResultMixinBytes(object):
    def decode(self):

            

Reported by Pylint.

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

Line: 16 Column: 1

              
_DefragResultBase = namedtuple('DefragResult', [ 'foo', 'bar' ])

class _ResultMixinStr(object):
    def encode(self):
        return self._encoded_counterpart(*(x.encode() for x in self))

class _ResultMixinBytes(object):
    def decode(self):

            

Reported by Pylint.

tests/basics/class_super_multinherit.py
16 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test super with multiple inheritance

class A:
    def foo(self):
        print('A.foo')

class B:
    def foo(self):
        print('B.foo')

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 3 Column: 1

              # test super with multiple inheritance

class A:
    def foo(self):
        print('A.foo')

class B:
    def foo(self):
        print('B.foo')

            

Reported by Pylint.

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

Line: 3 Column: 1

              # test super with multiple inheritance

class A:
    def foo(self):
        print('A.foo')

class B:
    def foo(self):
        print('B.foo')

            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              # test super with multiple inheritance

class A:
    def foo(self):
        print('A.foo')

class B:
    def foo(self):
        print('B.foo')

            

Reported by Pylint.

Black listed name "foo"
Error

Line: 4 Column: 5

              # test super with multiple inheritance

class A:
    def foo(self):
        print('A.foo')

class B:
    def foo(self):
        print('B.foo')

            

Reported by Pylint.

Method could be a function
Error

Line: 4 Column: 5

              # test super with multiple inheritance

class A:
    def foo(self):
        print('A.foo')

class B:
    def foo(self):
        print('B.foo')

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 4 Column: 5

              # test super with multiple inheritance

class A:
    def foo(self):
        print('A.foo')

class B:
    def foo(self):
        print('B.foo')

            

Reported by Pylint.

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

Line: 7 Column: 1

                  def foo(self):
        print('A.foo')

class B:
    def foo(self):
        print('B.foo')

class C(A, B):
    def foo(self):

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 7 Column: 1

                  def foo(self):
        print('A.foo')

class B:
    def foo(self):
        print('B.foo')

class C(A, B):
    def foo(self):

            

Reported by Pylint.

Missing class docstring
Error

Line: 7 Column: 1

                  def foo(self):
        print('A.foo')

class B:
    def foo(self):
        print('B.foo')

class C(A, B):
    def foo(self):

            

Reported by Pylint.

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

Line: 10 Column: 9

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


async def task_loop(id, lock):
    print("task start", id)
    for i in range(3):

            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 13 Column: 21

                      raise SystemExit


async def task_loop(id, lock):
    print("task start", id)
    for i in range(3):
        async with lock:
            print("task have", id, i)
    print("task end", id)

            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 31 Column: 23

                  lock.release()


async def task_cancel(id, lock, to_cancel=None):
    try:
        async with lock:
            print("task got", id)
            await asyncio.sleep(0.1)
        print("task release", id)

            

Reported by Pylint.

Unused variable 't0'
Error

Line: 86 Column: 5

              
    # 3 tasks, the second and third being cancelled while waiting on the lock
    print("----")
    t0 = asyncio.create_task(task_cancel(0, lock))
    t1 = asyncio.create_task(task_cancel(1, lock))
    t2 = asyncio.create_task(task_cancel(2, lock))
    await asyncio.sleep(0.05)
    t1.cancel()
    await asyncio.sleep(0.1)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test Lock class

try:
    import uasyncio as asyncio
except ImportError:
    try:
        import asyncio
    except ImportError:
        print("SKIP")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                      raise SystemExit


async def task_loop(id, lock):
    print("task start", id)
    for i in range(3):
        async with lock:
            print("task have", id, i)
    print("task end", id)

            

Reported by Pylint.

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

Line: 13 Column: 1

                      raise SystemExit


async def task_loop(id, lock):
    print("task start", id)
    for i in range(3):
        async with lock:
            print("task have", id, i)
    print("task end", id)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 1

                  print("task end", id)


async def task_sleep(lock):
    async with lock:
        print("task have", lock.locked())
        await asyncio.sleep(0.2)
    print("task release", lock.locked())
    await lock.acquire()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 31 Column: 1

                  lock.release()


async def task_cancel(id, lock, to_cancel=None):
    try:
        async with lock:
            print("task got", id)
            await asyncio.sleep(0.1)
        print("task release", id)

            

Reported by Pylint.

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

Line: 31 Column: 1

                  lock.release()


async def task_cancel(id, lock, to_cancel=None):
    try:
        async with lock:
            print("task got", id)
            await asyncio.sleep(0.1)
        print("task release", id)

            

Reported by Pylint.

extmod/webrepl/webrepl_setup.py
16 issues
Unable to import 'machine'
Error

Line: 5 Column: 1

              
# import uos as os
import os
import machine

RC = "./boot.py"
CONFIG = "./webrepl_cfg.py"



            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import sys

# import uos as os
import os
import machine

RC = "./boot.py"
CONFIG = "./webrepl_cfg.py"


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 1

              CONFIG = "./webrepl_cfg.py"


def input_choice(prompt, choices):
    while 1:
        resp = input(prompt)
        if resp in choices:
            return resp


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 1

                          return resp


def getpass(prompt):
    return input(prompt)


def input_pass():
    while 1:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 22 Column: 1

                  return input(prompt)


def input_pass():
    while 1:
        passwd1 = getpass("New password (4-9 chars): ")
        if len(passwd1) < 4 or len(passwd1) > 9:
            print("Invalid password length")
            continue

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 34 Column: 1

                      print("Passwords do not match")


def exists(fname):
    try:
        with open(fname):
            pass
        return True
    except OSError:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 43 Column: 1

                      return False


def get_daemon_status():
    with open(RC) as f:
        for l in f:
            if "webrepl" in l:
                if l.startswith("#"):
                    return False

            

Reported by Pylint.

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

Line: 44 Column: 22

              

def get_daemon_status():
    with open(RC) as f:
        for l in f:
            if "webrepl" in l:
                if l.startswith("#"):
                    return False
                return True

            

Reported by Pylint.

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

Line: 45 Column: 13

              
def get_daemon_status():
    with open(RC) as f:
        for l in f:
            if "webrepl" in l:
                if l.startswith("#"):
                    return False
                return True
        return None

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 53 Column: 1

                      return None


def change_daemon(action):
    LINES = ("import webrepl", "webrepl.start()")
    with open(RC) as old_f, open(RC + ".tmp", "w") as new_f:
        found = False
        for l in old_f:
            for patt in LINES:

            

Reported by Pylint.

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

Line: 10 Column: 9

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


async def task(id, ev):
    print("start", id)
    print(await ev.wait())

            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 13 Column: 16

                      raise SystemExit


async def task(id, ev):
    print("start", id)
    print(await ev.wait())
    print("end", id)



            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test Event class

try:
    import uasyncio as asyncio
except ImportError:
    try:
        import asyncio
    except ImportError:
        print("SKIP")

            

Reported by Pylint.

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

Line: 13 Column: 1

                      raise SystemExit


async def task(id, ev):
    print("start", id)
    print(await ev.wait())
    print("end", id)



            

Reported by Pylint.

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

Line: 13 Column: 1

                      raise SystemExit


async def task(id, ev):
    print("start", id)
    print(await ev.wait())
    print("end", id)



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                      raise SystemExit


async def task(id, ev):
    print("start", id)
    print(await ev.wait())
    print("end", id)



            

Reported by Pylint.

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

Line: 19 Column: 1

                  print("end", id)


async def task_delay_set(t, ev):
    await asyncio.sleep(t)
    print("set event")
    ev.set()



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 1

                  print("end", id)


async def task_delay_set(t, ev):
    await asyncio.sleep(t)
    print("set event")
    ev.set()



            

Reported by Pylint.

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

Line: 19 Column: 1

                  print("end", id)


async def task_delay_set(t, ev):
    await asyncio.sleep(t)
    print("set event")
    ev.set()



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 25 Column: 1

                  ev.set()


async def main():
    ev = asyncio.Event()

    # Set and clear without anything waiting, and test is_set()
    print(ev.is_set())
    ev.set()

            

Reported by Pylint.

tests/perf_bench/bm_fft.py
16 issues
'fft' does not support item assignment
Error

Line: 64 Column: 9

              
    def result():
        nonlocal fft, fft_inv
        fft[1] -= 0.5 * params[1]
        fft[-1] -= 0.5 * params[1]
        fft_ok = all(abs(f) < 1e-3 for f in fft)
        for i in range(len(fft_inv)):
            fft_inv[i] -= params[1] * signal[i]
        fft_inv_ok = all(abs(f) < 1e-3 for f in fft_inv)

            

Reported by Pylint.

'fft' does not support item assignment
Error

Line: 65 Column: 9

                  def result():
        nonlocal fft, fft_inv
        fft[1] -= 0.5 * params[1]
        fft[-1] -= 0.5 * params[1]
        fft_ok = all(abs(f) < 1e-3 for f in fft)
        for i in range(len(fft_inv)):
            fft_inv[i] -= params[1] * signal[i]
        fft_inv_ok = all(abs(f) < 1e-3 for f in fft_inv)
        return params[0] * params[1], (fft_ok, fft_inv_ok)

            

Reported by Pylint.

Non-iterable value fft is used in an iterating context
Error

Line: 66 Column: 45

                      nonlocal fft, fft_inv
        fft[1] -= 0.5 * params[1]
        fft[-1] -= 0.5 * params[1]
        fft_ok = all(abs(f) < 1e-3 for f in fft)
        for i in range(len(fft_inv)):
            fft_inv[i] -= params[1] * signal[i]
        fft_inv_ok = all(abs(f) < 1e-3 for f in fft_inv)
        return params[0] * params[1], (fft_ok, fft_inv_ok)


            

Reported by Pylint.

'fft_inv' does not support item assignment
Error

Line: 68 Column: 13

                      fft[-1] -= 0.5 * params[1]
        fft_ok = all(abs(f) < 1e-3 for f in fft)
        for i in range(len(fft_inv)):
            fft_inv[i] -= params[1] * signal[i]
        fft_inv_ok = all(abs(f) < 1e-3 for f in fft_inv)
        return params[0] * params[1], (fft_ok, fft_inv_ok)

    return run, result

            

Reported by Pylint.

Non-iterable value fft_inv is used in an iterating context
Error

Line: 69 Column: 49

                      fft_ok = all(abs(f) < 1e-3 for f in fft)
        for i in range(len(fft_inv)):
            fft_inv[i] -= params[1] * signal[i]
        fft_inv_ok = all(abs(f) < 1e-3 for f in fft_inv)
        return params[0] * params[1], (fft_ok, fft_inv_ok)

    return run, result

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 11 Column: 13

                  # Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.
    def reverse(x, bits):
        y = 0
        for i in range(bits):
            y = (y << 1) | (x & 1)
            x >>= 1
        return y

    # Initialization

            

Reported by Pylint.

Unused variable 'state'
Error

Line: 51 Column: 5

              

def bm_setup(params):
    state = None
    signal = [math.cos(2 * math.pi * i / params[1]) + 0j for i in range(params[1])]
    fft = None
    fft_inv = None

    def run():

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Copyright (c) 2019 Project Nayuki. (MIT License)
# https://www.nayuki.io/page/free-small-fft-in-multiple-languages

import math, cmath


def transform_radix2(vector, inverse):
    # Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.
    def reverse(x, bits):

            

Reported by Pylint.

Multiple imports on one line (math, cmath)
Error

Line: 4 Column: 1

              # Copyright (c) 2019 Project Nayuki. (MIT License)
# https://www.nayuki.io/page/free-small-fft-in-multiple-languages

import math, cmath


def transform_radix2(vector, inverse):
    # Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.
    def reverse(x, bits):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              import math, cmath


def transform_radix2(vector, inverse):
    # Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.
    def reverse(x, bits):
        y = 0
        for i in range(bits):
            y = (y << 1) | (x & 1)

            

Reported by Pylint.

ports/nrf/examples/ubluepy_eddystone.py
16 issues
Unable to import 'ubluepy'
Error

Line: 1 Column: 1

              from ubluepy import Peripheral, constants

BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = const(0x02)
BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = const(0x04)

BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE = const(
    BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
)


            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 3 Column: 41

              from ubluepy import Peripheral, constants

BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = const(0x02)
BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = const(0x04)

BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE = const(
    BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
)


            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 4 Column: 41

              from ubluepy import Peripheral, constants

BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = const(0x02)
BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = const(0x04)

BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE = const(
    BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
)


            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 6 Column: 47

              BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = const(0x02)
BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = const(0x04)

BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE = const(
    BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
)

EDDYSTONE_FRAME_TYPE_URL = const(0x10)
EDDYSTONE_URL_PREFIX_HTTP_WWW = const(0x00)  # "http://www".

            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 10 Column: 28

                  BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
)

EDDYSTONE_FRAME_TYPE_URL = const(0x10)
EDDYSTONE_URL_PREFIX_HTTP_WWW = const(0x00)  # "http://www".
EDDYSTONE_URL_SUFFIX_DOT_COM = const(0x01)  # ".com"


def string_to_binarray(text):

            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 11 Column: 33

              )

EDDYSTONE_FRAME_TYPE_URL = const(0x10)
EDDYSTONE_URL_PREFIX_HTTP_WWW = const(0x00)  # "http://www".
EDDYSTONE_URL_SUFFIX_DOT_COM = const(0x01)  # ".com"


def string_to_binarray(text):
    b = bytearray([])

            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 12 Column: 32

              
EDDYSTONE_FRAME_TYPE_URL = const(0x10)
EDDYSTONE_URL_PREFIX_HTTP_WWW = const(0x00)  # "http://www".
EDDYSTONE_URL_SUFFIX_DOT_COM = const(0x01)  # ".com"


def string_to_binarray(text):
    b = bytearray([])
    for c in text:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from ubluepy import Peripheral, constants

BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = const(0x02)
BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = const(0x04)

BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE = const(
    BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 1

              EDDYSTONE_URL_SUFFIX_DOT_COM = const(0x01)  # ".com"


def string_to_binarray(text):
    b = bytearray([])
    for c in text:
        b.append(ord(c))
    return b


            

Reported by Pylint.

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

Line: 16 Column: 5

              

def string_to_binarray(text):
    b = bytearray([])
    for c in text:
        b.append(ord(c))
    return b



            

Reported by Pylint.

tests/micropython/heapalloc_inst_call.py
16 issues
Unable to import 'micropython'
Error

Line: 3 Column: 1

              # Test that calling clazz.__call__() with up to at least 3 arguments
# doesn't require heap allocation.
import micropython


class Foo0:
    def __call__(self):
        print("__call__")


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test that calling clazz.__call__() with up to at least 3 arguments
# doesn't require heap allocation.
import micropython


class Foo0:
    def __call__(self):
        print("__call__")


            

Reported by Pylint.

Missing class docstring
Error

Line: 6 Column: 1

              import micropython


class Foo0:
    def __call__(self):
        print("__call__")


class Foo1:

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 6 Column: 1

              import micropython


class Foo0:
    def __call__(self):
        print("__call__")


class Foo1:

            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 1

                      print("__call__")


class Foo1:
    def __call__(self, a):
        print("__call__", a)


class Foo2:

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 11 Column: 1

                      print("__call__")


class Foo1:
    def __call__(self, a):
        print("__call__", a)


class Foo2:

            

Reported by Pylint.

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

Line: 12 Column: 5

              

class Foo1:
    def __call__(self, a):
        print("__call__", a)


class Foo2:
    def __call__(self, a, b):

            

Reported by Pylint.

Missing class docstring
Error

Line: 16 Column: 1

                      print("__call__", a)


class Foo2:
    def __call__(self, a, b):
        print("__call__", a, b)


class Foo3:

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 16 Column: 1

                      print("__call__", a)


class Foo2:
    def __call__(self, a, b):
        print("__call__", a, b)


class Foo3:

            

Reported by Pylint.

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

Line: 17 Column: 5

              

class Foo2:
    def __call__(self, a, b):
        print("__call__", a, b)


class Foo3:
    def __call__(self, a, b, c):

            

Reported by Pylint.

tests/thread/mutate_dict.py
16 issues
Undefined variable 'n_finished'
Error

Line: 27 Column: 9

              
    with lock:
        global n_finished
        n_finished += 1


lock = _thread.allocate_lock()
n_thread = 4
n_finished = 0

            

Reported by Pylint.

Redefining name 'i' from outer scope (line 35)
Error

Line: 13 Column: 13

              # main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            di[i] = repeat + i
            assert di[i] == repeat + i

            del di[i]
            assert i not in di

            

Reported by Pylint.

Using the global statement
Error

Line: 26 Column: 9

                          assert di.pop(i) == repeat + i

    with lock:
        global n_finished
        n_finished += 1


lock = _thread.allocate_lock()
n_thread = 4

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test concurrent mutating access to a shared dict object
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

import _thread

# the shared dict
di = {"a": "A", "b": "B", "c": "C", "d": "D"}


            

Reported by Pylint.

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

Line: 11 Column: 1

              di = {"a": "A", "b": "B", "c": "C", "d": "D"}

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            di[i] = repeat + i
            assert di[i] == repeat + i


            

Reported by Pylint.

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

Line: 11 Column: 1

              di = {"a": "A", "b": "B", "c": "C", "d": "D"}

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            di[i] = repeat + i
            assert di[i] == repeat + i


            

Reported by Pylint.

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

Line: 11 Column: 1

              di = {"a": "A", "b": "B", "c": "C", "d": "D"}

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            di[i] = repeat + i
            assert di[i] == repeat + i


            

Reported by Pylint.

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

Line: 11 Column: 1

              di = {"a": "A", "b": "B", "c": "C", "d": "D"}

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            di[i] = repeat + i
            assert di[i] == repeat + i


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 1

              di = {"a": "A", "b": "B", "c": "C", "d": "D"}

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            di[i] = repeat + i
            assert di[i] == repeat + i


            

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

                  for repeat in range(n):
        for i in range(lo, hi):
            di[i] = repeat + i
            assert di[i] == repeat + i

            del di[i]
            assert i not in di

            di[i] = repeat + i

            

Reported by Bandit.

tests/basics/gen_yield_from_ducktype.py
16 issues
Using the global statement
Error

Line: 57 Column: 5

                      raise StopIteration(42)

def gen4():
    global ret
    ret = yield from MyIter()
    1//0

ret = None
try:

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 59 Column: 5

              def gen4():
    global ret
    ret = yield from MyIter()
    1//0

ret = None
try:
    print(list(gen4()))
except ZeroDivisionError:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              class MyGen:

    def __init__(self):
        self.v = 0

    def __iter__(self):
        return self

    def __next__(self):

            

Reported by Pylint.

Missing class docstring
Error

Line: 1 Column: 1

              class MyGen:

    def __init__(self):
        self.v = 0

    def __iter__(self):
        return self

    def __next__(self):

            

Reported by Pylint.

Attribute name "v" doesn't conform to snake_case naming style
Error

Line: 4 Column: 9

              class MyGen:

    def __init__(self):
        self.v = 0

    def __iter__(self):
        return self

    def __next__(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 1

                          raise StopIteration
        return self.v

def gen():
    yield from MyGen()

def gen2():
    yield from gen()


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 1

              def gen():
    yield from MyGen()

def gen2():
    yield from gen()

print(list(gen()))
print(list(gen2()))


            

Reported by Pylint.

Missing class docstring
Error

Line: 25 Column: 1

              print(list(gen2()))


class Incrementer:

    def __iter__(self):
        return self

    def __next__(self):

            

Reported by Pylint.

Method could be a function
Error

Line: 33 Column: 5

                  def __next__(self):
        return self.send(None)

    def send(self, val):
        if val is None:
            return "Incrementer initialized"
        return val + 1

def gen3():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 33 Column: 5

                  def __next__(self):
        return self.send(None)

    def send(self, val):
        if val is None:
            return "Incrementer initialized"
        return val + 1

def gen3():

            

Reported by Pylint.