The following issues were found

tests/multi_bluetooth/ble_gattc_discover_services.py
23 issues
Unable to import 'micropython'
Error

Line: 3 Column: 1

              # Test BLE GAP connect/disconnect

from micropython import const
import time, machine, bluetooth

TIMEOUT_MS = 5000

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)

            

Reported by Pylint.

Unable to import 'machine'
Error

Line: 4 Column: 1

              # Test BLE GAP connect/disconnect

from micropython import const
import time, machine, bluetooth

TIMEOUT_MS = 5000

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)

            

Reported by Pylint.

Unable to import 'bluetooth'
Error

Line: 4 Column: 1

              # Test BLE GAP connect/disconnect

from micropython import const
import time, machine, bluetooth

TIMEOUT_MS = 5000

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)

            

Reported by Pylint.

Module 'time' has no 'ticks_ms' member
Error

Line: 55 Column: 10

              

def wait_for_event(event, timeout_ms):
    t0 = time.ticks_ms()
    while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
        if event in waiting_events:
            return waiting_events.pop(event)
        machine.idle()
    raise ValueError("Timeout waiting for {}".format(event))

            

Reported by Pylint.

Module 'time' has no 'ticks_diff' member
Error

Line: 56 Column: 11

              
def wait_for_event(event, timeout_ms):
    t0 = time.ticks_ms()
    while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
        if event in waiting_events:
            return waiting_events.pop(event)
        machine.idle()
    raise ValueError("Timeout waiting for {}".format(event))


            

Reported by Pylint.

Module 'time' has no 'ticks_ms' member
Error

Line: 56 Column: 27

              
def wait_for_event(event, timeout_ms):
    t0 = time.ticks_ms()
    while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
        if event in waiting_events:
            return waiting_events.pop(event)
        machine.idle()
    raise ValueError("Timeout waiting for {}".format(event))


            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 65 Column: 5

              
# Acting in peripheral role.
def instance0():
    multitest.globals(BDADDR=ble.config("mac"))
    ble.gatts_register_services(SERVICES)
    print("gap_advertise")
    ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
    multitest.next()
    try:

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 69 Column: 5

                  ble.gatts_register_services(SERVICES)
    print("gap_advertise")
    ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
    multitest.next()
    try:
        wait_for_event(_IRQ_CENTRAL_CONNECT, TIMEOUT_MS)
        wait_for_event(_IRQ_CENTRAL_DISCONNECT, TIMEOUT_MS)
    finally:
        ble.active(0)

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 79 Column: 5

              
# Acting in central role.
def instance1():
    multitest.next()
    try:
        # Connect to peripheral and then disconnect.
        print("gap_connect")
        ble.gap_connect(*BDADDR)
        conn_handle = wait_for_event(_IRQ_PERIPHERAL_CONNECT, TIMEOUT_MS)

            

Reported by Pylint.

Undefined variable 'BDADDR'
Error

Line: 83 Column: 26

                  try:
        # Connect to peripheral and then disconnect.
        print("gap_connect")
        ble.gap_connect(*BDADDR)
        conn_handle = wait_for_event(_IRQ_PERIPHERAL_CONNECT, TIMEOUT_MS)

        # Discover services.
        ble.gattc_discover_services(conn_handle)
        wait_for_event(_IRQ_GATTC_SERVICE_DONE, TIMEOUT_MS)

            

Reported by Pylint.

tests/net_inet/test_tls_nonblock.py
23 issues
No exception type(s) specified
Error

Line: 3 Column: 1

              try:
    import usocket as socket, ussl as ssl, uerrno as errno, sys
except:
    import socket, ssl, errno, sys, time, select


def test_one(site, opts):
    ai = socket.getaddrinfo(site, 443)
    addr = ai[0][-1]

            

Reported by Pylint.

Unused argument 'opts'
Error

Line: 7 Column: 20

                  import socket, ssl, errno, sys, time, select


def test_one(site, opts):
    ai = socket.getaddrinfo(site, 443)
    addr = ai[0][-1]
    print(addr)

    # Connect the raw socket

            

