The following issues were found

tests/basics/fun_kwonly.py
38 issues
function already defined line 4
Error

Line: 10 Column: 1

              f(a=1)

# with 2 keyword-only args
def f(*, a, b):
    print(a, b)

f(a=1, b=2)
f(b=1, a=2)


            

Reported by Pylint.

function already defined line 4
Error

Line: 17 Column: 1

              f(b=1, a=2)

# positional followed by bare star
def f(a, *, b, c):
    print(a, b, c)

f(1, b=3, c=4)
f(1, c=3, b=4)
f(1, **{'b':'3', 'c':4})

            

Reported by Pylint.

Missing mandatory keyword argument 'b' in function call
Error

Line: 25 Column: 5

              f(1, **{'b':'3', 'c':4})

try:
    f(1)
except TypeError:
    print("TypeError")

try:
    f(1, b=2)

            

Reported by Pylint.

Missing mandatory keyword argument 'c' in function call
Error

Line: 25 Column: 5

              f(1, **{'b':'3', 'c':4})

try:
    f(1)
except TypeError:
    print("TypeError")

try:
    f(1, b=2)

            

Reported by Pylint.

Missing mandatory keyword argument 'c' in function call
Error

Line: 30 Column: 5

                  print("TypeError")

try:
    f(1, b=2)
except TypeError:
    print("TypeError")

try:
    f(1, c=2)

            

Reported by Pylint.

Missing mandatory keyword argument 'b' in function call
Error

Line: 35 Column: 5

                  print("TypeError")

try:
    f(1, c=2)
except TypeError:
    print("TypeError")

# with **kw
def f(a, *, b, **kw):

            

Reported by Pylint.

function already defined line 4
Error

Line: 40 Column: 1

                  print("TypeError")

# with **kw
def f(a, *, b, **kw):
    print(a, b, kw)

f(1, b=2)
f(1, b=2, c=3)


            

Reported by Pylint.

function already defined line 4
Error

Line: 47 Column: 1

              f(1, b=2, c=3)

# with named star
def f(*a, b, c):
    print(a, b, c)

f(b=1, c=2)
f(c=1, b=2)


            

Reported by Pylint.

function already defined line 4
Error

Line: 54 Column: 1

              f(c=1, b=2)

# with positional and named star
def f(a, *b, c):
    print(a, b, c)

f(1, c=2)
f(1, 2, c=3)
f(a=1, c=3)

            

Reported by Pylint.

function already defined line 4
Error

Line: 62 Column: 1

              f(a=1, c=3)

# lambda as kw-only arg (exposes nested behaviour in compiler)
def f(*, x=lambda:1):
    return x()
print(f())
print(f(x=f))
print(f(x=lambda:2))

            

Reported by Pylint.

tools/mpremote/mpremote/console.py
37 issues
Undefined variable 'WindowsError'
Error

Line: 170 Column: 12

                  try:
        set_conout_mode(mode, mask)
        VT_ENABLED = True
    except WindowsError as e:
        VT_ENABLED = False

            

Reported by Pylint.

TODO pyb_serial might not have fd
Error

Line: 35 Column: 3

                      termios.tcsetattr(self.infd, termios.TCSANOW, self.orig_attr)

    def waitchar(self, pyb_serial):
        # TODO pyb_serial might not have fd
        select.select([self.infd, pyb_serial.fd], [], [])

    def readchar(self):
        res = select.select([self.infd], [], [], 0)
        if res[0]:

            

Reported by Pylint.

Unused argument 'signo'
Error

Line: 81 Column: 31

                  def __init__(self):
        self.ctrl_c = 0

    def _sigint_handler(self, signo, frame):
        self.ctrl_c += 1

    def enter(self):
        signal.signal(signal.SIGINT, self._sigint_handler)


            

Reported by Pylint.

Unused argument 'frame'
Error

Line: 81 Column: 38

                  def __init__(self):
        self.ctrl_c = 0

    def _sigint_handler(self, signo, frame):
        self.ctrl_c += 1

    def enter(self):
        signal.signal(signal.SIGINT, self._sigint_handler)


            

Reported by Pylint.

Unused argument 'func'
Error

