The following issues were found

tests/multi_net/tcp_data.py
12 issues
Undefined variable 'multitest'
Error

Line: 9 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: 9 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: 14 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()
    print(s2.recv(16))
    s2.send(b"server to client")
    s.close()


            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 23 Column: 5

              
# Client
def instance1():
    multitest.next()
    s = socket.socket()
    s.connect(socket.getaddrinfo(IP, PORT)[0][-1])
    s.send(b"client to server")
    print(s.recv(16))
    s.close()

            

Reported by Pylint.

Undefined variable 'IP'
Error

Line: 25 Column: 34

              def instance1():
    multitest.next()
    s = socket.socket()
    s.connect(socket.getaddrinfo(IP, PORT)[0][-1])
    s.send(b"client to server")
    print(s.recv(16))
    s.close()

            

Reported by Pylint.

Possible binding to all interfaces.
Security

Line: 12
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()
    print(s2.recv(16))
    s2.send(b"server to client")

            

Reported by Bandit.

Missing module docstring
Error

Line: 1 Column: 1

              # Simple test of a TCP server and client transferring data

import socket

PORT = 8000

# Server
def instance0():
    multitest.globals(IP=multitest.get_network_ip())

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

              PORT = 8000

# 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)

            

Reported by Pylint.

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

Line: 10 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()
    s2, _ = s.accept()

            

Reported by Pylint.

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

Line: 15 Column: 5

                  s.bind(socket.getaddrinfo("0.0.0.0", PORT)[0][-1])
    s.listen(1)
    multitest.next()
    s2, _ = s.accept()
    print(s2.recv(16))
    s2.send(b"server to client")
    s.close()



            

Reported by Pylint.

tests/basics/getattr.py
12 issues
class already defined line 3
Error

Line: 14 Column: 1

              print(a.a, a.b)

# test that any exception raised in __getattr__ propagates out
class A:
    def __getattr__(self, attr):
        if attr == "value":
            raise ValueError(123)
        else:
            raise AttributeError(456)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test __getattr__

class A:
    def __init__(self, d):
        self.d = d

    def __getattr__(self, attr):
        return self.d[attr]


            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              # test __getattr__

class A:
    def __init__(self, d):
        self.d = d

    def __getattr__(self, attr):
        return self.d[attr]


            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 3 Column: 1

              # test __getattr__

class A:
    def __init__(self, d):
        self.d = d

    def __getattr__(self, attr):
        return self.d[attr]


            

Reported by Pylint.

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

Line: 3 Column: 1

              # test __getattr__

class A:
    def __init__(self, d):
        self.d = d

    def __getattr__(self, attr):
        return self.d[attr]


            

Reported by Pylint.

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

Line: 5 Column: 9

              
class A:
    def __init__(self, d):
        self.d = d

    def __getattr__(self, attr):
        return self.d[attr]

a = A({'a':1, 'b':2})

            

Reported by Pylint.

Missing class docstring
Error

Line: 14 Column: 1

              print(a.a, a.b)

# test that any exception raised in __getattr__ propagates out
class A:
    def __getattr__(self, attr):
        if attr == "value":
            raise ValueError(123)
        else:
            raise AttributeError(456)

            

Reported by Pylint.

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

Line: 14 Column: 1

              print(a.a, a.b)

# test that any exception raised in __getattr__ propagates out
class A:
    def __getattr__(self, attr):
        if attr == "value":
            raise ValueError(123)
        else:
            raise AttributeError(456)

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 14 Column: 1

              print(a.a, a.b)

# test that any exception raised in __getattr__ propagates out
class A:
    def __getattr__(self, attr):
        if attr == "value":
            raise ValueError(123)
        else:
            raise AttributeError(456)

            

Reported by Pylint.

Unnecessary "else" after "raise"
Error

Line: 16 Column: 9

              # test that any exception raised in __getattr__ propagates out
class A:
    def __getattr__(self, attr):
        if attr == "value":
            raise ValueError(123)
        else:
            raise AttributeError(456)
a = A()
try:

            

Reported by Pylint.

tests/run-internalbench.py
12 issues
Undefined variable 'pyboard'
Error

