The following issues were found

tests/multi_net/uasyncio_tcp_readexactly.py
19 issues
Undefined variable 'multitest'
Error

Line: 44 Column: 5

                  ev = asyncio.Event()
    server = await asyncio.start_server(handle_connection, "0.0.0.0", PORT)
    print("server running")
    multitest.next()
    async with server:
        await asyncio.wait_for(ev.wait(), 10)


async def tcp_client():

            

Reported by Pylint.

Undefined variable 'IP'
Error

Line: 50 Column: 52

              

async def tcp_client():
    reader, writer = await asyncio.open_connection(IP, PORT)
    print(await reader.readexactly(2))
    print(await reader.readexactly(0))
    print(await reader.readexactly(1))
    try:
        print(await reader.readexactly(2))

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 62 Column: 5

              

def instance0():
    multitest.globals(IP=multitest.get_network_ip())
    asyncio.run(tcp_server())


def instance1():
    multitest.next()

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 62 Column: 26

              

def instance0():
    multitest.globals(IP=multitest.get_network_ip())
    asyncio.run(tcp_server())


def instance1():
    multitest.next()

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 67 Column: 5

              

def instance1():
    multitest.next()
    asyncio.run(tcp_client())

            

Reported by Pylint.

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

Line: 10 Column: 9

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

PORT = 8000


async def handle_connection(reader, writer):

            

Reported by Pylint.

Unused argument 'reader'
Error

Line: 15 Column: 29

              PORT = 8000


async def handle_connection(reader, writer):
    writer.write(b"a")
    await writer.drain()

    # Split the first 2 bytes up so the client must wait for the second one
    await asyncio.sleep(0.1)

            

Reported by Pylint.

Global variable 'ev' undefined at the module level
Error

Line: 40 Column: 5

              

async def tcp_server():
    global ev
    ev = asyncio.Event()
    server = await asyncio.start_server(handle_connection, "0.0.0.0", PORT)
    print("server running")
    multitest.next()
    async with server:

            

Reported by Pylint.

Possible binding to all interfaces.
Security

Line: 42
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b104_hardcoded_bind_all_interfaces.html

              async def tcp_server():
    global ev
    ev = asyncio.Event()
    server = await asyncio.start_server(handle_connection, "0.0.0.0", PORT)
    print("server running")
    multitest.next()
    async with server:
        await asyncio.wait_for(ev.wait(), 10)


            

Reported by Bandit.

Unused variable 'writer'
Error

Line: 50 Column: 13

              

async def tcp_client():
    reader, writer = await asyncio.open_connection(IP, PORT)
    print(await reader.readexactly(2))
    print(await reader.readexactly(0))
    print(await reader.readexactly(1))
    try:
        print(await reader.readexactly(2))

            

Reported by Pylint.

tests/extmod/vfs_blockdev.py
19 issues
Statement seems to have no effect
Error

Line: 6 Column: 5

              try:
    import uos

    uos.VfsFat
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 7 Column: 5

                  import uos

    uos.VfsFat
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit



            

Reported by Pylint.

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

Line: 10 Column: 5

                  uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


class RAMBlockDevice:
    ERASE_BLOCK_SIZE = 512


            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 32 Column: 25

                      for i in range(len(buf)):
            self.data[addr + i] = buf[i]

    def ioctl(self, op, arg):
        if op == 4:  # block count
            return len(self.data) // self.ERASE_BLOCK_SIZE
        if op == 5:  # block size
            return self.ERASE_BLOCK_SIZE
        if op == 6:  # erase block

            

Reported by Pylint.

Redefining name 'bdev' from outer scope (line 68)
Error

Line: 41 Column: 10

                          return 0


def test(bdev, vfs_class):
    print("test", vfs_class)

    # mkfs
    vfs_class.mkfs(bdev)


            

Reported by Pylint.

Unused variable 'i'
Error

Line: 55 Column: 9

              
    # open, write close
    f = vfs.open("test", "w")
    for i in range(10):
        f.write("some data")
    f.close()

    # ilistdir
    print(list(vfs.ilistdir()))

            

Reported by Pylint.

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

Line: 71 Column: 5

                  bdev = RAMBlockDevice(50)