Line: 140 Column: 29

                  ERROR_INVALID_PARAMETER = 0x0057
    ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004

    def _check_bool(result, func, args):
        if not result:
            raise ctypes.WinError(ctypes.get_last_error())
        return args

    LPDWORD = ctypes.POINTER(wintypes.DWORD)

            

Reported by Pylint.

Redefining name 'mask' from outer scope (line 166)
Error

Line: 151 Column: 35

                  kernel32.SetConsoleMode.errcheck = _check_bool
    kernel32.SetConsoleMode.argtypes = (wintypes.HANDLE, wintypes.DWORD)

    def set_conout_mode(new_mode, mask=0xFFFFFFFF):
        # don't assume StandardOutput is a console.
        # open CONOUT$ instead
        fdout = os.open("CONOUT$", os.O_RDWR)
        try:
            hout = msvcrt.get_osfhandle(fdout)

            

Reported by Pylint.

Redefining name 'mode' from outer scope (line 166)
Error

Line: 159 Column: 13

                          hout = msvcrt.get_osfhandle(fdout)
            old_mode = wintypes.DWORD()
            kernel32.GetConsoleMode(hout, ctypes.byref(old_mode))
            mode = (new_mode & mask) | (old_mode.value & ~mask)
            kernel32.SetConsoleMode(hout, mode)
            return old_mode.value
        finally:
            os.close(fdout)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import sys, time

try:
    import select, termios
except ImportError:
    termios = None
    select = None
    import msvcrt, signal


            

Reported by Pylint.

Multiple imports on one line (sys, time)
Error

Line: 1 Column: 1

              import sys, time

try:
    import select, termios
except ImportError:
    termios = None
    select = None
    import msvcrt, signal


            

Reported by Pylint.

Multiple imports on one line (select, termios)
Error

Line: 4 Column: 5

              import sys, time

try:
    import select, termios
except ImportError:
    termios = None
    select = None
    import msvcrt, signal


            

Reported by Pylint.

tests/basics/try_finally_return2.py
37 issues
function already defined line 5
Error

Line: 15 Column: 1

              print(f())

# nested, return in outer
def f():
    try:
        try:
            raise ValueError
        finally:
            print('finally 1')

            

Reported by Pylint.

function already defined line 5
Error

Line: 29 Column: 1

              print(f())

# nested, return in inner
def f():
    try:
        try:
            raise ValueError
        finally:
            print('finally 1')

            

Reported by Pylint.

function already defined line 5
Error

Line: 43 Column: 1

              print(f())

# nested, return in inner and outer
def f():
    try:
        try:
            raise ValueError
        finally:
            print('finally 1')

            

Reported by Pylint.

function already defined line 5
Error

Line: 58 Column: 1

              print(f())

# nested with reraise
def f():
    try:
        try:
            raise ValueError
        except:
            raise

            

Reported by Pylint.

function already defined line 5
Error

Line: 72 Column: 1

              print(f())

# triple nesting with reraise
def f():
    try:
        try:
            try:
                raise ValueError
            except:

            

Reported by Pylint.

function already defined line 5
Error

Line: 87 Column: 1

              print(f())

# exception when matching exception
def f():
    try:
        raise ValueError
    except NonExistingError:
        pass
    finally:

            

Reported by Pylint.

Undefined variable 'NonExistingError'
Error

Line: 90 Column: 12

              def f():
    try:
        raise ValueError
    except NonExistingError:
        pass
    finally:
        print('finally')
        return 0
print(f())

            

Reported by Pylint.

function already defined line 5
Error

Line: 98 Column: 1

              print(f())

# raising exception class, not instance
def f():
    try:
        raise ValueError
    finally:
        print('finally')
        return 0

            

Reported by Pylint.

return statement in finally block may swallow exception
Error

Line: 10 Column: 9

                      raise ValueError()
    finally:
        print('finally')
        return 0
    print('got here')
print(f())

# nested, return in outer
def f():

            

Reported by Pylint.

return statement in finally block may swallow exception
Error

Line: 24 Column: 9

                      print('got here')
    finally:
        print('finally 2')
        return 2
    print('got here')
print(f())

# nested, return in inner
def f():

            

Reported by Pylint.

extmod/uasyncio/task.py
37 issues
Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

              # This file contains the core TaskQueue based on a pairing heap, and the core Task class.
# They can optionally be replaced by C implementations.

from . import core