Line: 44 Column: 24

                              pyb.enter_raw_repl()
                try:
                    output_mupy = pyb.execfile(test_file).replace(b"\r\n", b"\n")
                except pyboard.PyboardError:
                    output_mupy = b"CRASH"

            output_mupy = float(output_mupy.strip())
            test_file[1] = output_mupy
            testcase_count += 1

            

Reported by Pylint.

Unable to import 'pyboard'
Error

Line: 72 Column: 9

              
    # Note pyboard support is copied over from run-tests.py, not tests, and likely needs revamping
    if args.pyboard:
        import pyboard

        pyb = pyboard.Pyboard("/dev/ttyACM0")
        pyb.enter_raw_repl()
    else:
        pyb = None

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #! /usr/bin/env python3

import os
import subprocess
import sys
import argparse
import re
from glob import glob
from collections import defaultdict

            

Reported by Pylint.

Module name "run-internalbench" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #! /usr/bin/env python3

import os
import subprocess
import sys
import argparse
import re
from glob import glob
from collections import defaultdict

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              #! /usr/bin/env python3

import os
import subprocess
import sys
import argparse
import re
from glob import glob
from collections import defaultdict

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 22 Column: 1

                  MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", "../ports/unix/micropython")


def run_tests(pyb, test_dict):
    test_count = 0
    testcase_count = 0

    for base_test, tests in sorted(test_dict.items()):
        print(base_test + ":")

            

Reported by Pylint.

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

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

                          if pyb is None:
                # run on PC
                try:
                    output_mupy = subprocess.check_output(
                        [MICROPYTHON, "-X", "emit=bytecode", test_file[0]]
                    )
                except subprocess.CalledProcessError:
                    output_mupy = b"CRASH"
            else:

            

Reported by Bandit.

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

Line: 53 Column: 13

              
        test_count += 1
        baseline = None
        for t in tests:
            if baseline is None:
                baseline = t[1]
            print("    %.3fs (%+06.2f%%) %s" % (t[1], (t[1] * 100 / baseline) - 100, t[0]))

    print("{} tests performed ({} individual testcases)".format(test_count, testcase_count))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 64 Column: 1

                  return True


def main():
    cmd_parser = argparse.ArgumentParser(description="Run tests for MicroPython.")
    cmd_parser.add_argument("--pyboard", action="store_true", help="run the tests on the pyboard")
    cmd_parser.add_argument("files", nargs="*", help="input test files")
    args = cmd_parser.parse_args()


            

Reported by Pylint.

Import outside toplevel (pyboard)
Error

Line: 72 Column: 9

              
    # Note pyboard support is copied over from run-tests.py, not tests, and likely needs revamping
    if args.pyboard:
        import pyboard

        pyb = pyboard.Pyboard("/dev/ttyACM0")
        pyb.enter_raw_repl()
    else:
        pyb = None

            

Reported by Pylint.

ports/nrf/examples/ssd1306_mod.py
12 issues
Unable to import 'ssd1306'
Error

Line: 21 Column: 1

              # i2c = I2C(0, Pin.board.PA3, Pin.board.PA4)
# disp = SSD1306_I2C_Mod(128, 64, i2c)

from ssd1306 import SSD1306_I2C

SET_COL_ADDR = const(0x21)
SET_PAGE_ADDR = const(0x22)



            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 23 Column: 16

              
from ssd1306 import SSD1306_I2C

SET_COL_ADDR = const(0x21)
SET_PAGE_ADDR = const(0x22)


class SSD1306_I2C_Mod(SSD1306_I2C):
    def show(self):

            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 24 Column: 17

              from ssd1306 import SSD1306_I2C

SET_COL_ADDR = const(0x21)
SET_PAGE_ADDR = const(0x22)


class SSD1306_I2C_Mod(SSD1306_I2C):
    def show(self):
        x0 = 0

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # NOTE: Modified version to align with implemented I2C API in nrf port.
#
# Examples usage of SSD1306_SPI on pca10040
#
# from machine import Pin, SPI
# from ssd1306 import SSD1306_SPI
# spi = SPI(0, baudrate=40000000)
# dc = Pin.board.PA11
# res = Pin.board.PA12

            

Reported by Pylint.

