The following issues were found

tests/basics/special_methods.py
20 issues
The special method '__index__' expects 0 param(s), 1 was given
Error

Line: 40 Column: 5

                  def __floordiv__(self, other):
        print("__floordiv__ called")

    def __index__(self, other):
        print("__index__ called")

    def __inv__(self):
        print("__inv__ called")


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 103 Column: 1

              cud2 = Cud()

str(cud1)
cud1 == cud1
cud1 == cud2
cud1 != cud1
cud1 != cud2
cud1 < cud2
cud1 <= cud2

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 104 Column: 1

              
str(cud1)
cud1 == cud1
cud1 == cud2
cud1 != cud1
cud1 != cud2
cud1 < cud2
cud1 <= cud2
cud1 == cud2

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 105 Column: 1

              str(cud1)
cud1 == cud1
cud1 == cud2
cud1 != cud1
cud1 != cud2
cud1 < cud2
cud1 <= cud2
cud1 == cud2
cud1 >= cud2

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 106 Column: 1

              cud1 == cud1
cud1 == cud2
cud1 != cud1
cud1 != cud2
cud1 < cud2
cud1 <= cud2
cud1 == cud2
cud1 >= cud2
cud1 > cud2

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 107 Column: 1

              cud1 == cud2
cud1 != cud1
cud1 != cud2
cud1 < cud2
cud1 <= cud2
cud1 == cud2
cud1 >= cud2
cud1 > cud2
cud1 + cud2

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 108 Column: 1

              cud1 != cud1
cud1 != cud2
cud1 < cud2
cud1 <= cud2
cud1 == cud2
cud1 >= cud2
cud1 > cud2
cud1 + cud2
cud1 - cud2

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 109 Column: 1

              cud1 != cud2
cud1 < cud2
cud1 <= cud2
cud1 == cud2
cud1 >= cud2
cud1 > cud2
cud1 + cud2
cud1 - cud2
print(int(cud1))

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 110 Column: 1

              cud1 < cud2
cud1 <= cud2
cud1 == cud2
cud1 >= cud2
cud1 > cud2
cud1 + cud2
cud1 - cud2
print(int(cud1))


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 111 Column: 1

              cud1 <= cud2
cud1 == cud2
cud1 >= cud2
cud1 > cud2
cud1 + cud2
cud1 - cud2
print(int(cud1))

class BadInt:

            

Reported by Pylint.

tests/basics/scope_implicit.py
20 issues
function already defined line 4
Error

Line: 12 Column: 1

              print(f()())

# implicit nonlocal at inner level, with variable defined after closure
def f():
    def g():
        def h():
            return x # implicit nonlocal
        return h
    x = 4 # variable defined after function that closes over it

            

Reported by Pylint.

function already defined line 4
Error

Line: 22 Column: 1

              print(f()()())

# local variable which should not be implicitly made nonlocal
def f():
    x = 0
    def g():
        x # local because next statement assigns to it
        x = 1
    g()

            

Reported by Pylint.

Using variable 'x' before assignment
Error

Line: 25 Column: 9

              def f():
    x = 0
    def g():
        x # local because next statement assigns to it
        x = 1
    g()
try:
    f()
except NameError:

            

Reported by Pylint.

Unused variable 'x'
Error

Line: 23 Column: 5

              
# local variable which should not be implicitly made nonlocal
def f():
    x = 0
    def g():
        x # local because next statement assigns to it
        x = 1
    g()
try:

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 25 Column: 9

              def f():
    x = 0
    def g():
        x # local because next statement assigns to it
        x = 1
    g()
try:
    f()
except NameError:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test implicit scoping rules

# implicit nonlocal, with variable defined after closure
def f():
    def g():
        return x # implicit nonlocal
    x = 3 # variable defined after function that closes over it
    return g
print(f()())

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 4 Column: 1

              # test implicit scoping rules

# implicit nonlocal, with variable defined after closure
def f():
    def g():
        return x # implicit nonlocal
    x = 3 # variable defined after function that closes over it
    return g
print(f()())

            

Reported by Pylint.

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

Line: 4 Column: 1

              # test implicit scoping rules