Reported by Pylint.

Using deprecated method wrap_socket()
Error

Line: 30 Column: 21

                      # Wrap with SSL
        try:
            if sys.implementation.name == "micropython":
                s = ssl.wrap_socket(s, do_handshake=False)
            else:
                s = ssl.wrap_socket(s, do_handshake_on_connect=False)
        except OSError as e:
            if e.errno != errno.EINPROGRESS:
                raise

            

Reported by Pylint.

Using deprecated method wrap_socket()
Error

Line: 32 Column: 21

                          if sys.implementation.name == "micropython":
                s = ssl.wrap_socket(s, do_handshake=False)
            else:
                s = ssl.wrap_socket(s, do_handshake_on_connect=False)
        except OSError as e:
            if e.errno != errno.EINPROGRESS:
                raise
        print("wrapped")


            

Reported by Pylint.

Unused variable 'e'
Error

Line: 111 Column: 9

                      try:
            test_one(site, opts)
            print(site, "ok")
        except Exception as e:
            print(site, "error")
    print("DONE")


main()

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 111 Column: 16

                      try:
            test_one(site, opts)
            print(site, "ok")
        except Exception as e:
            print(site, "error")
    print("DONE")


main()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    import usocket as socket, ussl as ssl, uerrno as errno, sys
except:
    import socket, ssl, errno, sys, time, select


def test_one(site, opts):
    ai = socket.getaddrinfo(site, 443)
    addr = ai[0][-1]

            

Reported by Pylint.

Multiple imports on one line (usocket, ussl, uerrno, sys)
Error

Line: 2 Column: 5

              try:
    import usocket as socket, ussl as ssl, uerrno as errno, sys
except:
    import socket, ssl, errno, sys, time, select


def test_one(site, opts):
    ai = socket.getaddrinfo(site, 443)
    addr = ai[0][-1]

            

Reported by Pylint.

Multiple imports on one line (socket, ssl, errno, sys, time, select)
Error

Line: 4 Column: 5

              try:
    import usocket as socket, ussl as ssl, uerrno as errno, sys
except:
    import socket, ssl, errno, sys, time, select


def test_one(site, opts):
    ai = socket.getaddrinfo(site, 443)
    addr = ai[0][-1]

            

Reported by Pylint.

Imports from package sys are not grouped
Error

Line: 4 Column: 5

              try:
    import usocket as socket, ussl as ssl, uerrno as errno, sys
except:
    import socket, ssl, errno, sys, time, select


def test_one(site, opts):
    ai = socket.getaddrinfo(site, 443)
    addr = ai[0][-1]

            

Reported by Pylint.

tests/inlineasm/asmblbx.py
23 issues
Undefined variable 'micropython'
Error

Line: 4 Column: 2

              # test bl and bx instructions


@micropython.asm_thumb
def f(r0):
    # jump over the internal functions
    b(entry)

    label(func1)

            

Reported by Pylint.

Undefined variable 'entry'
Error

Line: 7 Column: 7

              @micropython.asm_thumb
def f(r0):
    # jump over the internal functions
    b(entry)

    label(func1)
    add(r0, 2)
    bx(lr)


            

Reported by Pylint.

Undefined variable 'b'
Error

Line: 7 Column: 5

              @micropython.asm_thumb
def f(r0):
    # jump over the internal functions
    b(entry)

    label(func1)
    add(r0, 2)
    bx(lr)


            

Reported by Pylint.

Undefined variable 'func1'
Error

Line: 9 Column: 11

                  # jump over the internal functions
    b(entry)

    label(func1)
    add(r0, 2)
    bx(lr)

    label(func2)
    sub(r0, 1)

            

Reported by Pylint.

Undefined variable 'label'
Error

Line: 9 Column: 5

                  # jump over the internal functions
    b(entry)

    label(func1)
    add(r0, 2)
    bx(lr)

    label(func2)
    sub(r0, 1)

            

