The following issues were found

ports/stm32/boards/pllvalues.py
69 issues
Unused variable 'pllck'
Error

Line: 147 Column: 22

              
def verify_pll(hse, pll):
    M, N, P, Q = pll
    vco_in, vco_out, pllck, pll48ck = compute_derived(hse, pll)

    # verify ints
    assert close_int(M)
    assert close_int(N)
    assert close_int(P)

            

Reported by Pylint.

Unused variable 'pll48ck'
Error

Line: 147 Column: 29

              
def verify_pll(hse, pll):
    M, N, P, Q = pll
    vco_in, vco_out, pllck, pll48ck = compute_derived(hse, pll)

    # verify ints
    assert close_int(M)
    assert close_int(N)
    assert close_int(P)

            

Reported by Pylint.

Unused variable 'pllck'
Error

Line: 203 Column: 30

                  for sys, (M, N, P, Q) in valid_plls:
        print("    (%u << %u) | (%u << %u) | %u," % (M, m_shift, P // 2 - 1, p_shift, sys), end="")
        if M >= 2:
            vco_in, vco_out, pllck, pll48ck = compute_derived(hse, (M, N, P, Q))
            print(
                " // M=%u N=%u P=%u Q=%u vco_in=%.2f vco_out=%.2f pll48=%.2f"
                % (M, N, P, Q, vco_in, vco_out, pll48ck),
                end="",
            )

            

Reported by Pylint.

Global variable 'mcu' undefined at the module level
Error

Line: 245 Column: 5

              

def main():
    global mcu
    global out_format

    # parse input args
    import sys


            

Reported by Pylint.

Using global for 'out_format' but no assignment is done
Error

Line: 246 Column: 5

              
def main():
    global mcu
    global out_format

    # parse input args
    import sys

    argv = sys.argv[1:]

            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 1

              import re


class MCU:
    def __init__(
        self, range_sysclk, range_m, range_n, range_p, range_q, range_vco_in, range_vco_out
    ):
        self.range_sysclk = range_sysclk
        self.range_m = range_m

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 11 Column: 1

              import re


class MCU:
    def __init__(
        self, range_sysclk, range_m, range_n, range_p, range_q, range_vco_in, range_vco_out
    ):
        self.range_sysclk = range_sysclk
        self.range_m = range_m

            

Reported by Pylint.

Too many arguments (8/5)
Error

Line: 12 Column: 5

              

class MCU:
    def __init__(
        self, range_sysclk, range_m, range_n, range_p, range_q, range_vco_in, range_vco_out
    ):
        self.range_sysclk = range_sysclk
        self.range_m = range_m
        self.range_n = range_n

            

Reported by Pylint.

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

Line: 56 Column: 1

              }


def close_int(x):
    return abs(x - round(x)) < 0.01


# original version that requires N/M to be an integer (for simplicity)
def compute_pll(hse, sys):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 56 Column: 1

              }


def close_int(x):
    return abs(x - round(x)) < 0.01


# original version that requires N/M to be an integer (for simplicity)
def compute_pll(hse, sys):

            

Reported by Pylint.

tests/perf_bench/bm_chaos.py
68 issues
Redefining built-in 'iter'
Error

Line: 270 Column: 30

              
    def run():
        nonlocal image
        _, _, width, height, iter, rng_seed = params
        image = chaos.create_image_chaos(width, height, iter, rng_seed)

    def result():
        norm = params[4]
        # Images are not the same when floating point behaviour is different,

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Source: https://github.com/python/pyperformance
# License: MIT

# create chaosgame-like fractals
# Copyright (C) 2005 Carl Friedrich Bolz

import math
import random


            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 1

              import random


class GVector(object):
    def __init__(self, x=0, y=0, z=0):
        self.x = x
        self.y = y
        self.z = z


            

Reported by Pylint.

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

Line: 11 Column: 1

              import random


class GVector(object):
    def __init__(self, x=0, y=0, z=0):
        self.x = x
        self.y = y
        self.z = z


            

Reported by Pylint.

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

Line: 13 Column: 9

              
class GVector(object):
    def __init__(self, x=0, y=0, z=0):
        self.x = x
        self.y = y
        self.z = z

    def Mag(self):
        return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

            

Reported by Pylint.

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