# implicit nonlocal, with variable defined after closure
def f():
    def g():
        return x # implicit nonlocal
    x = 3 # variable defined after function that closes over it
    return g
print(f()())

            

Reported by Pylint.

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

Line: 5 Column: 5

              
# implicit nonlocal, with variable defined after closure
def f():
    def g():
        return x # implicit nonlocal
    x = 3 # variable defined after function that closes over it
    return g
print(f()())


            

Reported by Pylint.

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

Line: 7 Column: 5

              def f():
    def g():
        return x # implicit nonlocal
    x = 3 # variable defined after function that closes over it
    return g
print(f()())

# implicit nonlocal at inner level, with variable defined after closure
def f():

            

Reported by Pylint.

tests/basics/try_finally_return.py
20 issues
function already defined line 26
Error

Line: 35 Column: 1

              print(f())

# multiple for loops within try-finally
def f():
    try:
        for i in [1, 2]:
            for j in [3, 4]:
                return (i, j)
    finally:

            

Reported by Pylint.

function already defined line 26
Error

Line: 45 Column: 1

              print(f())

# multiple for loops and nested try-finally's
def f():
    try:
        for i in [1, 2]:
            for j in [3, 4]:
                try:
                    for k in [5, 6]:

            

Reported by Pylint.

function already defined line 26
Error

Line: 60 Column: 1

              print(f())

# multiple for loops that are optimised, and nested try-finally's
def f():
    try:
        for i in range(1, 3):
            for j in range(3, 5):
                try:
                    for k in range(5, 7):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def func1():
    try:
        return "it worked"
    finally:
        print("finally 1")

print(func1())



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 1 Column: 1

              def func1():
    try:
        return "it worked"
    finally:
        print("finally 1")

print(func1())



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 10 Column: 1

              print(func1())


def func2():
    try:
        return "it worked"
    finally:
        print("finally 2")


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 1

                  finally:
        print("finally 2")

def func3():
    try:
        s = func2()
        return s + ", did this work?"
    finally:
        print("finally 3")

            

Reported by Pylint.

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

Line: 18 Column: 9

              
def func3():
    try:
        s = func2()
        return s + ", did this work?"
    finally:
        print("finally 3")

print(func3())

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 26 Column: 1

              print(func3())

# for loop within try-finally
def f():
    try:
        for i in [1, 2]:
            return i
    finally:
        print('finally')

            

Reported by Pylint.

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

Line: 26 Column: 1

              print(func3())

# for loop within try-finally
def f():
    try:
        for i in [1, 2]:
            return i
    finally:
        print('finally')

            

Reported by Pylint.

tests/basics/boundmeth1.py
20 issues
Missing module docstring
Error

Line: 1 Column: 1

              # tests basics of bound methods

# uPy and CPython differ when printing a bound method, so just print the type
print(type(repr([].append)))

class A:
    def f(self):
        return 0
    def g(self, a):

            

Reported by Pylint.

Missing class docstring
Error

Line: 6 Column: 1

              # uPy and CPython differ when printing a bound method, so just print the type
print(type(repr([].append)))

class A:
    def f(self):
        return 0
    def g(self, a):
        return a
    def h(self, a, b, c, d, e, f):

            

Reported by Pylint.

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

Line: 6 Column: 1

              # uPy and CPython differ when printing a bound method, so just print the type
print(type(repr([].append)))

class A:
    def f(self):
        return 0
    def g(self, a):
        return a
    def h(self, a, b, c, d, e, f):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 5

              print(type(repr([].append)))

class A:
    def f(self):
        return 0
    def g(self, a):
        return a
    def h(self, a, b, c, d, e, f):
        return a + b + c + d + e + f

            

Reported by Pylint.

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

Line: 7 Column: 5

              print(type(repr([].append)))

class A:
    def f(self):
        return 0
    def g(self, a):
        return a
    def h(self, a, b, c, d, e, f):
        return a + b + c + d + e + f

            

Reported by Pylint.

Method could be a function
Error

Line: 7 Column: 5

              print(type(repr([].append)))

class A:
    def f(self):
        return 0
    def g(self, a):
        return a
    def h(self, a, b, c, d, e, f):
        return a + b + c + d + e + f

            