Missing class docstring
Error

Line: 27 Column: 1

              SET_PAGE_ADDR = const(0x22)


class SSD1306_I2C_Mod(SSD1306_I2C):
    def show(self):
        x0 = 0
        x1 = self.width - 1
        if self.width == 64:
            # displays with width of 64 pixels are shifted by 32

            

Reported by Pylint.

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

Line: 27 Column: 1

              SET_PAGE_ADDR = const(0x22)


class SSD1306_I2C_Mod(SSD1306_I2C):
    def show(self):
        x0 = 0
        x1 = self.width - 1
        if self.width == 64:
            # displays with width of 64 pixels are shifted by 32

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 28 Column: 5

              

class SSD1306_I2C_Mod(SSD1306_I2C):
    def show(self):
        x0 = 0
        x1 = self.width - 1
        if self.width == 64:
            # displays with width of 64 pixels are shifted by 32
            x0 += 32

            

Reported by Pylint.

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

Line: 29 Column: 9

              
class SSD1306_I2C_Mod(SSD1306_I2C):
    def show(self):
        x0 = 0
        x1 = self.width - 1
        if self.width == 64:
            # displays with width of 64 pixels are shifted by 32
            x0 += 32
            x1 += 32

            

Reported by Pylint.

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

Line: 30 Column: 9

              class SSD1306_I2C_Mod(SSD1306_I2C):
    def show(self):
        x0 = 0
        x1 = self.width - 1
        if self.width == 64:
            # displays with width of 64 pixels are shifted by 32
            x0 += 32
            x1 += 32
        self.write_cmd(SET_COL_ADDR)

            

Reported by Pylint.

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

Line: 33 Column: 13

                      x1 = self.width - 1
        if self.width == 64:
            # displays with width of 64 pixels are shifted by 32
            x0 += 32
            x1 += 32
        self.write_cmd(SET_COL_ADDR)
        self.write_cmd(x0)
        self.write_cmd(x1)
        self.write_cmd(SET_PAGE_ADDR)

            

Reported by Pylint.

tests/inlineasm/asmconst.py
12 issues
Undefined variable 'micropython'
Error

Line: 4 Column: 2

              # test constants in assembler


@micropython.asm_thumb
def c1():
    movwt(r0, 0xFFFFFFFF)
    movwt(r1, 0xF0000000)
    sub(r0, r0, r1)


            

Reported by Pylint.

Undefined variable 'r0'
Error

Line: 6 Column: 11

              
@micropython.asm_thumb
def c1():
    movwt(r0, 0xFFFFFFFF)
    movwt(r1, 0xF0000000)
    sub(r0, r0, r1)


print(hex(c1()))

            

Reported by Pylint.

Undefined variable 'movwt'
Error

Line: 6 Column: 5

              
@micropython.asm_thumb
def c1():
    movwt(r0, 0xFFFFFFFF)
    movwt(r1, 0xF0000000)
    sub(r0, r0, r1)


print(hex(c1()))

            

Reported by Pylint.

Undefined variable 'r1'
Error

Line: 7 Column: 11

              @micropython.asm_thumb
def c1():
    movwt(r0, 0xFFFFFFFF)
    movwt(r1, 0xF0000000)
    sub(r0, r0, r1)


print(hex(c1()))

            

Reported by Pylint.

Undefined variable 'movwt'
Error

Line: 7 Column: 5

              @micropython.asm_thumb
def c1():
    movwt(r0, 0xFFFFFFFF)
    movwt(r1, 0xF0000000)
    sub(r0, r0, r1)


print(hex(c1()))

            

Reported by Pylint.

Undefined variable 'r1'
Error

Line: 8 Column: 17

              def c1():
    movwt(r0, 0xFFFFFFFF)
    movwt(r1, 0xF0000000)
    sub(r0, r0, r1)


print(hex(c1()))

            

Reported by Pylint.

Undefined variable 'sub'
Error

Line: 8 Column: 5

              def c1():
    movwt(r0, 0xFFFFFFFF)
    movwt(r1, 0xF0000000)
    sub(r0, r0, r1)


print(hex(c1()))

            

Reported by Pylint.

Undefined variable 'r0'
Error