# pairing-heap meld of 2 heaps; O(1)
def ph_meld(h1, h2):
    if h1 is None:

            

Reported by Pylint.

Redefining built-in 'next'
Error

Line: 69 Column: 9

                      return heap
    elif node is parent.ph_child:
        child = node.ph_child
        next = node.ph_next
        node.ph_child = None
        node.ph_next = None
        node = ph_pairing(child)
        parent.ph_child = node
    else:

            

Reported by Pylint.

Redefining built-in 'globals'
Error

Line: 123 Column: 30

              
# Task class representing a coroutine, can be waited on and cancelled.
class Task:
    def __init__(self, coro, globals=None):
        self.coro = coro  # Coroutine of this Task
        self.data = None  # General data for queue it is waiting on
        self.state = True  # None, False, True or a TaskQueue instance
        self.ph_key = 0  # Pairing heap
        self.ph_child = None  # Paring heap

            

Reported by Pylint.

Unused argument 'globals'
Error

Line: 123 Column: 30

              
# Task class representing a coroutine, can be waited on and cancelled.
class Task:
    def __init__(self, coro, globals=None):
        self.coro = coro  # Coroutine of this Task
        self.data = None  # General data for queue it is waiting on
        self.state = True  # None, False, True or a TaskQueue instance
        self.ph_key = 0  # Pairing heap
        self.ph_child = None  # Paring heap

            

Reported by Pylint.

Invalid assignment to self in method
Error

Line: 164 Column: 13

                          raise RuntimeError("can't cancel self")
        # If Task waits on another task then forward the cancel to the one it's waiting on.
        while isinstance(self.data, Task):
            self = self.data
        # Reschedule Task as a cancelled task.
        if hasattr(self.data, "remove"):
            # Not on the main running queue, remove the task from the queue it's on.
            self.data.remove(self)
            core._task_queue.push_head(self)

            

Reported by Pylint.

Access to a protected member _task_queue of a client class
Error

Line: 169 Column: 13

                      if hasattr(self.data, "remove"):
            # Not on the main running queue, remove the task from the queue it's on.
            self.data.remove(self)
            core._task_queue.push_head(self)
        elif core.ticks_diff(self.ph_key, core.ticks()) > 0:
            # On the main running queue but scheduled in the future, so bring it forward to now.
            core._task_queue.remove(self)
            core._task_queue.push_head(self)
        self.data = core.CancelledError

            

Reported by Pylint.

Access to a protected member _task_queue of a client class
Error

Line: 172 Column: 13

                          core._task_queue.push_head(self)
        elif core.ticks_diff(self.ph_key, core.ticks()) > 0:
            # On the main running queue but scheduled in the future, so bring it forward to now.
            core._task_queue.remove(self)
            core._task_queue.push_head(self)
        self.data = core.CancelledError
        return True

            

Reported by Pylint.

Access to a protected member _task_queue of a client class
Error

Line: 173 Column: 13

                      elif core.ticks_diff(self.ph_key, core.ticks()) > 0:
            # On the main running queue but scheduled in the future, so bring it forward to now.
            core._task_queue.remove(self)
            core._task_queue.push_head(self)
        self.data = core.CancelledError
        return True

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

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

# This file contains the core TaskQueue based on a pairing heap, and the core Task class.
# They can optionally be replaced by C implementations.

from . import core



            

Reported by Pylint.

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

Line: 11 Column: 1

              

# pairing-heap meld of 2 heaps; O(1)
def ph_meld(h1, h2):
    if h1 is None:
        return h2
    if h2 is None:
        return h1
    lt = core.ticks_diff(h1.ph_key, h2.ph_key) < 0

            

Reported by Pylint.

tests/misc/print_exception.py
37 issues
function already defined line 44
Error

Line: 82 Column: 1

              
# Here we have a function with lots of bytecode generated for a single source-line, and
# there is an error right at the end of the bytecode.  It should report the correct line.
def f():
    f([1, 2], [1, 2], [1, 2], {1: 1, 1: 1, 1: 1, 1: 1, 1: 1, 1: 1, 1: f.X})
    return 1


try:

            

Reported by Pylint.

Function 'f' has no 'X' member
Error

Line: 83 Column: 71

              # Here we have a function with lots of bytecode generated for a single source-line, and