Line: 14 Column: 9

              class GVector(object):
    def __init__(self, x=0, y=0, z=0):
        self.x = x
        self.y = y
        self.z = z

    def Mag(self):
        return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)


            

Reported by Pylint.

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

Line: 15 Column: 9

                  def __init__(self, x=0, y=0, z=0):
        self.x = x
        self.y = y
        self.z = z

    def Mag(self):
        return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

    def dist(self, other):

            

Reported by Pylint.

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

Line: 17 Column: 5

                      self.y = y
        self.z = z

    def Mag(self):
        return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

    def dist(self, other):
        return math.sqrt(
            (self.x - other.x) ** 2 + (self.y - other.y) ** 2 + (self.z - other.z) ** 2

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 5

                      self.y = y
        self.z = z

    def Mag(self):
        return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

    def dist(self, other):
        return math.sqrt(
            (self.x - other.x) ** 2 + (self.y - other.y) ** 2 + (self.z - other.z) ** 2

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 20 Column: 5

                  def Mag(self):
        return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

    def dist(self, other):
        return math.sqrt(
            (self.x - other.x) ** 2 + (self.y - other.y) ** 2 + (self.z - other.z) ** 2
        )

    def __add__(self, other):

            

Reported by Pylint.

extmod/uasyncio/stream.py
66 issues
Attempted relative import beyond top-level package
Error

Line: 4 Column: 1

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

from . import core


class Stream:
    def __init__(self, s, e={}):
        self.s = s

            

Reported by Pylint.

Unable to import 'uerrno'
Error

Line: 79 Column: 5

              
# Create a TCP stream connection to a remote host
async def open_connection(host, port):
    from uerrno import EINPROGRESS
    import usocket as socket

    ai = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)[0]  # TODO this is blocking!
    s = socket.socket(ai[0], ai[1], ai[2])
    s.setblocking(False)

            

Reported by Pylint.

Unable to import 'usocket'
Error

Line: 80 Column: 5

              # Create a TCP stream connection to a remote host
async def open_connection(host, port):
    from uerrno import EINPROGRESS
    import usocket as socket

    ai = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)[0]  # TODO this is blocking!
    s = socket.socket(ai[0], ai[1], ai[2])
    s.setblocking(False)
    ss = Stream(s)

            

Reported by Pylint.

Unable to import 'usocket'
Error

Line: 132 Column: 5

              # Helper function to start a TCP stream server, running as a new task
# TODO could use an accept-callback on socket read activity instead of creating a task
async def start_server(cb, host, port, backlog=5):
    import usocket as socket

    # Create and bind server socket.
    host = socket.getaddrinfo(host, port)[0]  # TODO this is blocking!
    s = socket.socket()
    s.setblocking(False)

            

Reported by Pylint.

Dangerous default value {} as argument
Error

Line: 8 Column: 5

              

class Stream:
    def __init__(self, s, e={}):
        self.s = s
        self.e = e
        self.out_buf = b""

    def get_extra_info(self, v):

            

Reported by Pylint.

TODO yield?
Error

Line: 26 Column: 3

                      pass

    async def wait_closed(self):
        # TODO yield?
        self.s.close()

    async def read(self, n):
        yield core._io_queue.queue_read(self.s)
        return self.s.read(n)

            

Reported by Pylint.

Access to a protected member _io_queue of a client class
Error

Line: 30 Column: 15

                      self.s.close()

    async def read(self, n):
        yield core._io_queue.queue_read(self.s)
        return self.s.read(n)

    async def readinto(self, buf):
        yield core._io_queue.queue_read(self.s)
        return self.s.readinto(buf)

            

Reported by Pylint.

Access to a protected member _io_queue of a client class
Error

Line: 34 Column: 15

                      return self.s.read(n)

    async def readinto(self, buf):
        yield core._io_queue.queue_read(self.s)
        return self.s.readinto(buf)

    async def readexactly(self, n):
        r = b""
        while n:

            

Reported by Pylint.

Access to a protected member _io_queue of a client class
Error

Line: 40 Column: 19

                  async def readexactly(self, n):
        r = b""
        while n:
            yield core._io_queue.queue_read(self.s)
            r2 = self.s.read(n)
            if r2 is not None:
                if not len(r2):
                    raise EOFError
                r += r2

            

Reported by Pylint.

Access to a protected member _io_queue of a client class
Error