Reported by Pylint.

Undefined variable 'add'
Error

Line: 10 Column: 5

                  b(entry)

    label(func1)
    add(r0, 2)
    bx(lr)

    label(func2)
    sub(r0, 1)
    bx(lr)

            

Reported by Pylint.

Undefined variable 'lr'
Error

Line: 11 Column: 8

              
    label(func1)
    add(r0, 2)
    bx(lr)

    label(func2)
    sub(r0, 1)
    bx(lr)


            

Reported by Pylint.

Undefined variable 'bx'
Error

Line: 11 Column: 5

              
    label(func1)
    add(r0, 2)
    bx(lr)

    label(func2)
    sub(r0, 1)
    bx(lr)


            

Reported by Pylint.

Undefined variable 'label'
Error

Line: 13 Column: 5

                  add(r0, 2)
    bx(lr)

    label(func2)
    sub(r0, 1)
    bx(lr)

    label(entry)
    bl(func1)

            

Reported by Pylint.

Undefined variable 'func2'
Error

Line: 13 Column: 11

                  add(r0, 2)
    bx(lr)

    label(func2)
    sub(r0, 1)
    bx(lr)

    label(entry)
    bl(func1)

            

Reported by Pylint.

ports/nrf/examples/ubluepy_temp.py
23 issues
Unable to import 'board'
Error

Line: 25 Column: 1

              # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE

from board import LED
from machine import RTCounter, Temp
from ubluepy import Service, Characteristic, UUID, Peripheral, constants


def event_handler(id, handle, data):

            

Reported by Pylint.

Unable to import 'machine'
Error

Line: 26 Column: 1

              # THE SOFTWARE

from board import LED
from machine import RTCounter, Temp
from ubluepy import Service, Characteristic, UUID, Peripheral, constants


def event_handler(id, handle, data):
    global rtc

            

Reported by Pylint.

Unable to import 'ubluepy'
Error

Line: 27 Column: 1

              
from board import LED
from machine import RTCounter, Temp
from ubluepy import Service, Characteristic, UUID, Peripheral, constants


def event_handler(id, handle, data):
    global rtc
    global periph

            

Reported by Pylint.

Unused argument 'handle'
Error

Line: 30 Column: 23

              from ubluepy import Service, Characteristic, UUID, Peripheral, constants


def event_handler(id, handle, data):
    global rtc
    global periph
    global serv_env_sense
    global notif_enabled


            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 30 Column: 19

              from ubluepy import Service, Characteristic, UUID, Peripheral, constants


def event_handler(id, handle, data):
    global rtc
    global periph
    global serv_env_sense
    global notif_enabled


            

Reported by Pylint.

Using the global statement
Error

Line: 31 Column: 5

              

def event_handler(id, handle, data):
    global rtc
    global periph
    global serv_env_sense
    global notif_enabled

    if id == constants.EVT_GAP_CONNECTED:

            

Reported by Pylint.

Using the global statement
Error

Line: 32 Column: 5

              
def event_handler(id, handle, data):
    global rtc
    global periph
    global serv_env_sense
    global notif_enabled

    if id == constants.EVT_GAP_CONNECTED:
        # indicated 'connected'

            

Reported by Pylint.

Using the global statement
Error

Line: 33 Column: 5

              def event_handler(id, handle, data):
    global rtc
    global periph
    global serv_env_sense
    global notif_enabled

    if id == constants.EVT_GAP_CONNECTED:
        # indicated 'connected'
        LED(1).on()

            

Reported by Pylint.

Using the global statement
Error

Line: 34 Column: 5

                  global rtc
    global periph
    global serv_env_sense
    global notif_enabled

    if id == constants.EVT_GAP_CONNECTED:
        # indicated 'connected'
        LED(1).on()


            

Reported by Pylint.

Unused argument 'timer_id'
Error

Line: 60 Column: 15

                          rtc.stop()


def send_temp(timer_id):
    global notif_enabled
    global char_temp

    if notif_enabled:
        # measure chip temperature

            