Reported by Pylint.

Method could be a function
Error

Line: 9 Column: 5

              class A:
    def f(self):
        return 0
    def g(self, a):
        return a
    def h(self, a, b, c, d, e, f):
        return a + b + c + d + e + f

# bound method with no extra args

            

Reported by Pylint.

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

Line: 9 Column: 5

              class A:
    def f(self):
        return 0
    def g(self, a):
        return a
    def h(self, a, b, c, d, e, f):
        return a + b + c + d + e + f

# bound method with no extra args

            

Reported by Pylint.

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

Line: 9 Column: 5

              class A:
    def f(self):
        return 0
    def g(self, a):
        return a
    def h(self, a, b, c, d, e, f):
        return a + b + c + d + e + f

# bound method with no extra args

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 9 Column: 5

              class A:
    def f(self):
        return 0
    def g(self, a):
        return a
    def h(self, a, b, c, d, e, f):
        return a + b + c + d + e + f

# bound method with no extra args

            

Reported by Pylint.

tests/basics/unary_op.py
20 issues
Using a conditional statement with a constant value
Error

Line: 34 Column: 7

              class D(type): pass
d = D("foo", (), {})
print(not d)
print(True if d else False)

            

Reported by Pylint.

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

Line: 1 Column: 1

              x = 1
print(+x)
print(-x)
print(~x)

print(not None)
print(not False)
print(not True)
print(not 0)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              x = 1
print(+x)
print(-x)
print(~x)

print(not None)
print(not False)
print(not True)
print(not 0)

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 20 Column: 1

              print(not {1:1})

# check user instance
class A: pass
print(not A())

# check user instances derived from builtins
class B(int): pass
print(not B())

            

Reported by Pylint.

Missing class docstring
Error

Line: 20 Column: 1

              print(not {1:1})

# check user instance
class A: pass
print(not A())

# check user instances derived from builtins
class B(int): pass
print(not B())

            

Reported by Pylint.

More than one statement on a single line
Error

Line: 20 Column: 10

              print(not {1:1})

# check user instance
class A: pass
print(not A())

# check user instances derived from builtins
class B(int): pass
print(not B())

            

Reported by Pylint.

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

Line: 20 Column: 1

              print(not {1:1})

# check user instance
class A: pass
print(not A())

# check user instances derived from builtins
class B(int): pass
print(not B())

            

Reported by Pylint.

Missing class docstring
Error

Line: 24 Column: 1

              print(not A())

# check user instances derived from builtins
class B(int): pass
print(not B())
print(True if B() else False)
class C(list): pass
print(not C())
print(True if C() else False)

            

Reported by Pylint.

More than one statement on a single line
Error

Line: 24 Column: 15

              print(not A())

# check user instances derived from builtins
class B(int): pass
print(not B())
print(True if B() else False)
class C(list): pass
print(not C())
print(True if C() else False)

            

Reported by Pylint.

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

Line: 24 Column: 1

              print(not A())

# check user instances derived from builtins
class B(int): pass
print(not B())
print(True if B() else False)
class C(list): pass
print(not C())
print(True if C() else False)

            

Reported by Pylint.

tests/micropython/viper_binop_divmod.py
19 issues
Undefined variable 'micropython'
Error

Line: 4 Column: 2

              # test floor-division and modulo operators


@micropython.viper
def div(x: int, y: int) -> int:
    return x // y


@micropython.viper

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 9 Column: 2

                  return x // y


@micropython.viper
def mod(x: int, y: int) -> int:
    return x % y


def dm(x, y):

            

Reported by Pylint.

Redefining name 'y' from outer scope (line 19)
Error

Line: 5 Column: 17

              

@micropython.viper
def div(x: int, y: int) -> int:
    return x // y


@micropython.viper
def mod(x: int, y: int) -> int:

            

Reported by Pylint.

Redefining name 'x' from outer scope (line 18)
Error

Line: 5 Column: 9

              

@micropython.viper
def div(x: int, y: int) -> int:
    return x // y


@micropython.viper
def mod(x: int, y: int) -> int:

            

Reported by Pylint.