Line: 52 Column: 19

                  async def readline(self):
        l = b""
        while True:
            yield core._io_queue.queue_read(self.s)
            l2 = self.s.readline()  # may do multiple reads but won't block
            l += l2
            if not l2 or l[-1] == 10:  # \n (check l in case l2 is str)
                return l


            

Reported by Pylint.

tests/perf_bench/misc_raytrace.py
65 issues
Unused argument 'p'
Error

Line: 124 Column: 26

                              return t
        return INF

    def surface_at(self, p):
        return self.surface, self.normal


class Scene:
    def __init__(self, ambient, light, objs):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # A simple ray tracer
# MIT license; Copyright (c) 2019 Damien P. George

INF = 1e30
EPS = 1e-6


class Vec:
    def __init__(self, x, y, z):

            

Reported by Pylint.

Missing class docstring
Error

Line: 8 Column: 1

              EPS = 1e-6


class Vec:
    def __init__(self, x, y, z):
        self.x, self.y, self.z = x, y, z

    def __neg__(self):
        return Vec(-self.x, -self.y, -self.z)

            

Reported by Pylint.

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

Line: 10 Column: 9

              
class Vec:
    def __init__(self, x, y, z):
        self.x, self.y, self.z = x, y, z

    def __neg__(self):
        return Vec(-self.x, -self.y, -self.z)

    def __add__(self, rhs):

            

Reported by Pylint.

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

Line: 10 Column: 17

              
class Vec:
    def __init__(self, x, y, z):
        self.x, self.y, self.z = x, y, z

    def __neg__(self):
        return Vec(-self.x, -self.y, -self.z)

    def __add__(self, rhs):

            

Reported by Pylint.

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

Line: 10 Column: 25

              
class Vec:
    def __init__(self, x, y, z):
        self.x, self.y, self.z = x, y, z

    def __neg__(self):
        return Vec(-self.x, -self.y, -self.z)

    def __add__(self, rhs):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 5

                  def __mul__(self, rhs):
        return Vec(self.x * rhs, self.y * rhs, self.z * rhs)

    def length(self):
        return (self.x ** 2 + self.y ** 2 + self.z ** 2) ** 0.5

    def normalise(self):
        l = self.length()
        return Vec(self.x / l, self.y / l, self.z / l)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 27 Column: 5

                  def length(self):
        return (self.x ** 2 + self.y ** 2 + self.z ** 2) ** 0.5

    def normalise(self):
        l = self.length()
        return Vec(self.x / l, self.y / l, self.z / l)

    def dot(self, rhs):
        return self.x * rhs.x + self.y * rhs.y + self.z * rhs.z

            

Reported by Pylint.

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

Line: 28 Column: 9

                      return (self.x ** 2 + self.y ** 2 + self.z ** 2) ** 0.5

    def normalise(self):
        l = self.length()
        return Vec(self.x / l, self.y / l, self.z / l)

    def dot(self, rhs):
        return self.x * rhs.x + self.y * rhs.y + self.z * rhs.z


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 31 Column: 5

                      l = self.length()
        return Vec(self.x / l, self.y / l, self.z / l)

    def dot(self, rhs):
        return self.x * rhs.x + self.y * rhs.y + self.z * rhs.z


RGB = Vec


            

Reported by Pylint.

tools/uf2conv.py
61 issues
Using the global statement
Error

Line: 73 Column: 5

              

def convert_from_uf2(buf):
    global appstartaddr
    numblocks = len(buf) // 512
    curraddr = None
    outp = b""
    for blockno in range(numblocks):
        ptr = blockno * 512

            

Reported by Pylint.

Using the global statement
Error

Line: 120 Column: 5

              

def convert_to_uf2(file_content):
    global familyid
    datapadding = b""
    while len(datapadding) < 512 - 256 - 32 - 4:
        datapadding += b"\x00\x00\x00\x00"
    numblocks = (len(file_content) + 255) // 256
    outp = b""

            

Reported by Pylint.

Using the global statement
Error