Line: 8 Column: 9

              def c1():
    movwt(r0, 0xFFFFFFFF)
    movwt(r1, 0xF0000000)
    sub(r0, r0, r1)


print(hex(c1()))

            

Reported by Pylint.

Undefined variable 'r0'
Error

Line: 8 Column: 13

              def c1():
    movwt(r0, 0xFFFFFFFF)
    movwt(r1, 0xF0000000)
    sub(r0, r0, r1)


print(hex(c1()))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test constants in assembler


@micropython.asm_thumb
def c1():
    movwt(r0, 0xFFFFFFFF)
    movwt(r1, 0xF0000000)
    sub(r0, r0, r1)


            

Reported by Pylint.

ports/nrf/examples/nrf52_servo.py
12 issues
Unable to import 'machine'
Error

Line: 26 Column: 1

              # THE SOFTWARE

import time
from machine import PWM, Pin


class Servo:
    def __init__(self, pin_name=""):
        if pin_name:

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 41 Column: 9

                          0, self.pin, freq=PWM.FREQ_125KHZ, pulse_width=105, period=2500, mode=PWM.MODE_HIGH_LOW
        )
        p.init()
        time.sleep_ms(200)
        p.deinit()

    def center(self):
        p = PWM(
            0, self.pin, freq=PWM.FREQ_125KHZ, pulse_width=188, period=2500, mode=PWM.MODE_HIGH_LOW

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 49 Column: 9

                          0, self.pin, freq=PWM.FREQ_125KHZ, pulse_width=188, period=2500, mode=PWM.MODE_HIGH_LOW
        )
        p.init()
        time.sleep_ms(200)
        p.deinit()

    def right(self):
        p = PWM(
            0, self.pin, freq=PWM.FREQ_125KHZ, pulse_width=275, period=2500, mode=PWM.MODE_HIGH_LOW

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 57 Column: 9

                          0, self.pin, freq=PWM.FREQ_125KHZ, pulse_width=275, period=2500, mode=PWM.MODE_HIGH_LOW
        )
        p.init()
        time.sleep_ms(200)
        p.deinit()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2017 Glenn Ruben Bakke
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights

            

Reported by Pylint.

Missing class docstring
Error

Line: 29 Column: 1

              from machine import PWM, Pin


class Servo:
    def __init__(self, pin_name=""):
        if pin_name:
            self.pin = Pin(pin_name, mode=Pin.OUT, pull=Pin.PULL_DOWN)
        else:
            self.pin = Pin("P22", mode=Pin.OUT, pull=Pin.PULL_DOWN)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 36 Column: 5

                      else:
            self.pin = Pin("P22", mode=Pin.OUT, pull=Pin.PULL_DOWN)

    def left(self):
        p = PWM(
            0, self.pin, freq=PWM.FREQ_125KHZ, pulse_width=105, period=2500, mode=PWM.MODE_HIGH_LOW
        )
        p.init()
        time.sleep_ms(200)

            

Reported by Pylint.

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

Line: 37 Column: 9

                          self.pin = Pin("P22", mode=Pin.OUT, pull=Pin.PULL_DOWN)

    def left(self):
        p = PWM(
            0, self.pin, freq=PWM.FREQ_125KHZ, pulse_width=105, period=2500, mode=PWM.MODE_HIGH_LOW
        )
        p.init()
        time.sleep_ms(200)
        p.deinit()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 44 Column: 5

                      time.sleep_ms(200)
        p.deinit()

    def center(self):
        p = PWM(
            0, self.pin, freq=PWM.FREQ_125KHZ, pulse_width=188, period=2500, mode=PWM.MODE_HIGH_LOW
        )
        p.init()
        time.sleep_ms(200)

            

Reported by Pylint.

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

Line: 45 Column: 9

                      p.deinit()

    def center(self):
        p = PWM(
            0, self.pin, freq=PWM.FREQ_125KHZ, pulse_width=188, period=2500, mode=PWM.MODE_HIGH_LOW
        )
        p.init()
        time.sleep_ms(200)
        p.deinit()

            

Reported by Pylint.

tests/perf_bench/misc_mandel.py
12 issues
Missing module docstring
Error