Redefining name 'y' from outer scope (line 19)
Error

Line: 10 Column: 17

              

@micropython.viper
def mod(x: int, y: int) -> int:
    return x % y


def dm(x, y):
    print(div(x, y), mod(x, y))

            

Reported by Pylint.

Redefining name 'x' from outer scope (line 18)
Error

Line: 10 Column: 9

              

@micropython.viper
def mod(x: int, y: int) -> int:
    return x % y


def dm(x, y):
    print(div(x, y), mod(x, y))

            

Reported by Pylint.

Redefining name 'x' from outer scope (line 18)
Error

Line: 14 Column: 8

                  return x % y


def dm(x, y):
    print(div(x, y), mod(x, y))


for x in (-6, 6):
    for y in range(-7, 8):

            

Reported by Pylint.

Redefining name 'y' from outer scope (line 19)
Error

Line: 14 Column: 11

                  return x % y


def dm(x, y):
    print(div(x, y), mod(x, y))


for x in (-6, 6):
    for y in range(-7, 8):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test floor-division and modulo operators


@micropython.viper
def div(x: int, y: int) -> int:
    return x // y


@micropython.viper

            

Reported by Pylint.

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

Line: 5 Column: 1

              

@micropython.viper
def div(x: int, y: int) -> int:
    return x // y


@micropython.viper
def mod(x: int, y: int) -> int:

            

Reported by Pylint.

tests/micropython/import_mpy_invalid.py
19 issues
Statement seems to have no effect
Error

Line: 6 Column: 5

              try:
    import usys, uio, uos

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


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 7 Column: 5

                  import usys, uio, uos

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



            

Reported by Pylint.

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

Line: 10 Column: 5

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


class UserFile(uio.IOBase):
    def __init__(self, data):
        self.data = memoryview(data)

            

Reported by Pylint.

Unused argument 'req'
Error

Line: 24 Column: 21

                      self.pos += n
        return n

    def ioctl(self, req, arg):
        return 0


class UserFS:
    def __init__(self, files):

            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 24 Column: 26

                      self.pos += n
        return n

    def ioctl(self, req, arg):
        return 0


class UserFS:
    def __init__(self, files):

            

Reported by Pylint.

Unused argument 'mode'
Error

Line: 43 Column: 26

                          return (32768, 0, 0, 0, 0, 0, 0, 0, 0, 0)
        raise OSError

    def open(self, path, mode):
        return UserFile(self.files[path])