except MemoryError:
    print("SKIP")
    raise SystemExit

test(bdev, uos.VfsFat)
test(bdev, uos.VfsLfs2)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test for behaviour of combined standard and extended block device

try:
    import uos

    uos.VfsFat
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")

            

Reported by Pylint.

Missing class docstring
Error

Line: 13 Column: 1

                  raise SystemExit


class RAMBlockDevice:
    ERASE_BLOCK_SIZE = 512

    def __init__(self, blocks):
        self.data = bytearray(blocks * self.ERASE_BLOCK_SIZE)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 5

                  def __init__(self, blocks):
        self.data = bytearray(blocks * self.ERASE_BLOCK_SIZE)

    def readblocks(self, block, buf, off=0):
        addr = block * self.ERASE_BLOCK_SIZE + off
        for i in range(len(buf)):
            buf[i] = self.data[addr + i]

    def writeblocks(self, block, buf, off=None):

            

Reported by Pylint.

tests/thread/mutate_bytearray.py
18 issues
Undefined variable 'n_finished'
Error

Line: 24 Column: 9

              
    with lock:
        global n_finished
        n_finished += 1


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

            

Reported by Pylint.

Unused variable 'repeat'
Error

Line: 12 Column: 9

              
# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1


            

Reported by Pylint.

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

Line: 13 Column: 13

              # main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1

            l = len(ba)

            

Reported by Pylint.

Using the global statement
Error

Line: 23 Column: 9

                          assert len(ba) >= l + 1

    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 bytearray object
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

import _thread

# the shared bytearray
ba = bytearray()


            

Reported by Pylint.

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

Line: 11 Column: 1

              ba = bytearray()

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1

            

Reported by Pylint.

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

Line: 11 Column: 1

              ba = bytearray()

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1

            

Reported by Pylint.

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

Line: 11 Column: 1

              ba = bytearray()

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 1

              ba = bytearray()

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1

            

Reported by Pylint.

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

Line: 11 Column: 1

              ba = bytearray()

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1

            

Reported by Pylint.

tests/extmod/uasyncio_exception.py
18 issues
function already defined line 13
Error

Line: 31 Column: 1

                  print("task done")


async def main():
    print("main start")
    t = asyncio.create_task(task())
    await t
    print("main done")


            

Reported by Pylint.

function already defined line 25
Error

Line: 45 Column: 1

              
# main task raising an exception with sub-task not yet scheduled
# TODO not currently working, task is never scheduled
async def task():
    # print('task run') uncomment this line when it works
    pass


async def main():

            

Reported by Pylint.

function already defined line 13
Error

Line: 50 Column: 1

                  pass


async def main():
    print("main start")
    asyncio.create_task(task())
    raise ValueError(3)
    print("main done")


            

Reported by Pylint.

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

Line: 10 Column: 9

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

# main task raising an exception
async def main():
    print("main start")
    raise ValueError(1)

            

Reported by Pylint.

Unreachable code
Error

Line: 16 Column: 5

              async def main():
    print("main start")
    raise ValueError(1)
    print("main done")


try:
    asyncio.run(main())
except ValueError as er:

            

Reported by Pylint.

Unreachable code
Error

Line: 28 Column: 5

              async def task():
    print("task start")
    raise ValueError(2)
    print("task done")


async def main():
    print("main start")
    t = asyncio.create_task(task())

            

Reported by Pylint.

TODO not currently working, task is never scheduled
Error

Line: 44 Column: 3

                  print("ValueError", er.args[0])

# main task raising an exception with sub-task not yet scheduled
# TODO not currently working, task is never scheduled
async def task():
    # print('task run') uncomment this line when it works
    pass



            

Reported by Pylint.

Unreachable code
Error

Line: 54 Column: 5

                  print("main start")
    asyncio.create_task(task())
    raise ValueError(3)
    print("main done")


try:
    asyncio.run(main())
except ValueError as er:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test general exception handling

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

# main task raising an exception
async def main():
    print("main start")
    raise ValueError(1)
    print("main done")



            

Reported by Pylint.

tests/wipy/rtc.py
18 issues
Unable to import 'machine'
Error

Line: 5 Column: 1

              RTC test for the CC3200 based boards.