Line: 157 Column: 9

                      self.bytes = bytearray(256)

    def encode(self, blockno, numblocks):
        global familyid
        flags = 0x0
        if familyid:
            flags |= 0x2000
        hd = struct.pack(
            "<IIIIIIII",

            

Reported by Pylint.

Using the global statement
Error

Line: 180 Column: 5

              

def convert_from_hex_to_uf2(buf):
    global appstartaddr
    appstartaddr = None
    upper = 0
    currblock = None
    blocks = []
    for line in buf.split("\n"):

            

Reported by Pylint.

Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
Error

Line: 236 Column: 31

                          ]
        )
        for line in r.split("\n"):
            words = re.split("\s+", line)
            if len(words) >= 3 and words[1] == "2" and words[2] == "FAT":
                drives.append(words[0])
    else:
        rootpath = "/media"
        if sys.platform == "darwin":

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 253 Column: 9

                  def has_info(d):
        try:
            return os.path.isfile(d + INFO_FILE)
        except:
            return False

    return list(filter(has_info, drives))



            

Reported by Pylint.

Using the global statement
Error

Line: 277 Column: 5

              

def main():
    global appstartaddr, familyid

    def error(msg):
        print(msg)
        sys.exit(1)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python3

# Microsoft UF2
#
# The MIT License (MIT)
#
# Copyright (c) Microsoft Corporation
#
# All rights reserved.

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              
import sys
import struct
import subprocess
import re
import os
import os.path
import argparse


            

Reported by Bandit.

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

Line: 53 Column: 1

              
INFO_FILE = "/INFO_UF2.TXT"

appstartaddr = 0x2000
familyid = 0x0


def is_uf2(buf):
    w = struct.unpack("<II", buf[0:8])

            

Reported by Pylint.

ports/stm32/boards/make-pins.py
59 issues
Redefining built-in 'str'
Error

Line: 218 Column: 9

                      return "pin_{:s}_af".format(self.cpu_pin_name())

    def adc_num_str(self):
        str = ""
        for adc_num in range(1, 4):
            if self.adc_num & (1 << (adc_num - 1)):
                if len(str) > 0:
                    str += " | "
                str += "PIN_ADC"

            

Reported by Pylint.

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

Line: 254 Column: 24

                  def print_header(self, hdr_file):
        n = self.cpu_pin_name()
        hdr_file.write("extern const pin_obj_t pin_{:s}_obj;\n".format(n))
        hdr_file.write("#define pin_{:s} (&pin_{:s}_obj)\n".format(n, n))
        if self.alt_fn_count > 0:
            hdr_file.write("extern const pin_af_obj_t pin_{:s}_af[];\n".format(n))

    def qstr_list(self):
        result = []

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 304 Column: 17

                          for row in rows:
                try:
                    (port_num, pin_num) = parse_port_pin(row[pinname_col])
                except:
                    continue
                pin = Pin(port_num, pin_num)
                for af_idx in range(af_col, len(row)):
                    if af_idx < af_col + 16:
                        pin.parse_af(af_idx - af_col, row[af_idx])

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 320 Column: 17

                          for row in rows:
                try:
                    (port_num, pin_num) = parse_port_pin(row[1])
                except:
                    continue
                pin = self.find_pin(port_num, pin_num)
                if pin:
                    pin.set_is_board_pin()
                    if row[0]:  # Only add board pins that have a name

            

Reported by Pylint.

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

Line: 342 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
"""Creates the pin file for the STM32F4xx."""

from __future__ import print_function

import argparse
import sys
import csv


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 50 Column: 1

                  return (port, int(pin_str))


def split_name_num(name_num):
    num = None
    for num_idx in range(len(name_num) - 1, -1, -1):
        if not name_num[num_idx].isdigit():
            name = name_num[0 : num_idx + 1]
            num_str = name_num[num_idx + 1 :]

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 62 Column: 1

                  return name, num


def conditional_var(name_num):
    # Try the specific instance first. For example, if name_num is UART4_RX
    # then try UART4 first, and then try UART second.
    name, num = split_name_num(name_num)
    var = []
    if name in CONDITIONAL_VAR:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 74 Column: 1

                  return var


def print_conditional_if(cond_var, file=None):
    if cond_var:
        cond_str = []
        for var in cond_var:
            if var.find("ENABLE") >= 0:
                cond_str.append("(defined({0}) && {0})".format(var))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 85 Column: 1

                      print("#if " + " || ".join(cond_str), file=file)


def print_conditional_endif(cond_var, file=None):
    if cond_var:
        print("#endif", file=file)


class AlternateFunction(object):

            

Reported by Pylint.

tests/perf_bench/misc_aes.py
54 issues
Unused variable 'i'
Error