# there is an error right at the end of the bytecode.  It should report the correct line.
def f():
    f([1, 2], [1, 2], [1, 2], {1: 1, 1: 1, 1: 1, 1: 1, 1: 1, 1: 1, 1: f.X})
    return 1


try:
    f()

            

Reported by Pylint.

Too many positional arguments for function call
Error

Line: 83 Column: 5

              # Here we have a function with lots of bytecode generated for a single source-line, and
# there is an error right at the end of the bytecode.  It should report the correct line.
def f():
    f([1, 2], [1, 2], [1, 2], {1: 1, 1: 1, 1: 1, 1: 1, 1: 1, 1: 1, 1: f.X})
    return 1


try:
    f()

            

Reported by Pylint.

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

Line: 10 Column: 5

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

if hasattr(sys, "print_exception"):
    print_exception = sys.print_exception
else:
    import traceback

            

Reported by Pylint.

Redefining name 'e' from outer scope (line 39)
Error

Line: 20 Column: 15

                  print_exception = lambda e, f: traceback.print_exception(None, e, sys.exc_info()[2], file=f)


def print_exc(e):
    buf = io.StringIO()
    print_exception(e, buf)
    s = buf.getvalue()
    for l in s.split("\n"):
        # uPy on pyboard prints <stdin> as file, so remove filename.

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 39 Column: 8

              # basic exception message
try:
    raise Exception("msg")
except Exception as e:
    print("caught")
    print_exc(e)

# exception message with more than 1 source-code line
def f():

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 54 Column: 8

              
try:
    f()
except Exception as e:
    print("caught")
    print_exc(e)

# Test that an exception propagated through a finally doesn't have a traceback added there
try:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 64 Column: 8

                      f()
    finally:
        print("finally")
except Exception as e:
    print("caught")
    print_exc(e)

# Test that re-raising an exception doesn't add traceback info
try:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 76 Column: 8

                      print("reraise")
        print_exc(e)
        raise
except Exception as e:
    print("caught")
    print_exc(e)

# Here we have a function with lots of bytecode generated for a single source-line, and
# there is an error right at the end of the bytecode.  It should report the correct line.

            

Reported by Pylint.

Duplicate key 1 in dictionary
Error

Line: 83 Column: 31

              # Here we have a function with lots of bytecode generated for a single source-line, and
# there is an error right at the end of the bytecode.  It should report the correct line.
def f():
    f([1, 2], [1, 2], [1, 2], {1: 1, 1: 1, 1: 1, 1: 1, 1: 1, 1: 1, 1: f.X})
    return 1


try:
    f()

            

Reported by Pylint.

tests/float/math_fun.py
36 issues
Unused import prod from wildcard import
Error

Line: 4 Column: 5

              # Tests the functions imported from math

try:
    from math import *
except ImportError:
    print("SKIP")
    raise SystemExit

test_values = [-100.0, -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.0]

            

Reported by Pylint.

Unused import sinh from wildcard import
Error

Line: 4 Column: 5

              # Tests the functions imported from math

try:
    from math import *
except ImportError:
    print("SKIP")
    raise SystemExit

test_values = [-100.0, -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.0]

            

Reported by Pylint.

Unused import tanh from wildcard import
Error

Line: 4 Column: 5

              # Tests the functions imported from math

try:
    from math import *
except ImportError:
    print("SKIP")
    raise SystemExit

test_values = [-100.0, -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.0]

            

Reported by Pylint.

Unused import tau from wildcard import
Error

Line: 4 Column: 5

              # Tests the functions imported from math

try:
    from math import *
except ImportError:
    print("SKIP")
    raise SystemExit

test_values = [-100.0, -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.0]

            

Reported by Pylint.

Wildcard import math
Error

Line: 4 Column: 5

              # Tests the functions imported from math

try:
    from math import *
except ImportError:
    print("SKIP")
    raise SystemExit

test_values = [-100.0, -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.0]

            

Reported by Pylint.

Redefining built-in 'pow'
Error

Line: 4 Column: 5

              # Tests the functions imported from math

try:
    from math import *
except ImportError:
    print("SKIP")
    raise SystemExit

test_values = [-100.0, -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.0]

            

Reported by Pylint.

Unused import dist from wildcard import
Error

Line: 4 Column: 5

              # Tests the functions imported from math

try:
    from math import *