# these are the test .mpy files
user_files = {

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test importing of invalid .mpy files

try:
    import usys, uio, uos

    uio.IOBase
    uos.mount
except (ImportError, AttributeError):
    print("SKIP")

            

Reported by Pylint.

Multiple imports on one line (usys, uio, uos)
Error

Line: 4 Column: 5

              # test importing of invalid .mpy files

try:
    import usys, uio, uos

    uio.IOBase
    uos.mount
except (ImportError, AttributeError):
    print("SKIP")

            

Reported by Pylint.

Missing class docstring
Error

Line: 13 Column: 1

                  raise SystemExit


class UserFile(uio.IOBase):
    def __init__(self, data):
        self.data = memoryview(data)
        self.pos = 0

    def readinto(self, buf):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 5

                      self.data = memoryview(data)
        self.pos = 0

    def readinto(self, buf):
        n = min(len(buf), len(self.data) - self.pos)
        buf[:n] = self.data[self.pos : self.pos + n]
        self.pos += n
        return n


            

Reported by Pylint.

tests/micropython/import_mpy_native_x64.py
19 issues
Statement seems to have no effect
Error

Line: 6 Column: 5

              try:
    import usys, uio, uos

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


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 7 Column: 5

                  import usys, uio, uos

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

if not (usys.platform == "linux" and usys.maxsize > 2 ** 32):

            

Reported by Pylint.

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

Line: 10 Column: 5

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

if not (usys.platform == "linux" and usys.maxsize > 2 ** 32):
    print("SKIP")
    raise SystemExit


            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 28 Column: 26

                      self.pos += n
        return n

    def ioctl(self, req, arg):
        return 0


class UserFS:
    def __init__(self, files):

            

Reported by Pylint.

Unused argument 'req'
Error

Line: 28 Column: 21

                      self.pos += n
        return n

    def ioctl(self, req, arg):
        return 0


class UserFS:
    def __init__(self, files):

            

Reported by Pylint.

Unused argument 'mode'
Error

Line: 47 Column: 26

                          return (32768, 0, 0, 0, 0, 0, 0, 0, 0, 0)
        raise OSError

    def open(self, path, mode):
        return UserFile(self.files[path])


# these are the test .mpy files
# fmt: off

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test importing of .mpy files with native code (x64 only)

try:
    import usys, uio, uos

    uio.IOBase
    uos.mount
except (ImportError, AttributeError):
    print("SKIP")

            

Reported by Pylint.

Multiple imports on one line (usys, uio, uos)
Error

Line: 4 Column: 5

              # test importing of .mpy files with native code (x64 only)

try:
    import usys, uio, uos

    uio.IOBase
    uos.mount
except (ImportError, AttributeError):
    print("SKIP")

            

Reported by Pylint.

Missing class docstring
Error

Line: 17 Column: 1

                  raise SystemExit


class UserFile(uio.IOBase):
    def __init__(self, data):
        self.data = memoryview(data)
        self.pos = 0

    def readinto(self, buf):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 22 Column: 5

                      self.data = memoryview(data)
        self.pos = 0

    def readinto(self, buf):
        n = min(len(buf), len(self.data) - self.pos)
        buf[:n] = self.data[self.pos : self.pos + n]
        self.pos += n
        return n


            

Reported by Pylint.

drivers/sdcard/sdtest.py
19 issues
Unable to import 'machine'
Error

Line: 3 Column: 1

              # Test for sdcard block protocol
# Peter hinch 30th Jan 2016
import os, sdcard, machine


def sdtest():
    spi = machine.SPI(1)
    spi.init()  # Ensure right baudrate
    sd = sdcard.SDCard(spi, machine.Pin.board.X21)  # Compatible with PCB

            

Reported by Pylint.

Module 'os' has no 'VfsFat' member
Error

Line: 10 Column: 11

                  spi = machine.SPI(1)
    spi.init()  # Ensure right baudrate
    sd = sdcard.SDCard(spi, machine.Pin.board.X21)  # Compatible with PCB
    vfs = os.VfsFat(sd)
    os.mount(vfs, "/fc")
    print("Filesystem check")
    print(os.listdir("/fc"))

    line = "abcdefghijklmnopqrstuvwxyz\n"

            

Reported by Pylint.

Module 'os' has no 'mount' member
Error

Line: 11 Column: 5

                  spi.init()  # Ensure right baudrate
    sd = sdcard.SDCard(spi, machine.Pin.board.X21)  # Compatible with PCB
    vfs = os.VfsFat(sd)
    os.mount(vfs, "/fc")
    print("Filesystem check")
    print(os.listdir("/fc"))

    line = "abcdefghijklmnopqrstuvwxyz\n"
    lines = line * 200  # 5400 chars

            

Reported by Pylint.

Module 'os' has no 'umount' member
Error

Line: 45 Column: 5

                      result2 = f.read()
        print(len(result2), "bytes read")

    os.umount("/fc")

    print()
    print("Verifying data read back")
    success = True
    if result1 == "".join((lines, short, lines)):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test for sdcard block protocol
# Peter hinch 30th Jan 2016
import os, sdcard, machine


def sdtest():
    spi = machine.SPI(1)
    spi.init()  # Ensure right baudrate
    sd = sdcard.SDCard(spi, machine.Pin.board.X21)  # Compatible with PCB

            

Reported by Pylint.

standard import "import os, sdcard, machine" should be placed before "import os, sdcard, machine"
Error

Line: 3 Column: 1

              # Test for sdcard block protocol
# Peter hinch 30th Jan 2016
import os, sdcard, machine


def sdtest():
    spi = machine.SPI(1)
    spi.init()  # Ensure right baudrate
    sd = sdcard.SDCard(spi, machine.Pin.board.X21)  # Compatible with PCB

            

Reported by Pylint.

Multiple imports on one line (os, sdcard, machine)
Error

Line: 3 Column: 1

              # Test for sdcard block protocol
# Peter hinch 30th Jan 2016
import os, sdcard, machine


def sdtest():
    spi = machine.SPI(1)
    spi.init()  # Ensure right baudrate
    sd = sdcard.SDCard(spi, machine.Pin.board.X21)  # Compatible with PCB

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 6 Column: 1

              import os, sdcard, machine


def sdtest():
    spi = machine.SPI(1)
    spi.init()  # Ensure right baudrate
    sd = sdcard.SDCard(spi, machine.Pin.board.X21)  # Compatible with PCB
    vfs = os.VfsFat(sd)
    os.mount(vfs, "/fc")

            

Reported by Pylint.

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

Line: 9 Column: 5

              def sdtest():
    spi = machine.SPI(1)
    spi.init()  # Ensure right baudrate
    sd = sdcard.SDCard(spi, machine.Pin.board.X21)  # Compatible with PCB
    vfs = os.VfsFat(sd)
    os.mount(vfs, "/fc")
    print("Filesystem check")
    print(os.listdir("/fc"))


            

Reported by Pylint.

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

Line: 19 Column: 5

                  lines = line * 200  # 5400 chars
    short = "1234567890\n"

    fn = "/fc/rats.txt"
    print()
    print("Multiple block read/write")
    with open(fn, "w") as f:
        n = f.write(lines)
        print(n, "bytes written")

            

Reported by Pylint.

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

Line: 15 Column: 26

              
# Server
def instance0():
    multitest.globals(IP=multitest.get_network_ip())
    s = socket.socket()
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    s.bind(socket.getaddrinfo("0.0.0.0", PORT)[0][-1])
    s.listen(1)
    multitest.next()

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 15 Column: 5

              
# Server
def instance0():
    multitest.globals(IP=multitest.get_network_ip())
    s = socket.socket()
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    s.bind(socket.getaddrinfo("0.0.0.0", PORT)[0][-1])
    s.listen(1)
    multitest.next()

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 20 Column: 5

                  s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    s.bind(socket.getaddrinfo("0.0.0.0", PORT)[0][-1])
    s.listen(1)
    multitest.next()
    s2, _ = s.accept()
    s2.setblocking(False)
    poll = select.poll()
    poll.register(s2, select.POLLIN)
    time.sleep(0.4)

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 47 Column: 9

              # Client
def instance1():
    if not hasattr(socket, "SO_LINGER"):
        multitest.skip()
    multitest.next()
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
    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(socket.AF_INET, socket.SOCK_STREAM, 0)
    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(socket.AF_INET, socket.SOCK_STREAM, 0)
    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.2)

            