Line: 116 Column: 9

              def aes_state(state, w, temp, nr):
    aes_add_round_key(state, w)
    w_idx = 16
    for i in range(nr - 1):
        aes_sb_sr_mc_ark(state, w, w_idx, temp)
        w_idx += 16
    aes_sb_sr_ark(state, w, w_idx, temp)



            

Reported by Pylint.

Unused variable 'loop'
Error

Line: 219 Column: 13

                  # from now on we don't use the heap

    def run():
        for loop in range(nloop):
            # encrypt
            aes.set_key(key)
            aes.set_iv(iv)
            for i in range(2):
                aes.apply_to(data)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Pure Python AES encryption routines.
#
# AES is integer based and inplace so doesn't use the heap.  It is therefore
# a good test of raw performance and correctness of the VM/runtime.
#
# The AES code comes first (code originates from a C version authored by D.P.George)
# and then the test harness at the bottom.
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 37 Column: 1

              # fmt: on

# multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b
def aes_gf8_mul_2(x):
    if x & 0x80:
        return (x << 1) ^ 0x11B
    else:
        return x << 1


            

Reported by Pylint.

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

Line: 37 Column: 1

              # fmt: on

# multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b
def aes_gf8_mul_2(x):
    if x & 0x80:
        return (x << 1) ^ 0x11B
    else:
        return x << 1


            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 38 Column: 5

              
# multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b
def aes_gf8_mul_2(x):
    if x & 0x80:
        return (x << 1) ^ 0x11B
    else:
        return x << 1



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 44 Column: 1

                      return x << 1


def aes_gf8_mul_3(x):
    return x ^ aes_gf8_mul_2(x)


# non-linear, invertible, substitution box
def aes_s_box(a):

            

Reported by Pylint.

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

Line: 44 Column: 1

                      return x << 1


def aes_gf8_mul_3(x):
    return x ^ aes_gf8_mul_2(x)


# non-linear, invertible, substitution box
def aes_s_box(a):

            

Reported by Pylint.

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

Line: 49 Column: 1

              

# non-linear, invertible, substitution box
def aes_s_box(a):
    return aes_s_box_table[a & 0xFF]


# return 0x02^(a-1) in GF(2^8)
def aes_r_con(a):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 49 Column: 1

              

# non-linear, invertible, substitution box
def aes_s_box(a):
    return aes_s_box_table[a & 0xFF]


# return 0x02^(a-1) in GF(2^8)
def aes_r_con(a):

            

Reported by Pylint.

tests/inlineasm/asmsum.py
54 issues
Undefined variable 'micropython'
Error

Line: 1 Column: 2

              @micropython.asm_thumb
def asm_sum_words(r0, r1):

    # r0 = len
    # r1 = ptr
    # r2 = sum
    # r3 = dummy
    mov(r2, 0)


            

Reported by Pylint.

Undefined variable 'r2'
Error

Line: 8 Column: 9

                  # r1 = ptr
    # r2 = sum
    # r3 = dummy
    mov(r2, 0)

    b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])

            

Reported by Pylint.

Undefined variable 'mov'
Error

Line: 8 Column: 5

                  # r1 = ptr
    # r2 = sum
    # r3 = dummy
    mov(r2, 0)

    b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])

            

Reported by Pylint.

b is not callable
Error

Line: 10 Column: 5

                  # r3 = dummy
    mov(r2, 0)

    b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)


            

Reported by Pylint.

Undefined variable 'loop_entry'
Error

Line: 10 Column: 7

                  # r3 = dummy
    mov(r2, 0)

    b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)


            

Reported by Pylint.

Undefined variable 'label'
Error

Line: 12 Column: 5

              
    b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)

    add(r1, r1, 4)
    sub(r0, r0, 1)

            

Reported by Pylint.

Undefined variable 'loop1'
Error

Line: 12 Column: 11

              
    b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)

    add(r1, r1, 4)
    sub(r0, r0, 1)

            

Reported by Pylint.

Undefined variable 'ldr'
Error

Line: 13 Column: 5

                  b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)

    add(r1, r1, 4)
    sub(r0, r0, 1)


            

Reported by Pylint.

Undefined variable 'r3'
Error

Line: 13 Column: 9

                  b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)

    add(r1, r1, 4)
    sub(r0, r0, 1)


            

Reported by Pylint.

Undefined variable 'r2'
Error