Reported by Pylint.

tests/basics/subclass_native_init.py
23 issues
class already defined line 4
Error

Line: 38 Column: 1

              a.reinit()

# call __init__() after object is already init'd
class L(list):
    def reinit(self):
        super().__init__(range(2))
a = L(range(5))
print(a)
a.reinit()

            

Reported by Pylint.

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

Line: 5 Column: 24

              
# overriding list.__init__()
class L(list):
    def __init__(self, a, b):
        super().__init__([a, b])
print(L(2, 3))

# inherits implicitly from object
class A:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test subclassing a native type and overriding __init__

# overriding list.__init__()
class L(list):
    def __init__(self, a, b):
        super().__init__([a, b])
print(L(2, 3))

# inherits implicitly from object

            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              # test subclassing a native type and overriding __init__

# overriding list.__init__()
class L(list):
    def __init__(self, a, b):
        super().__init__([a, b])
print(L(2, 3))

# inherits implicitly from object

            

Reported by Pylint.

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

Line: 4 Column: 1

              # test subclassing a native type and overriding __init__

# overriding list.__init__()
class L(list):
    def __init__(self, a, b):
        super().__init__([a, b])
print(L(2, 3))

# inherits implicitly from object

            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

              print(L(2, 3))

# inherits implicitly from object
class A:
    def __init__(self):
        print("A.__init__")
        super().__init__()
A()


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 10 Column: 1

              print(L(2, 3))

# inherits implicitly from object
class A:
    def __init__(self):
        print("A.__init__")
        super().__init__()
A()


            

Reported by Pylint.

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

Line: 10 Column: 1

              print(L(2, 3))

# inherits implicitly from object
class A:
    def __init__(self):
        print("A.__init__")
        super().__init__()
A()


            

Reported by Pylint.

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

Line: 17 Column: 1

              A()

# inherits explicitly from object
class B(object):
    def __init__(self):
        print("B.__init__")
        super().__init__()
B()


            

Reported by Pylint.

Missing class docstring
Error

Line: 17 Column: 1

              A()

# inherits explicitly from object
class B(object):
    def __init__(self):
        print("B.__init__")
        super().__init__()
B()


            

Reported by Pylint.

tests/multi_bluetooth/ble_gap_connect.py
22 issues
Unable to import 'micropython'
Error

Line: 3 Column: 1

              # Test BLE GAP connect/disconnect

from micropython import const
import time, machine, bluetooth

TIMEOUT_MS = 4000

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)

            

Reported by Pylint.

Unable to import 'machine'
Error

Line: 4 Column: 1

              # Test BLE GAP connect/disconnect

from micropython import const
import time, machine, bluetooth

TIMEOUT_MS = 4000

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)

            

Reported by Pylint.

Unable to import 'bluetooth'
Error

Line: 4 Column: 1

              # Test BLE GAP connect/disconnect

from micropython import const
import time, machine, bluetooth

TIMEOUT_MS = 4000

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)

            

Reported by Pylint.

Module 'time' has no 'ticks_ms' member
Error

Line: 33 Column: 10

              

def wait_for_event(event, timeout_ms):
    t0 = time.ticks_ms()
    while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
        if event in waiting_events:
            return waiting_events.pop(event)
        machine.idle()
    raise ValueError("Timeout waiting for {}".format(event))

            

Reported by Pylint.

Module 'time' has no 'ticks_ms' member
Error

Line: 34 Column: 27

              
def wait_for_event(event, timeout_ms):
    t0 = time.ticks_ms()
    while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
        if event in waiting_events:
            return waiting_events.pop(event)
        machine.idle()
    raise ValueError("Timeout waiting for {}".format(event))


            

Reported by Pylint.

Module 'time' has no 'ticks_diff' member
Error

Line: 34 Column: 11

              
def wait_for_event(event, timeout_ms):
    t0 = time.ticks_ms()
    while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
        if event in waiting_events:
            return waiting_events.pop(event)
        machine.idle()
    raise ValueError("Timeout waiting for {}".format(event))


            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 43 Column: 5

              