Reported by Pylint.

Possible binding to all interfaces.
Security

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

                  multitest.globals(IP=multitest.get_network_ip())
    s = socket.socket()
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    s.bind(socket.getaddrinfo("0.0.0.0", PORT)[0][-1])
    s.listen(1)
    multitest.next()
    s2, _ = s.accept()
    s2.setblocking(False)
    poll = select.poll()

            

Reported by Bandit.

TODO: the following recv don't work with lwip, it abandons data upon TCP RST
Error

Line: 27 Column: 3

                  poll.register(s2, select.POLLIN)
    time.sleep(0.4)
    print(convert_poll_list(poll.poll(1000)))
    # TODO: the following recv don't work with lwip, it abandons data upon TCP RST
    try:
        print(s2.recv(10))
        print(convert_poll_list(poll.poll(1000)))
        print(s2.recv(10))
        print(convert_poll_list(poll.poll(1000)))

            

Reported by Pylint.

TODO lwip raises here but apparently it shouldn't
Error

Line: 38 Column: 3

                  except OSError as er:
        print(er.errno)
    print(convert_poll_list(poll.poll(1000)))
    # TODO lwip raises here but apparently it shouldn't
    print(s2.recv(10))
    print(convert_poll_list(poll.poll(1000)))
    s.close()



            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test when client does a TCP RST on an open connection

import struct, time, socket, select

PORT = 8000


def convert_poll_list(l):
    # To be compatible across all ports/targets

            

Reported by Pylint.