except ImportError:
    print("SKIP")
    raise SystemExit

test_values = [-100.0, -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.0]

            

Reported by Pylint.

Unused import pi from wildcard import
Error

Line: 4 Column: 5

              # Tests the functions imported from math

try:
    from math import *
except ImportError:
    print("SKIP")
    raise SystemExit

test_values = [-100.0, -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.0]

            

Reported by Pylint.

Unused import remainder from wildcard import
Error

Line: 4 Column: 5

              # Tests the functions imported from math

try:
    from math import *
except ImportError:
    print("SKIP")
    raise SystemExit

test_values = [-100.0, -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.0]

            

Reported by Pylint.

Unused import asinh from wildcard import
Error

Line: 4 Column: 5

              # Tests the functions imported from math

try:
    from math import *
except ImportError:
    print("SKIP")
    raise SystemExit

test_values = [-100.0, -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.0]

            

Reported by Pylint.

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

Line: 6 Column: 5

                  property
except:
    print("SKIP")
    raise SystemExit

# test property in a base class works for derived classes
class A:
    @property
    def x(self):

            

Reported by Pylint.

Expression "F().foo" is assigned to nothing
Error

Line: 33 Column: 1

              F.foo = property(lambda self: print('foo get'))
class G(F):
    pass
F().foo
G().foo

# should be able to add a property to already-subclassed class because it already has one
F.bar = property(lambda self: print('bar get'))
F().bar

            

Reported by Pylint.

Expression "G().foo" is assigned to nothing
Error

Line: 34 Column: 1

              class G(F):
    pass
F().foo
G().foo

# should be able to add a property to already-subclassed class because it already has one
F.bar = property(lambda self: print('bar get'))
F().bar
G().bar

            

Reported by Pylint.

Expression "F().bar" is assigned to nothing
Error

Line: 38 Column: 1

              
# should be able to add a property to already-subclassed class because it already has one
F.bar = property(lambda self: print('bar get'))
F().bar
G().bar

# test case where class (H here) is already subclassed before adding attributes
class H:
    pass

            

Reported by Pylint.

Expression "G().bar" is assigned to nothing
Error

Line: 39 Column: 1

              # should be able to add a property to already-subclassed class because it already has one
F.bar = property(lambda self: print('bar get'))
F().bar
G().bar

# test case where class (H here) is already subclassed before adding attributes
class H:
    pass
class I(H):

            

Reported by Pylint.

Expression "I().baz" is assigned to nothing
Error

Line: 53 Column: 1

              
# should be able to add a property to the derived class
I.baz = property(lambda self: print('baz get'))
I().baz

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test builtin property combined with inheritance
try:
    property
except:
    print("SKIP")
    raise SystemExit

# test property in a base class works for derived classes
class A:

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 9 Column: 1

                  raise SystemExit

# test property in a base class works for derived classes
class A:
    @property
    def x(self):
        print('A x')
        return 123
class B(A):

            

Reported by Pylint.

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

Line: 9 Column: 1

                  raise SystemExit

# test property in a base class works for derived classes
class A:
    @property
    def x(self):
        print('A x')
        return 123
class B(A):

            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

                  raise SystemExit

# test property in a base class works for derived classes
class A:
    @property
    def x(self):
        print('A x')
        return 123
class B(A):

            

Reported by Pylint.

tests/wipy/pin_irq.py
35 issues
Unable to import 'machine'
Error

Line: 5 Column: 1

              Pin IRQ test for the CC3200 based boards.
"""

from machine import Pin
import machine
import os
import time

mch = os.uname().machine

            

Reported by Pylint.

Unable to import 'machine'
Error

Line: 6 Column: 1

              """

from machine import Pin
import machine
import os
import time

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

            

Reported by Pylint.

Module 'os' has no 'uname' member
Error

Line: 10 Column: 7

              import os
import time

mch = os.uname().machine
if "LaunchPad" in mch:
    pins = ["GP16", "GP13"]
elif "WiPy" in mch:
    pins = ["GP16", "GP13"]
else:

            

Reported by Pylint.

Undefined variable 'pin_irq_count_trigger'
Error

Line: 27 Column: 9

                  global pin_irq_count_total
    global _trigger
    if _trigger & pin1_irq.flags():
        pin_irq_count_trigger += 1
    pin_irq_count_total += 1