# Acting in peripheral role.
def instance0():
    multitest.globals(BDADDR=ble.config("mac"))
    print("gap_advertise")
    ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
    multitest.next()
    try:
        # Wait for central to connect, then wait for it to disconnect.

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 46 Column: 5

                  multitest.globals(BDADDR=ble.config("mac"))
    print("gap_advertise")
    ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
    multitest.next()
    try:
        # Wait for central to connect, then wait for it to disconnect.
        wait_for_event(_IRQ_CENTRAL_CONNECT, TIMEOUT_MS)
        wait_for_event(_IRQ_CENTRAL_DISCONNECT, TIMEOUT_MS)


            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 66 Column: 5

              
# Acting in central role.
def instance1():
    multitest.next()
    try:
        # Connect to peripheral and then disconnect.
        print("gap_connect")
        ble.gap_connect(*BDADDR)
        conn_handle = wait_for_event(_IRQ_PERIPHERAL_CONNECT, TIMEOUT_MS)

            

Reported by Pylint.

Undefined variable 'BDADDR'
Error

Line: 70 Column: 26

                  try:
        # Connect to peripheral and then disconnect.
        print("gap_connect")
        ble.gap_connect(*BDADDR)
        conn_handle = wait_for_event(_IRQ_PERIPHERAL_CONNECT, TIMEOUT_MS)
        print("gap_disconnect:", ble.gap_disconnect(conn_handle))
        wait_for_event(_IRQ_PERIPHERAL_DISCONNECT, TIMEOUT_MS)

        # Connect to peripheral and then let the peripheral disconnect us.

            

Reported by Pylint.

tests/extmod/uasyncio_wait_for.py
22 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, t):
    print("task start", id)
    await asyncio.sleep(t)

            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 13 Column: 16

                      raise SystemExit


async def task(id, t):
    print("task start", id)
    await asyncio.sleep(t)
    print("task end", id)
    return id * 2


            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 41 Column: 32

                  other.cancel()


async def task_wait_for_cancel(id, t, t_wait):
    print("task_wait_for_cancel start")
    try:
        await asyncio.wait_for(task(id, t), t_wait)
    except asyncio.CancelledError as er:
        print("task_wait_for_cancel cancelled")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test asyncio.wait_for

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

            

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, t):
    print("task start", id)
    await asyncio.sleep(t)
    print("task end", id)
    return id * 2


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                      raise SystemExit


async def task(id, t):
    print("task start", id)
    await asyncio.sleep(t)
    print("task end", id)
    return id * 2


            

Reported by Pylint.

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

Line: 13 Column: 1

                      raise SystemExit


async def task(id, t):
    print("task start", id)
    await asyncio.sleep(t)
    print("task end", id)
    return id * 2


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 20 Column: 1

                  return id * 2


async def task_catch():
    print("task_catch start")
    try:
        await asyncio.sleep(0.2)
    except asyncio.CancelledError:
        print("ignore cancel")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 29 Column: 1

                  print("task_catch done")


async def task_raise():
    print("task start")
    raise ValueError


async def task_cancel_other(t, other):

            

Reported by Pylint.

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

Line: 34 Column: 1

                  raise ValueError


async def task_cancel_other(t, other):
    print("task_cancel_other start")
    await asyncio.sleep(t)
    print("task_cancel_other cancel")
    other.cancel()


            

Reported by Pylint.

tests/basics/with_return.py
22 issues
function already defined line 19
Error

Line: 26 Column: 1

              print(f())

# multiple for loops within with
def f():
    with CtxMgr(1):
        for i in [1, 2]:
            for j in [3, 4]:
                return (i, j)
print(f())

            

Reported by Pylint.

function already defined line 19
Error

Line: 34 Column: 1

              print(f())

# multiple for loops within nested withs
def f():
    with CtxMgr(1):
        for i in [1, 2]:
            for j in [3, 4]:
                with CtxMgr(2):
                    for k in [5, 6]:

            