Line: 14 Column: 13

              
    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)

    add(r1, r1, 4)
    sub(r0, r0, 1)

    label(loop_entry)

            

Reported by Pylint.

examples/asmsum.py
52 issues
Undefined variable 'micropython'
Error

Line: 1 Column: 2

              @micropython.asm_thumb
def asm_sum_words(r0, r1):

    # r0 = len
    # r1 = ptr
    # r2 = sum
    # r3 = dummy
    mov(r2, 0)


            

Reported by Pylint.

Undefined variable 'mov'
Error

Line: 8 Column: 5

                  # r1 = ptr
    # r2 = sum
    # r3 = dummy
    mov(r2, 0)

    b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])

            

Reported by Pylint.

Undefined variable 'r2'
Error

Line: 8 Column: 9

                  # r1 = ptr
    # r2 = sum
    # r3 = dummy
    mov(r2, 0)

    b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])

            

Reported by Pylint.

b is not callable
Error

Line: 10 Column: 5

                  # r3 = dummy
    mov(r2, 0)

    b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)


            

Reported by Pylint.

Undefined variable 'loop_entry'
Error

Line: 10 Column: 7

                  # r3 = dummy
    mov(r2, 0)

    b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)


            

Reported by Pylint.

Undefined variable 'label'
Error

Line: 12 Column: 5

              
    b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)

    add(r1, r1, 4)
    sub(r0, r0, 1)

            

Reported by Pylint.

Undefined variable 'loop1'
Error

Line: 12 Column: 11

              
    b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)

    add(r1, r1, 4)
    sub(r0, r0, 1)

            

Reported by Pylint.

Undefined variable 'r3'
Error

Line: 13 Column: 9

                  b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)

    add(r1, r1, 4)
    sub(r0, r0, 1)


            

Reported by Pylint.

Undefined variable 'ldr'
Error

Line: 13 Column: 5

                  b(loop_entry)

    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)

    add(r1, r1, 4)
    sub(r0, r0, 1)


            

Reported by Pylint.

Undefined variable 'r3'
Error

Line: 14 Column: 17

              
    label(loop1)
    ldr(r3, [r1, 0])
    add(r2, r2, r3)

    add(r1, r1, 4)
    sub(r0, r0, 1)

    label(loop_entry)

            

Reported by Pylint.

tests/micropython/viper_misc.py
52 issues
Unable to import 'micropython'
Error

Line: 1 Column: 1

              import micropython

# viper function taking and returning ints
@micropython.viper
def viper_int(x: int, y: int) -> int:
    return x + y + 3


print(viper_int(1, 2))

            

Reported by Pylint.

Global variable 'gl' undefined at the module level
Error

Line: 83 Column: 5

              # accessing a global
@micropython.viper
def viper_access_global():
    global gl
    gl = 1
    return gl


print(viper_access_global(), gl)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import micropython

# viper function taking and returning ints
@micropython.viper
def viper_int(x: int, y: int) -> int:
    return x + y + 3


print(viper_int(1, 2))

            

Reported by Pylint.

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

Line: 5 Column: 1

              
# viper function taking and returning ints
@micropython.viper
def viper_int(x: int, y: int) -> int:
    return x + y + 3


print(viper_int(1, 2))


            

Reported by Pylint.

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

Line: 5 Column: 1

              
# viper function taking and returning ints
@micropython.viper
def viper_int(x: int, y: int) -> int:
    return x + y + 3


print(viper_int(1, 2))


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 1

              
# viper function taking and returning ints
@micropython.viper
def viper_int(x: int, y: int) -> int:
    return x + y + 3


print(viper_int(1, 2))


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

              
# viper function taking and returning objects
@micropython.viper
def viper_object(x: object, y: object) -> object:
    return x + y


print(viper_object(1, 2))


            

Reported by Pylint.

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

Line: 13 Column: 1

              
# viper function taking and returning objects
@micropython.viper
def viper_object(x: object, y: object) -> object:
    return x + y


print(viper_object(1, 2))


            

Reported by Pylint.

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

Line: 13 Column: 1

              
# viper function taking and returning objects
@micropython.viper
def viper_object(x: object, y: object) -> object:
    return x + y


print(viper_object(1, 2))


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 1

              
# return None as non-object (should return 0)
@micropython.viper
def viper_ret_none() -> int:
    return None


print(viper_ret_none())


            

Reported by Pylint.