Line: 1 Column: 1

              # Compute the Mandelbrot set, to test complex numbers


def mandelbrot(w, h):
    def in_set(c):
        z = 0
        for i in range(32):
            z = z * z + c
            if abs(z) > 100:

            

Reported by Pylint.

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

Line: 4 Column: 1

              # Compute the Mandelbrot set, to test complex numbers


def mandelbrot(w, h):
    def in_set(c):
        z = 0
        for i in range(32):
            z = z * z + c
            if abs(z) > 100:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 4 Column: 1

              # Compute the Mandelbrot set, to test complex numbers


def mandelbrot(w, h):
    def in_set(c):
        z = 0
        for i in range(32):
            z = z * z + c
            if abs(z) > 100:

            

Reported by Pylint.

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

Line: 4 Column: 1

              # Compute the Mandelbrot set, to test complex numbers


def mandelbrot(w, h):
    def in_set(c):
        z = 0
        for i in range(32):
            z = z * z + c
            if abs(z) > 100:

            

Reported by Pylint.

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

Line: 5 Column: 5

              

def mandelbrot(w, h):
    def in_set(c):
        z = 0
        for i in range(32):
            z = z * z + c
            if abs(z) > 100:
                return i

            

Reported by Pylint.

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

Line: 6 Column: 9

              
def mandelbrot(w, h):
    def in_set(c):
        z = 0
        for i in range(32):
            z = z * z + c
            if abs(z) > 100:
                return i
        return 0

            

Reported by Pylint.

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

Line: 8 Column: 13

                  def in_set(c):
        z = 0
        for i in range(32):
            z = z * z + c
            if abs(z) > 100:
                return i
        return 0

    img = bytearray(w * h)

            

Reported by Pylint.

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

Line: 17 Column: 9

              
    xscale = (w - 1) / 2.4
    yscale = (h - 1) / 3.2
    for v in range(h):
        line = memoryview(img)[v * w : v * w + w]
        for u in range(w):
            c = in_set(complex(v / yscale - 2.3, u / xscale - 1.2))
            line[u] = c


            

Reported by Pylint.

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

Line: 19 Column: 13

                  yscale = (h - 1) / 3.2
    for v in range(h):
        line = memoryview(img)[v * w : v * w + w]
        for u in range(w):
            c = in_set(complex(v / yscale - 2.3, u / xscale - 1.2))
            line[u] = c

    return img


            

Reported by Pylint.

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

Line: 20 Column: 13

                  for v in range(h):
        line = memoryview(img)[v * w : v * w + w]
        for u in range(w):
            c = in_set(complex(v / yscale - 2.3, u / xscale - 1.2))
            line[u] = c

    return img



            

Reported by Pylint.

tests/micropython/viper_types.py
11 issues
Unable to import 'micropython'
Error

Line: 3 Column: 1

              # test various type conversions

import micropython

# converting incoming arg to bool
@micropython.viper
def f1(x: bool):
    print(x)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test various type conversions

import micropython

# converting incoming arg to bool
@micropython.viper
def f1(x: bool):
    print(x)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              
# converting incoming arg to bool
@micropython.viper
def f1(x: bool):
    print(x)


f1(0)
f1(1)

            

Reported by Pylint.

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

Line: 7 Column: 1

              
# converting incoming arg to bool
@micropython.viper
def f1(x: bool):
    print(x)


f1(0)
f1(1)

            

Reported by Pylint.

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

Line: 7 Column: 1

              
# converting incoming arg to bool
@micropython.viper
def f1(x: bool):
    print(x)


f1(0)
f1(1)

            

Reported by Pylint.

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

Line: 18 Column: 1

              
# taking and returning a bool
@micropython.viper
def f2(x: bool) -> bool:
    return x


print(f2([]))
print(f2([1]))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 1

              
# taking and returning a bool
@micropython.viper
def f2(x: bool) -> bool:
    return x


print(f2([]))
print(f2([1]))

            

Reported by Pylint.

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

Line: 18 Column: 1

              
# taking and returning a bool
@micropython.viper
def f2(x: bool) -> bool:
    return x


print(f2([]))
print(f2([1]))

            

Reported by Pylint.

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