pin_irq_count_trigger = 0
pin_irq_count_total = 0

            

Reported by Pylint.

Undefined variable 'pin_irq_count_total'
Error

Line: 28 Column: 5

                  global _trigger
    if _trigger & pin1_irq.flags():
        pin_irq_count_trigger += 1
    pin_irq_count_total += 1


pin_irq_count_trigger = 0
pin_irq_count_total = 0
_trigger = Pin.IRQ_FALLING

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 37 Column: 5

              pin1_irq = pin1.irq(trigger=_trigger, handler=pin_handler)
for i in range(0, 10):
    pin0.toggle()
    time.sleep_ms(5)
print(pin_irq_count_trigger == 5)
print(pin_irq_count_total == 5)

pin_irq_count_trigger = 0
pin_irq_count_total = 0

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 47 Column: 5

              pin1_irq = pin1.irq(trigger=_trigger, handler=pin_handler)
for i in range(0, 200):
    pin0.toggle()
    time.sleep_ms(5)
print(pin_irq_count_trigger == 100)
print(pin_irq_count_total == 100)

pin1_irq.disable()
pin0(1)

            

Reported by Pylint.

Module 'time' has no 'sleep_us' member
Error

Line: 58 Column: 1

              _trigger = Pin.IRQ_FALLING
pin1_irq.init(trigger=_trigger, handler=pin_handler)
pin0(0)
time.sleep_us(50)
print(pin_irq_count_trigger == 1)
print(pin_irq_count_total == 1)
pin0(1)
time.sleep_us(50)
print(pin_irq_count_trigger == 1)

            

Reported by Pylint.

Module 'time' has no 'sleep_us' member
Error

Line: 62 Column: 1

              print(pin_irq_count_trigger == 1)
print(pin_irq_count_total == 1)
pin0(1)
time.sleep_us(50)
print(pin_irq_count_trigger == 1)
print(pin_irq_count_total == 1)

# check the call method
pin1_irq()

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 76 Column: 5

              pin_irq_count_total = 0
for i in range(0, 10):
    pin0.toggle()
    time.sleep_ms(5)
print(pin_irq_count_trigger == 0)
print(pin_irq_count_total == 0)

# test waking up from suspended mode on low level
pin0(0)

            

Reported by Pylint.

ports/cc3200/boards/make-pins.py
35 issues
Not enough arguments for format string
Error

Line: 127 Column: 25

                                  continue
                if not row[pin_col].isdigit():
                    raise ValueError(
                        "Invalid pin number {:s} in row {:s}".format(row[pin_col]), row
                    )
                # Pin numbers must start from 0 when used with the TI API
                pin_num = int(row[pin_col]) - 1
                pin = Pin(row[pinname_col], port_num, gpio_bit, pin_num)
                self.board_pins.append(pin)

            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 38 Column: 45

              class AF:
    """Holds the description of an alternate function"""

    def __init__(self, name, idx, fn, unit, type):
        self.name = name
        self.idx = idx
        if self.idx > 15:
            self.idx = -1
        self.fn = fn

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 123 Column: 17

                          for row in rows:
                try:
                    (port_num, gpio_bit) = parse_port_pin(row[pinname_col])
                except:
                    continue
                if not row[pin_col].isdigit():
                    raise ValueError(
                        "Invalid pin number {:s} in row {:s}".format(row[pin_col]), row
                    )

            

Reported by Pylint.

Duplicate string formatting argument 'label', consider passing as named argument
Error

Line: 170 Column: 13

                              )
        print("};")
        print(
            "MP_DEFINE_CONST_DICT(pin_{:s}_pins_locals_dict, pin_{:s}_pins_locals_dict_table);".format(
                label, label
            )
        )

    def print(self):

            

Reported by Pylint.

Module name "make-pins" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #!/usr/bin/env python
"""Generates the pins file for the CC3200."""

from __future__ import print_function

import argparse
import sys
import csv


            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 35 Column: 1

                  return (port, gpio_bit)


class AF:
    """Holds the description of an alternate function"""

    def __init__(self, name, idx, fn, unit, type):
        self.name = name
        self.idx = idx

            

Reported by Pylint.

Too many arguments (6/5)
Error