Reported by Pylint.

function already defined line 19
Error

Line: 45 Column: 1

              print(f())

# multiple for loops that are optimised, and nested withs
def f():
    with CtxMgr(1):
        for i in range(1, 3):
            for j in range(3, 5):
                with CtxMgr(2):
                    for k in range(5, 7):

            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 2 Column: 24

              class CtxMgr:
    def __init__(self, id):
        self.id = id

    def __enter__(self):
        print("__enter__", self.id)
        return self

    def __exit__(self, a, b, c):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              class CtxMgr:
    def __init__(self, id):
        self.id = id

    def __enter__(self):
        print("__enter__", self.id)
        return self

    def __exit__(self, a, b, c):

            

Reported by Pylint.

Missing class docstring
Error

Line: 1 Column: 1

              class CtxMgr:
    def __init__(self, id):
        self.id = id

    def __enter__(self):
        print("__enter__", self.id)
        return self

    def __exit__(self, a, b, c):

            

Reported by Pylint.

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

Line: 3 Column: 9

              class CtxMgr:
    def __init__(self, id):
        self.id = id

    def __enter__(self):
        print("__enter__", self.id)
        return self

    def __exit__(self, a, b, c):

            

Reported by Pylint.

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

Line: 9 Column: 5

                      print("__enter__", self.id)
        return self

    def __exit__(self, a, b, c):
        print("__exit__", self.id, repr(a), repr(b))

# simple case
def foo():
    with CtxMgr(1):

            

Reported by Pylint.

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

Line: 9 Column: 5

                      print("__enter__", self.id)
        return self

    def __exit__(self, a, b, c):
        print("__exit__", self.id, repr(a), repr(b))

# simple case
def foo():
    with CtxMgr(1):

            

Reported by Pylint.

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

Line: 9 Column: 5

                      print("__enter__", self.id)
        return self

    def __exit__(self, a, b, c):
        print("__exit__", self.id, repr(a), repr(b))

# simple case
def foo():
    with CtxMgr(1):

            

Reported by Pylint.

extmod/uasyncio/funcs.py
22 issues
Attempted relative import beyond top-level package
Error

Line: 4 Column: 1

              # MicroPython uasyncio module
# MIT license; Copyright (c) 2019-2020 Damien P. George

from . import core


async def wait_for(aw, timeout, sleep=core.sleep):
    aw = core._promote_to_task(aw)
    if timeout is None:

            

Reported by Pylint.

Access to a protected member _promote_to_task of a client class
Error

Line: 8 Column: 10

              

async def wait_for(aw, timeout, sleep=core.sleep):
    aw = core._promote_to_task(aw)
    if timeout is None:
        return await aw

    def runner(waiter, aw):
        nonlocal status, result

            

Reported by Pylint.

Catching too general exception BaseException
Error

Line: 17 Column: 16

                      try:
            result = await aw
            s = True
        except BaseException as er:
            s = er
        if status is None:
            # The waiter is still waiting, set status for it and cancel it.
            status = s
            waiter.cancel()

            

Reported by Pylint.

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

Line: 43 Column: 13

                          raise er
        else:
            # aw raised an exception, propagate it out to the caller.
            raise status

    # The sleep finished before aw, so cancel aw and raise TimeoutError.
    status = True
    runner_task.cancel()
    await runner_task

            

Reported by Pylint.

Access to a protected member _promote_to_task of a client class
Error

Line: 57 Column: 11

              

async def gather(*aws, return_exceptions=False):
    ts = [core._promote_to_task(aw) for aw in aws]
    for i in range(len(ts)):
        try:
            # TODO handle cancel of gather itself
            # if ts[i].coro:
            #    iter(ts[i]).waiting.push_head(cur_task)

            

Reported by Pylint.

TODO handle cancel of gather itself
Error