"""

from machine import RTC
import os
import time

mch = os.uname().machine
if not "LaunchPad" in mch and not "WiPy" in mch:

            

Reported by Pylint.

Module 'os' has no 'uname' member
Error

Line: 9 Column: 7

              import os
import time

mch = os.uname().machine
if not "LaunchPad" in mch and not "WiPy" in mch:
    raise Exception("Board not supported!")

rtc = RTC()
print(rtc)

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 26 Column: 1

              rtc.init((2015, 8, 29, 9, 0, 0, 0, None))
print(rtc.now()[:6])
seconds = rtc.now()[5]
time.sleep_ms(1000)
print(rtc.now()[5] - seconds == 1)
seconds = rtc.now()[5]
time.sleep_ms(2000)
print(rtc.now()[5] - seconds == 2)


            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 29 Column: 1

              time.sleep_ms(1000)
print(rtc.now()[5] - seconds == 1)
seconds = rtc.now()[5]
time.sleep_ms(2000)
print(rtc.now()[5] - seconds == 2)

# initialization with shorter tuples
rtc.init((2015, 9, 19, 8, 0, 0, 0))
print(rtc.now()[5])

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 69 Column: 1

              rtc.init((2015, 8, 29, 9, 0, 0, 0, None))
rtc.alarm(0, 5000)
rtc.alarm(time=2000)
time.sleep_ms(1000)
left = rtc.alarm_left()
print(abs(left - 1000) <= 10)
time.sleep_ms(1000)
print(rtc.alarm_left() == 0)
time.sleep_ms(100)

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 72 Column: 1

              time.sleep_ms(1000)
left = rtc.alarm_left()
print(abs(left - 1000) <= 10)
time.sleep_ms(1000)
print(rtc.alarm_left() == 0)
time.sleep_ms(100)
print(rtc.alarm_left(0) == 0)

rtc.alarm(time=1000, repeat=True)

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 74 Column: 1

              print(abs(left - 1000) <= 10)
time.sleep_ms(1000)
print(rtc.alarm_left() == 0)
time.sleep_ms(100)
print(rtc.alarm_left(0) == 0)

rtc.alarm(time=1000, repeat=True)
time.sleep_ms(1500)
left = rtc.alarm_left()

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 78 Column: 1

              print(rtc.alarm_left(0) == 0)

rtc.alarm(time=1000, repeat=True)
time.sleep_ms(1500)
left = rtc.alarm_left()
print(abs(left - 500) <= 15)

rtc.init((2015, 8, 29, 9, 0, 0, 0, None))
rtc.alarm(time=(2015, 8, 29, 9, 0, 45))

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 84 Column: 1

              
rtc.init((2015, 8, 29, 9, 0, 0, 0, None))
rtc.alarm(time=(2015, 8, 29, 9, 0, 45))
time.sleep_ms(1000)
left = rtc.alarm_left()
print(abs(left - 44000) <= 90)
rtc.alarm_cancel()
rtc.deinit()


            

Reported by Pylint.

No exception type(s) specified
Error

Line: 93 Column: 1

              # next ones must raise
try:
    rtc.alarm(5000)
except:
    print("Exception")

try:
    rtc.alarm_left(1)
except:

            

Reported by Pylint.

py/makeversionhdr.py
18 issues
Statement seems to have no effect
Error

Line: 18 Column: 9

              def get_version_info_from_git():
    # Python 2.6 doesn't have check_output, so check for that
    try:
        subprocess.check_output
        subprocess.check_call
    except AttributeError:
        return None

    # Note: git describe doesn't work if no tag is available

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 19 Column: 9

                  # Python 2.6 doesn't have check_output, so check for that
    try:
        subprocess.check_output
        subprocess.check_call
    except AttributeError:
        return None

    # Note: git describe doesn't work if no tag is available
    try:

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

Line: 12
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              import sys
import os
import datetime
import subprocess


def get_version_info_from_git():
    # Python 2.6 doesn't have check_output, so check for that
    try:

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 15 Column: 1

              import subprocess


def get_version_info_from_git():
    # Python 2.6 doesn't have check_output, so check for that
    try:
        subprocess.check_output
        subprocess.check_call
    except AttributeError:

            

Reported by Pylint.

Starting a process with a partial executable path
Security injection

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

              
    # Note: git describe doesn't work if no tag is available
    try:
        git_tag = subprocess.check_output(
            ["git", "describe", "--tags", "--dirty", "--always", "--match", "v[1-9].*"],
            stderr=subprocess.STDOUT,
            universal_newlines=True,
        ).strip()
    except subprocess.CalledProcessError as er:

            

Reported by Bandit.

subprocess call - check for execution of untrusted input.
Security injection

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

              
    # Note: git describe doesn't work if no tag is available
    try:
        git_tag = subprocess.check_output(
            ["git", "describe", "--tags", "--dirty", "--always", "--match", "v[1-9].*"],
            stderr=subprocess.STDOUT,
            universal_newlines=True,
        ).strip()
    except subprocess.CalledProcessError as er:

            

Reported by Bandit.

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

Line: 30 Column: 5

                          stderr=subprocess.STDOUT,
            universal_newlines=True,
        ).strip()
    except subprocess.CalledProcessError as er:
        if er.returncode == 128:
            # git exit code of 128 means no repository found
            return None
        git_tag = ""
    except OSError:

            

Reported by Pylint.

Starting a process with a partial executable path
Security injection

Line: 38
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html

                  except OSError:
        return None
    try:
        git_hash = subprocess.check_output(
            ["git", "rev-parse", "--short", "HEAD"],
            stderr=subprocess.STDOUT,
            universal_newlines=True,
        ).strip()
    except subprocess.CalledProcessError:

            

Reported by Bandit.

subprocess call - check for execution of untrusted input.
Security injection

Line: 38
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html

                  except OSError:
        return None
    try:
        git_hash = subprocess.check_output(
            ["git", "rev-parse", "--short", "HEAD"],
            stderr=subprocess.STDOUT,
            universal_newlines=True,
        ).strip()
    except subprocess.CalledProcessError:

            

Reported by Bandit.

Starting a process with a partial executable path
Security injection

Line: 50
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html

              
    try:
        # Check if there are any modified files.
        subprocess.check_call(
            ["git", "diff", "--no-ext-diff", "--quiet", "--exit-code"], stderr=subprocess.STDOUT
        )
        # Check if there are any staged files.
        subprocess.check_call(
            ["git", "diff-index", "--cached", "--quiet", "HEAD", "--"], stderr=subprocess.STDOUT

            

Reported by Bandit.

tests/float/float1.py
18 issues
bad operand type for unary ~: float
Error

Line: 98 Column: 5

              # unsupported unary ops

try:
    ~1.2
except TypeError:
    print("TypeError")

try:
    1.2 in 3.4

            

Reported by Pylint.

Value '3.4' doesn't support membership test
Error

Line: 103 Column: 12

                  print("TypeError")

try:
    1.2 in 3.4
except TypeError:
    print("TypeError")

# small int on LHS, float on RHS, unsupported op
try:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test basic float capabilities

# literals
print(0.12)
print(1.0)
print(1.2)
print(0e0)
print(0e0)
print(0e-0)

            

Reported by Pylint.

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

Line: 50 Column: 1

              print(-(1.2))

# division of integers
x = 1 / 2
print(x)

# /= operator
a = 1
a /= 2

            

Reported by Pylint.

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

Line: 54 Column: 1

              print(x)

# /= operator
a = 1
a /= 2
print(a)

# floor division
print(1.0 // 2)

            

Reported by Pylint.

Comparison should be -3.4 >= 1.2
Error

Line: 64 Column: 7

              
# comparison
print(1.2 <= 3.4)
print(1.2 <= -3.4)
print(1.2 >= 3.4)
print(1.2 >= -3.4)
print(0.0 == False, 1.0 == True)
print(False == 0.0, True == 1.0)


            

Reported by Pylint.

Comparison should be -3.4 <= 1.2
Error

Line: 66 Column: 7

              print(1.2 <= 3.4)
print(1.2 <= -3.4)
print(1.2 >= 3.4)
print(1.2 >= -3.4)
print(0.0 == False, 1.0 == True)
print(False == 0.0, True == 1.0)

# comparison of nan is special
nan = float("nan")

            

Reported by Pylint.

Redundant comparison - 0.0 == False
Error

Line: 67 Column: 7

              print(1.2 <= -3.4)
print(1.2 >= 3.4)
print(1.2 >= -3.4)
print(0.0 == False, 1.0 == True)
print(False == 0.0, True == 1.0)

# comparison of nan is special
nan = float("nan")
print(nan == 1.2)

            

Reported by Pylint.

Comparison '1.0 == True' should be '1.0 is True' if checking for the singleton value True, or 'bool(1.0)' if testing for truthiness
Error

Line: 67 Column: 21

              print(1.2 <= -3.4)
print(1.2 >= 3.4)
print(1.2 >= -3.4)
print(0.0 == False, 1.0 == True)
print(False == 0.0, True == 1.0)

# comparison of nan is special
nan = float("nan")
print(nan == 1.2)

            

Reported by Pylint.

Redundant comparison - 1.0 == True
Error

Line: 67 Column: 21

              print(1.2 <= -3.4)
print(1.2 >= 3.4)
print(1.2 >= -3.4)
print(0.0 == False, 1.0 == True)
print(False == 0.0, True == 1.0)

# comparison of nan is special
nan = float("nan")
print(nan == 1.2)

            

Reported by Pylint.

tests/basics/class_bases.py
18 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test for type.__bases__ implementation

if not hasattr(object, '__bases__'):
    print("SKIP")
    raise SystemExit

class A:
    pass


            

Reported by Pylint.

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

Line: 7 Column: 1

                  print("SKIP")
    raise SystemExit

class A:
    pass

class B(object):
    pass


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 7 Column: 1

                  print("SKIP")
    raise SystemExit

class A:
    pass

class B(object):
    pass


            

Reported by Pylint.

Missing class docstring
Error

Line: 7 Column: 1

                  print("SKIP")
    raise SystemExit

class A:
    pass

class B(object):
    pass


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 10 Column: 1

              class A:
    pass

class B(object):
    pass

class C(B):
    pass


            

Reported by Pylint.

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

Line: 10 Column: 1

              class A:
    pass

class B(object):
    pass

class C(B):
    pass


            

Reported by Pylint.

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

Line: 10 Column: 1

              class A:
    pass

class B(object):
    pass

class C(B):
    pass


            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

              class A:
    pass

class B(object):
    pass

class C(B):
    pass


            

Reported by Pylint.

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

Line: 13 Column: 1

              class B(object):
    pass

class C(B):
    pass

class D(C, A):
    pass


            

Reported by Pylint.

Missing class docstring
Error

Line: 13 Column: 1

              class B(object):
    pass

class C(B):
    pass

class D(C, A):
    pass


            

Reported by Pylint.

tests/multi_net/uasyncio_tcp_client_rst.py
18 issues
Undefined variable 'multitest'
Error

Line: 35 Column: 5

                  global ev
    ev = asyncio.Event()
    server = await asyncio.start_server(handle_connection, "0.0.0.0", PORT)
    multitest.next()
    async with server:
        await asyncio.wait_for(ev.wait(), 10)


def instance0():

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 41 Column: 26

              

def instance0():
    multitest.globals(IP=multitest.get_network_ip())
    asyncio.run(main())


def instance1():
    if not hasattr(socket, "SO_LINGER"):

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 41 Column: 5

              

def instance0():
    multitest.globals(IP=multitest.get_network_ip())
    asyncio.run(main())


def instance1():
    if not hasattr(socket, "SO_LINGER"):

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 47 Column: 9

              
def instance1():
    if not hasattr(socket, "SO_LINGER"):
        multitest.skip()
    multitest.next()
    s = socket.socket()
    s.connect(socket.getaddrinfo(IP, PORT)[0][-1])
    lgr_onoff = 1
    lgr_linger = 0

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 48 Column: 5

              def instance1():
    if not hasattr(socket, "SO_LINGER"):
        multitest.skip()
    multitest.next()
    s = socket.socket()
    s.connect(socket.getaddrinfo(IP, PORT)[0][-1])
    lgr_onoff = 1
    lgr_linger = 0
    s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", lgr_onoff, lgr_linger))

            

Reported by Pylint.

Undefined variable 'IP'
Error

Line: 50 Column: 34

                      multitest.skip()
    multitest.next()
    s = socket.socket()
    s.connect(socket.getaddrinfo(IP, PORT)[0][-1])
    lgr_onoff = 1
    lgr_linger = 0
    s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", lgr_onoff, lgr_linger))
    s.send(b"GET / HTTP/1.0\r\n\r\n")
    time.sleep(0.1)

            

Reported by Pylint.

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

Line: 10 Column: 9

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

import struct, time, socket

PORT = 8000


            

Reported by Pylint.

Global variable 'ev' undefined at the module level
Error

Line: 32 Column: 5

              

async def main():
    global ev
    ev = asyncio.Event()
    server = await asyncio.start_server(handle_connection, "0.0.0.0", PORT)
    multitest.next()
    async with server:
        await asyncio.wait_for(ev.wait(), 10)

            

Reported by Pylint.

Possible binding to all interfaces.
Security

Line: 34
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b104_hardcoded_bind_all_interfaces.html

              async def main():
    global ev
    ev = asyncio.Event()
    server = await asyncio.start_server(handle_connection, "0.0.0.0", PORT)
    multitest.next()
    async with server:
        await asyncio.wait_for(ev.wait(), 10)



            

Reported by Bandit.

Missing module docstring
Error

Line: 1 Column: 1

              # Test TCP server with client issuing TCP RST part way through read

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

            

Reported by Pylint.

tests/extmod/vfs_lfs_error.py
18 issues
Statement seems to have no effect
Error

Line: 6 Column: 5

              try:
    import uos

    uos.VfsLfs1
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 7 Column: 5

                  import uos

    uos.VfsLfs1
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit



            

Reported by Pylint.

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

Line: 10 Column: 5

                  uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


class RAMBlockDevice:
    ERASE_BLOCK_SIZE = 1024


            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 29 Column: 25

                      for i in range(len(buf)):
            self.data[addr + i] = buf[i]

    def ioctl(self, op, arg):
        if op == 4:  # block count
            return len(self.data) // self.ERASE_BLOCK_SIZE
        if op == 5:  # block size
            return self.ERASE_BLOCK_SIZE
        if op == 6:  # erase block

            

Reported by Pylint.

Redefining name 'bdev' from outer scope (line 119)
Error

Line: 38 Column: 10

                          return 0


def test(bdev, vfs_class):
    print("test", vfs_class)

    # mkfs with too-small block device
    try:
        vfs_class.mkfs(RAMBlockDevice(1))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test for VfsLittle using a RAM device, testing error handling

try:
    import uos

    uos.VfsLfs1
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")

            

Reported by Pylint.

Missing class docstring
Error

Line: 13 Column: 1

                  raise SystemExit


class RAMBlockDevice:
    ERASE_BLOCK_SIZE = 1024

    def __init__(self, blocks):
        self.data = bytearray(blocks * self.ERASE_BLOCK_SIZE)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 5

                  def __init__(self, blocks):
        self.data = bytearray(blocks * self.ERASE_BLOCK_SIZE)

    def readblocks(self, block, buf, off):
        addr = block * self.ERASE_BLOCK_SIZE + off
        for i in range(len(buf)):
            buf[i] = self.data[addr + i]

    def writeblocks(self, block, buf, off):

            

Reported by Pylint.

Consider using enumerate instead of iterating with range and len
Error

Line: 21 Column: 9

              
    def readblocks(self, block, buf, off):
        addr = block * self.ERASE_BLOCK_SIZE + off
        for i in range(len(buf)):
            buf[i] = self.data[addr + i]

    def writeblocks(self, block, buf, off):
        addr = block * self.ERASE_BLOCK_SIZE + off
        for i in range(len(buf)):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 5

                      for i in range(len(buf)):
            buf[i] = self.data[addr + i]

    def writeblocks(self, block, buf, off):
        addr = block * self.ERASE_BLOCK_SIZE + off
        for i in range(len(buf)):
            self.data[addr + i] = buf[i]

    def ioctl(self, op, arg):

            

Reported by Pylint.