Line: 38 Column: 5

              class AF:
    """Holds the description of an alternate function"""

    def __init__(self, name, idx, fn, unit, type):
        self.name = name
        self.idx = idx
        if self.idx > 15:
            self.idx = -1
        self.fn = fn

            

Reported by Pylint.

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

Line: 43 Column: 9

                      self.idx = idx
        if self.idx > 15:
            self.idx = -1
        self.fn = fn
        self.unit = unit
        self.type = type

    def print(self):
        print(

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 47 Column: 5

                      self.unit = unit
        self.type = type

    def print(self):
        print(
            "    AF({:16s}, {:4d}, {:8s}, {:4d}, {:8s}),    // {}".format(
                self.name, self.idx, self.fn, self.unit, self.type, self.name
            )
        )

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 66 Column: 5

                      self.board_pin = False
        self.afs = []

    def add_af(self, af):
        self.afs.append(af)

    def print(self):
        print("// {}".format(self.name))
        if len(self.afs):

            

Reported by Pylint.

tests/wipy/pin.py
35 issues
Unable to import 'machine'
Error

Line: 6 Column: 1

              pull up or pull down connected.
GP12 and GP17 must be connected together 
"""
from machine import Pin
import os

mch = os.uname().machine
if "LaunchPad" in mch:
    pin_map = [

            

Reported by Pylint.

Module 'os' has no 'uname' member
Error

Line: 9 Column: 7

              from machine import Pin
import os

mch = os.uname().machine
if "LaunchPad" in mch:
    pin_map = [
        "GP24",
        "GP12",
        "GP14",

            

Reported by Pylint.

Redefining name 'p' from outer scope (line 52)
Error

Line: 60 Column: 9

              

def test_noinit():
    for p in pin_map:
        pin = Pin(p)
        pin.value()


def test_pin_read(pull):

            

Reported by Pylint.

Redefining name 'pin' from outer scope (line 88)
Error

Line: 61 Column: 9

              
def test_noinit():
    for p in pin_map:
        pin = Pin(p)
        pin.value()


def test_pin_read(pull):
    # enable the pull resistor on all pins, then read the value

            

Reported by Pylint.

Redefining name 'p' from outer scope (line 52)
Error

Line: 67 Column: 9

              
def test_pin_read(pull):
    # enable the pull resistor on all pins, then read the value
    for p in pin_map:
        pin = Pin(p, mode=Pin.IN, pull=pull)
    for p in pin_map:
        print(pin())



            

Reported by Pylint.

Redefining name 'pin' from outer scope (line 88)
Error

Line: 68 Column: 9

              def test_pin_read(pull):
    # enable the pull resistor on all pins, then read the value
    for p in pin_map:
        pin = Pin(p, mode=Pin.IN, pull=pull)
    for p in pin_map:
        print(pin())


def test_pin_af():

            

Reported by Pylint.

Redefining name 'p' from outer scope (line 52)
Error

Line: 74 Column: 9

              

def test_pin_af():
    for p in pin_map:
        for af in Pin(p).alt_list():
            if af[1] <= max_af_idx:
                Pin(p, mode=Pin.ALT, alt=af[1])
                Pin(p, mode=Pin.ALT_OPEN_DRAIN, alt=af[1])


            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 156 Column: 8

              # all the next ones MUST raise
try:
    pin = Pin(pin_map[0], mode=Pin.OUT, pull=Pin.PULL_UP, drive=pin.IN)  # incorrect drive value
except Exception:
    print("Exception")

try:
    pin = Pin(pin_map[0], mode=Pin.LOW_POWER, pull=Pin.PULL_UP)  # incorrect mode value
except Exception:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 161 Column: 8

              
try:
    pin = Pin(pin_map[0], mode=Pin.LOW_POWER, pull=Pin.PULL_UP)  # incorrect mode value
except Exception:
    print("Exception")

try:
    pin = Pin(pin_map[0], mode=Pin.IN, pull=Pin.HIGH_POWER)  # incorrect pull value
except Exception:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 166 Column: 8

              
try:
    pin = Pin(pin_map[0], mode=Pin.IN, pull=Pin.HIGH_POWER)  # incorrect pull value
except Exception:
    print("Exception")

try:
    pin = Pin("A0", Pin.OUT, Pin.PULL_DOWN)  # incorrect pin id
except Exception:

            

Reported by Pylint.