Line: 27 Column: 1

              
# converting to bool within function
@micropython.viper
def f3(x) -> bool:
    return bool(x)


print(f3([]))
print(f3(-1))

            

Reported by Pylint.

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

Line: 27 Column: 1

              
# converting to bool within function
@micropython.viper
def f3(x) -> bool:
    return bool(x)


print(f3([]))
print(f3(-1))

            

Reported by Pylint.

tests/basics/fun_kwvarargs.py
11 issues
Missing function or method docstring
Error

Line: 1 Column: 1

              def f1(**kwargs):
    print(kwargs)

f1()
f1(a=1)

def f2(a, **kwargs):
    print(a, kwargs)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def f1(**kwargs):
    print(kwargs)

f1()
f1(a=1)

def f2(a, **kwargs):
    print(a, kwargs)


            

Reported by Pylint.

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

Line: 1 Column: 1

              def f1(**kwargs):
    print(kwargs)

f1()
f1(a=1)

def f2(a, **kwargs):
    print(a, kwargs)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              f1()
f1(a=1)

def f2(a, **kwargs):
    print(a, kwargs)

f2(1)
f2(1, b=2)


            

Reported by Pylint.

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

Line: 7 Column: 1

              f1()
f1(a=1)

def f2(a, **kwargs):
    print(a, kwargs)

f2(1)
f2(1, b=2)


            

Reported by Pylint.

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

Line: 7 Column: 1

              f1()
f1(a=1)

def f2(a, **kwargs):
    print(a, kwargs)

f2(1)
f2(1, b=2)


            

Reported by Pylint.

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

Line: 13 Column: 1

              f2(1)
f2(1, b=2)

def f3(a, *vargs, **kwargs):
    print(a, vargs, kwargs)

f3(1)
f3(1, 2)
f3(1, b=2)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

              f2(1)
f2(1, b=2)

def f3(a, *vargs, **kwargs):
    print(a, vargs, kwargs)

f3(1)
f3(1, 2)
f3(1, b=2)

            

Reported by Pylint.

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

Line: 13 Column: 1

              f2(1)
f2(1, b=2)

def f3(a, *vargs, **kwargs):
    print(a, vargs, kwargs)

f3(1)
f3(1, 2)
f3(1, b=2)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 1

              f3(1, b=2)
f3(1, 2, b=3)

def f4(*vargs, **kwargs):
    print(vargs, kwargs)
f4(*(1, 2))
f4(kw_arg=3)
f4(*(1, 2), kw_arg=3)

            

Reported by Pylint.

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

Line: 17 Column: 5

                  print(A().Fun.__name__)
except AttributeError:
    print('SKIP')
    raise SystemExit

# __name__ of a bound native method is not implemented in uPy
# the test here is to make sure it doesn't crash
try:
    str((1).to_bytes.__name__)

            

Reported by Pylint.

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

Line: 1 Column: 1

              def Fun():
    pass

class A:
    def __init__(self):
        pass
    def Fun(self):
        pass


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def Fun():
    pass

class A:
    def __init__(self):
        pass
    def Fun(self):
        pass


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 1 Column: 1

              def Fun():
    pass

class A:
    def __init__(self):
        pass
    def Fun(self):
        pass


            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              def Fun():
    pass

class A:
    def __init__(self):
        pass
    def Fun(self):
        pass


            

Reported by Pylint.

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

Line: 4 Column: 1

              def Fun():
    pass

class A:
    def __init__(self):
        pass
    def Fun(self):
        pass


            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 4 Column: 1

              def Fun():
    pass

class A:
    def __init__(self):
        pass
    def Fun(self):
        pass


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 5

              class A:
    def __init__(self):
        pass
    def Fun(self):
        pass

try:
    print(Fun.__name__)
    print(A.__init__.__name__)

            

Reported by Pylint.

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

Line: 7 Column: 5

              class A:
    def __init__(self):
        pass
    def Fun(self):
        pass

try:
    print(Fun.__name__)
    print(A.__init__.__name__)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 27 Column: 1

                  pass

# name of a function that has closed over variables
def outer():
    x = 1
    def inner():
        return x
    return inner
print(outer.__name__)

            

Reported by Pylint.