Line: 60 Column: 3

                  ts = [core._promote_to_task(aw) for aw in aws]
    for i in range(len(ts)):
        try:
            # TODO handle cancel of gather itself
            # if ts[i].coro:
            #    iter(ts[i]).waiting.push_head(cur_task)
            #    try:
            #        yield
            #    except CancelledError as er:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 69 Column: 16

                          #        # cancel all waiting tasks
            #        raise er
            ts[i] = await ts[i]
        except Exception as er:
            if return_exceptions:
                ts[i] = er
            else:
                raise er
    return ts

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # MicroPython uasyncio module
# MIT license; Copyright (c) 2019-2020 Damien P. George

from . import core


async def wait_for(aw, timeout, sleep=core.sleep):
    aw = core._promote_to_task(aw)
    if timeout is None:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              from . import core


async def wait_for(aw, timeout, sleep=core.sleep):
    aw = core._promote_to_task(aw)
    if timeout is None:
        return await aw

    def runner(waiter, aw):

            

Reported by Pylint.

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

Line: 7 Column: 1

              from . import core


async def wait_for(aw, timeout, sleep=core.sleep):
    aw = core._promote_to_task(aw)
    if timeout is None:
        return await aw

    def runner(waiter, aw):

            

Reported by Pylint.

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

Line: 7 Column: 5

                  compile
except NameError:
    print("SKIP")
    raise SystemExit

def test():
    global x

    c = compile("print(x)", "file", "exec")

            

Reported by Pylint.

Global variable 'x' undefined at the module level
Error

Line: 10 Column: 5

                  raise SystemExit

def test():
    global x

    c = compile("print(x)", "file", "exec")

    try:
        exec(c)

            

Reported by Pylint.

Use of exec detected.
Security

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

                  c = compile("print(x)", "file", "exec")

    try:
        exec(c)
    except NameError:
        print("NameError")

    # global variable for compiled code to access
    x = 1

            

Reported by Bandit.

Use of exec
Error

Line: 15 Column: 9

                  c = compile("print(x)", "file", "exec")

    try:
        exec(c)
    except NameError:
        print("NameError")

    # global variable for compiled code to access
    x = 1

            

Reported by Pylint.

Use of exec
Error

Line: 22 Column: 5

                  # global variable for compiled code to access
    x = 1

    exec(c)

    exec(c, {"x":2})
    exec(c, {}, {"x":3})

    # single/eval mode

            

Reported by Pylint.

Use of exec detected.
Security

Line: 22
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html

                  # global variable for compiled code to access
    x = 1

    exec(c)

    exec(c, {"x":2})
    exec(c, {}, {"x":3})

    # single/eval mode

            

Reported by Bandit.

Use of exec detected.
Security

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

              
    exec(c)

    exec(c, {"x":2})
    exec(c, {}, {"x":3})

    # single/eval mode
    exec(compile("if 1: 10 + 1\n", "file", "single"))
    exec(compile("print(10 + 2)", "file", "single"))

            

Reported by Bandit.

Use of exec
Error

Line: 24 Column: 5

              
    exec(c)

    exec(c, {"x":2})
    exec(c, {}, {"x":3})

    # single/eval mode
    exec(compile("if 1: 10 + 1\n", "file", "single"))
    exec(compile("print(10 + 2)", "file", "single"))

            

Reported by Pylint.

Use of exec
Error

Line: 25 Column: 5

                  exec(c)

    exec(c, {"x":2})
    exec(c, {}, {"x":3})

    # single/eval mode
    exec(compile("if 1: 10 + 1\n", "file", "single"))
    exec(compile("print(10 + 2)", "file", "single"))
    print(eval(compile("10 + 3", "file", "eval")))

            

Reported by Pylint.

Use of exec detected.
Security

Line: 25
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html

                  exec(c)

    exec(c, {"x":2})
    exec(c, {}, {"x":3})

    # single/eval mode
    exec(compile("if 1: 10 + 1\n", "file", "single"))
    exec(compile("print(10 + 2)", "file", "single"))
    print(eval(compile("10 + 3", "file", "eval")))

            

Reported by Bandit.