The following issues were found

tests/extmod/vfs_fat_fileio2.py
21 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 6 Column: 5

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

try:
    uos.VfsFat
except AttributeError:
    print("SKIP")

            

Reported by Pylint.

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

Line: 12 Column: 5

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


class RAMFS:

    SEC_SIZE = 512

            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 32 Column: 25

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

    def ioctl(self, op, arg):
        # print("ioctl(%d, %r)" % (op, arg))
        if op == 4:  # MP_BLOCKDEV_IOCTL_BLOCK_COUNT
            return len(self.data) // self.SEC_SIZE
        if op == 5:  # MP_BLOCKDEV_IOCTL_BLOCK_SIZE
            return self.SEC_SIZE

            

Reported by Pylint.

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

Line: 44 Column: 5

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

uos.VfsFat.mkfs(bdev)
vfs = uos.VfsFat(bdev)
uos.mount(vfs, "/ramdisk")
uos.chdir("/ramdisk")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    import uerrno
    import uos
except ImportError:
    print("SKIP")
    raise SystemExit

try:
    uos.VfsFat

            

Reported by Pylint.

Missing class docstring
Error

Line: 15 Column: 1

                  raise SystemExit


class RAMFS:

    SEC_SIZE = 512

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

            

Reported by Pylint.

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

Line: 22 Column: 5

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

    def readblocks(self, n, buf):
        # print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))
        for i in range(len(buf)):
            buf[i] = self.data[n * self.SEC_SIZE + i]

    def writeblocks(self, n, buf):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 22 Column: 5

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

    def readblocks(self, n, buf):
        # print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))
        for i in range(len(buf)):
            buf[i] = self.data[n * self.SEC_SIZE + i]

    def writeblocks(self, n, buf):

            

Reported by Pylint.

Consider using enumerate instead of iterating with range and len
Error

Line: 24 Column: 9

              
    def readblocks(self, n, buf):
        # print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))
        for i in range(len(buf)):
            buf[i] = self.data[n * self.SEC_SIZE + i]

    def writeblocks(self, n, buf):
        # print("writeblocks(%s, %x)" % (n, id(buf)))
        for i in range(len(buf)):

            

Reported by Pylint.

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

Line: 27 Column: 5

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

    def writeblocks(self, n, buf):
        # print("writeblocks(%s, %x)" % (n, id(buf)))
        for i in range(len(buf)):
            self.data[n * self.SEC_SIZE + i] = buf[i]

    def ioctl(self, op, arg):

            

Reported by Pylint.

tests/basics/int_big1.py
21 issues
Unnecessary semicolon
Error

Line: 77 Column: 1

              try:
    print(int("123456789012345678901234567890abcdef"))
except ValueError:
    print('ValueError');
try:
    print(int("123456789012345678901234567890\x01"))
except ValueError:
    print('ValueError');


            

Reported by Pylint.

Unnecessary semicolon
Error

Line: 81 Column: 1

              try:
    print(int("123456789012345678901234567890\x01"))
except ValueError:
    print('ValueError');

# test constant integer with more than 255 chars
x = 0x84ce72aa8699df436059f052ac51b6398d2511e49631bcb7e71f89c499b9ee425dfbc13a5f6d408471b054f2655617cbbaf7937b7c80cd8865cf02c8487d30d2b0fbd8b2c4e102e16d828374bbc47b93852f212d5043c3ea720f086178ff798cc4f63f787b9c2e419efa033e7644ea7936f54462dc21a6c4580725f7f0e7d1aaaaaaa
print(x)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # to test arbitrariy precision integers

x = 1000000000000000000000000000000
xn = -1000000000000000000000000000000
y = 2000000000000000000000000000000

# printing
print(x)
print(y)

            

Reported by Pylint.

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

Line: 3 Column: 1

              # to test arbitrariy precision integers

x = 1000000000000000000000000000000
xn = -1000000000000000000000000000000
y = 2000000000000000000000000000000

# printing
print(x)
print(y)

            

Reported by Pylint.

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

Line: 4 Column: 1

              # to test arbitrariy precision integers

x = 1000000000000000000000000000000
xn = -1000000000000000000000000000000
y = 2000000000000000000000000000000

# printing
print(x)
print(y)

            

Reported by Pylint.

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

Line: 5 Column: 1

              
x = 1000000000000000000000000000000
xn = -1000000000000000000000000000000
y = 2000000000000000000000000000000

# printing
print(x)
print(y)
print('%#X' % (x - x)) # print prefix

            

Reported by Pylint.

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

Line: 39 Column: 1

              print(~(-x))

# left shift
x = 0x10000000000000000000000
for i in range(32):
    x = x << 1
    print(x)

# right shift

            

Reported by Pylint.

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

Line: 41 Column: 5

              # left shift
x = 0x10000000000000000000000
for i in range(32):
    x = x << 1
    print(x)

# right shift
x = 0x10000000000000000000000
for i in range(32):

            

Reported by Pylint.

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

Line: 45 Column: 1

                  print(x)

# right shift
x = 0x10000000000000000000000
for i in range(32):
    x = x >> 1
    print(x)

# left shift of a negative number

            

Reported by Pylint.

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

Line: 47 Column: 5

              # right shift
x = 0x10000000000000000000000
for i in range(32):
    x = x >> 1
    print(x)

# left shift of a negative number
for i in range(8):
    print(-10000000000000000000000000 << i)

            

Reported by Pylint.

tests/extmod/vfs_fat_more.py
21 issues
Unable to import 'usys'
Error

Line: 114 Column: 1

              print(uos.listdir("sys"))

# test importing a file from a mounted FS
import usys

usys.path.clear()
usys.path.append("/sys")
with open("sys/test_module.py", "w") as f:
    f.write('print("test_module!")')

            

Reported by Pylint.

Unable to import 'test_module'
Error

Line: 120 Column: 1

              usys.path.append("/sys")
with open("sys/test_module.py", "w") as f:
    f.write('print("test_module!")')
import test_module

            

Reported by Pylint.

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

Line: 5 Column: 5

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

try:
    uos.VfsFat
except AttributeError:
    print("SKIP")

            

Reported by Pylint.

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

Line: 11 Column: 5

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


class RAMFS:

    SEC_SIZE = 512

            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 31 Column: 25

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

    def ioctl(self, op, arg):
        # print("ioctl(%d, %r)" % (op, arg))
        if op == 4:  # MP_BLOCKDEV_IOCTL_BLOCK_COUNT
            return len(self.data) // self.SEC_SIZE
        if op == 5:  # MP_BLOCKDEV_IOCTL_BLOCK_SIZE
            return self.SEC_SIZE

            

Reported by Pylint.

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

Line: 44 Column: 5

                  bdev2 = RAMFS(50)
except MemoryError:
    print("SKIP")
    raise SystemExit

# first we umount any existing mount points the target may have
try:
    uos.umount("/")
except OSError:

            

Reported by Pylint.

Unused import test_module
Error

Line: 120 Column: 1

              usys.path.append("/sys")
with open("sys/test_module.py", "w") as f:
    f.write('print("test_module!")')
import test_module

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    import uos
except ImportError:
    print("SKIP")
    raise SystemExit

try:
    uos.VfsFat
except AttributeError:

            

Reported by Pylint.

Missing class docstring
Error

Line: 14 Column: 1

                  raise SystemExit


class RAMFS:

    SEC_SIZE = 512

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

            

Reported by Pylint.

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

Line: 21 Column: 5

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

    def readblocks(self, n, buf):
        # print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))
        for i in range(len(buf)):
            buf[i] = self.data[n * self.SEC_SIZE + i]

    def writeblocks(self, n, buf):

            

Reported by Pylint.

tests/wipy/uart.py
21 issues
Unable to import 'machine'
Error

Line: 6 Column: 1

              UART0 and UART1 must be connected together for this test to pass.
"""

from machine import UART
from machine import Pin
import os
import time

mch = os.uname().machine

            

Reported by Pylint.

Unable to import 'machine'
Error

Line: 7 Column: 1

              """

from machine import UART
from machine import Pin
import os
import time

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

            

Reported by Pylint.

Module 'os' has no 'uname' member
Error

Line: 11 Column: 7

              import os
import time

mch = os.uname().machine
if "LaunchPad" in mch:
    uart_id_range = range(0, 2)
    uart_pins = [
        [("GP12", "GP13"), ("GP12", "GP13", "GP7", "GP6")],
        [("GP16", "GP17"), ("GP16", "GP17", "GP7", "GP6")],

            

Reported by Pylint.

Module 'os' has no 'dupterm' member
Error

Line: 28 Column: 1

                  raise Exception("Board not supported!")

# just in case we have the repl duplicated on any of the uarts
os.dupterm(None)

for uart_id in uart_id_range:
    uart = UART(uart_id, 38400)
    print(uart)
    uart.init(57600, 8, None, 1, pins=uart_pins[uart_id][0])

            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 75 Column: 1

              # try initializing without the id
uart0 = UART(baudrate=1000000, pins=uart_pins[0][0])
uart0.write(b"1234567890")
time.sleep_ms(2)  # because of the fifo interrupt levels
print(uart1.any() == 10)
print(uart1.readline() == b"1234567890")
print(uart1.any() == 0)

uart0.write(b"1234567890")

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 121 Column: 8

              # next ones must raise
try:
    UART(0, 9600, parity=None, pins=("GP12", "GP13", "GP7"))
except Exception:
    print("Exception")

try:
    UART(0, 9600, parity=UART.ODD, pins=("GP12", "GP7"))
except Exception:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 126 Column: 8

              
try:
    UART(0, 9600, parity=UART.ODD, pins=("GP12", "GP7"))
except Exception:
    print("Exception")

uart0 = UART(0, 1000000)
uart0.deinit()
try:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 133 Column: 8

              uart0.deinit()
try:
    uart0.any()
except Exception:
    print("Exception")

try:
    uart0.read()
except Exception:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 138 Column: 8

              
try:
    uart0.read()
except Exception:
    print("Exception")

try:
    uart0.write("abc")
except Exception:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 143 Column: 8

              
try:
    uart0.write("abc")
except Exception:
    print("Exception")

try:
    uart0.sendbreak("abc")
except Exception:

            

Reported by Pylint.

docs/conf.py
21 issues
Unable to import 'sphinx_rtd_theme'
Error

Line: 131 Column: 9

              
if not on_rtd:  # only import and set the theme if we're building docs locally
    try:
        import sphinx_rtd_theme
        html_theme = 'sphinx_rtd_theme'
        html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
    except:
        html_theme = 'default'
        html_theme_path = ['.']

            

Reported by Pylint.

Redefining built-in 'copyright'
Error

Line: 69 Column: 1

              
# General information about the project.
project = 'MicroPython'
copyright = '- The MicroPython Documentation is Copyright © 2014-2021, Damien P. George, Paul Sokolovsky, and contributors'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 134 Column: 5

                      import sphinx_rtd_theme
        html_theme = 'sphinx_rtd_theme'
        html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
    except:
        html_theme = 'default'
        html_theme_path = ['.']
else:
    html_theme_path = ['.']


            

Reported by Pylint.

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

Line: 231 Column: 14

              # Additional stuff for the LaTeX preamble.
#'preamble': '',
# Include 3 levels of headers in PDF ToC
'preamble': '\setcounter{tocdepth}{2}',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
#  author, documentclass [howto, manual, or own class]).

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# MicroPython documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 21 11:42:03 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#

            

Reported by Pylint.

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

Line: 59 Column: 1

              templates_path = ['templates']

# The suffix of source filenames.
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.

            

Reported by Pylint.

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

Line: 65 Column: 1

              #source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'MicroPython'
copyright = '- The MicroPython Documentation is Copyright © 2014-2021, Damien P. George, Paul Sokolovsky, and contributors'


            

Reported by Pylint.

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

Line: 68 Column: 1

              master_doc = 'index'

# General information about the project.
project = 'MicroPython'
copyright = '- The MicroPython Documentation is Copyright © 2014-2021, Damien P. George, Paul Sokolovsky, and contributors'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.

            

Reported by Pylint.

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

Line: 69 Column: 1

              
# General information about the project.
project = 'MicroPython'
copyright = '- The MicroPython Documentation is Copyright © 2014-2021, Damien P. George, Paul Sokolovsky, and contributors'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#

            

Reported by Pylint.

Line too long (123/100)
Error

Line: 69 Column: 1

              
# General information about the project.
project = 'MicroPython'
copyright = '- The MicroPython Documentation is Copyright © 2014-2021, Damien P. George, Paul Sokolovsky, and contributors'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#

            

Reported by Pylint.

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

Line: 40 Column: 5

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

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

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


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 103 Column: 1

              cud2 = Cud()

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

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 104 Column: 1

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

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 105 Column: 1

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

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 106 Column: 1

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

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 107 Column: 1

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

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 108 Column: 1

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

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 109 Column: 1

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

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 110 Column: 1

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


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 111 Column: 1

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

class BadInt:

            

Reported by Pylint.

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

Line: 12 Column: 1

              print(f()())

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

            

Reported by Pylint.

function already defined line 4
Error

Line: 22 Column: 1

              print(f()()())

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

            

Reported by Pylint.

Using variable 'x' before assignment
Error

Line: 25 Column: 9

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

            

Reported by Pylint.

Unused variable 'x'
Error

Line: 23 Column: 5

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

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 25 Column: 9

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

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test implicit scoping rules

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

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 4 Column: 1

              # test implicit scoping rules

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

            

Reported by Pylint.

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

Line: 4 Column: 1

              # test implicit scoping rules

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

            

Reported by Pylint.

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

Line: 5 Column: 5

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


            

Reported by Pylint.

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

Line: 7 Column: 5

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

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

            

Reported by Pylint.

drivers/onewire/onewire.py
20 issues
Unable to import '_onewire'
Error

Line: 4 Column: 1

              # 1-Wire driver for MicroPython
# MIT license; Copyright (c) 2016 Damien P. George

import _onewire as _ow


class OneWireError(Exception):
    pass


            

Reported by Pylint.

Unused variable 'i'
Error

Line: 55 Column: 13

                      devices = []
        diff = 65
        rom = False
        for i in range(0xFF):
            rom, diff = self._search_rom(rom, diff)
            if rom:
                devices += [rom]
            if diff == 0:
                break

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # 1-Wire driver for MicroPython
# MIT license; Copyright (c) 2016 Damien P. George

import _onewire as _ow


class OneWireError(Exception):
    pass


            

Reported by Pylint.

Missing class docstring
Error

Line: 7 Column: 1

              import _onewire as _ow


class OneWireError(Exception):
    pass


class OneWire:
    SEARCH_ROM = 0xF0

            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 1

                  pass


class OneWire:
    SEARCH_ROM = 0xF0
    MATCH_ROM = 0x55
    SKIP_ROM = 0xCC

    def __init__(self, pin):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 20 Column: 5

                      self.pin = pin
        self.pin.init(pin.OPEN_DRAIN, pin.PULL_UP)

    def reset(self, required=False):
        reset = _ow.reset(self.pin)
        if required and not reset:
            raise OneWireError
        return reset


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 26 Column: 5

                          raise OneWireError
        return reset

    def readbit(self):
        return _ow.readbit(self.pin)

    def readbyte(self):
        return _ow.readbyte(self.pin)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 29 Column: 5

                  def readbit(self):
        return _ow.readbit(self.pin)

    def readbyte(self):
        return _ow.readbyte(self.pin)

    def readinto(self, buf):
        for i in range(len(buf)):
            buf[i] = _ow.readbyte(self.pin)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 32 Column: 5

                  def readbyte(self):
        return _ow.readbyte(self.pin)

    def readinto(self, buf):
        for i in range(len(buf)):
            buf[i] = _ow.readbyte(self.pin)

    def writebit(self, value):
        return _ow.writebit(self.pin, value)

            

Reported by Pylint.

Consider using enumerate instead of iterating with range and len
Error

Line: 33 Column: 9

                      return _ow.readbyte(self.pin)

    def readinto(self, buf):
        for i in range(len(buf)):
            buf[i] = _ow.readbyte(self.pin)

    def writebit(self, value):
        return _ow.writebit(self.pin, value)


            

Reported by Pylint.

tests/inlineasm/asmit.py
20 issues
Undefined variable 'micropython'
Error

Line: 4 Column: 2

              # test it instruction


@micropython.asm_thumb
def f(r0, r1):
    cmp(r0, r1)
    it(eq)
    mov(r0, 100)


            

Reported by Pylint.

Undefined variable 'cmp'
Error

Line: 6 Column: 5

              
@micropython.asm_thumb
def f(r0, r1):
    cmp(r0, r1)
    it(eq)
    mov(r0, 100)


print(f(0, 0), f(1, 2))

            

Reported by Pylint.

Undefined variable 'eq'
Error

Line: 7 Column: 8

              @micropython.asm_thumb
def f(r0, r1):
    cmp(r0, r1)
    it(eq)
    mov(r0, 100)


print(f(0, 0), f(1, 2))


            

Reported by Pylint.

Undefined variable 'it'
Error

Line: 7 Column: 5

              @micropython.asm_thumb
def f(r0, r1):
    cmp(r0, r1)
    it(eq)
    mov(r0, 100)


print(f(0, 0), f(1, 2))


            

Reported by Pylint.

Undefined variable 'mov'
Error

Line: 8 Column: 5

              def f(r0, r1):
    cmp(r0, r1)
    it(eq)
    mov(r0, 100)


print(f(0, 0), f(1, 2))



            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 14 Column: 2

              print(f(0, 0), f(1, 2))


@micropython.asm_thumb
def g(r0, r1):
    cmp(r0, r1)
    ite(eq)
    mov(r0, 100)
    mov(r0, 200)

            

Reported by Pylint.

Undefined variable 'cmp'
Error

Line: 16 Column: 5

              
@micropython.asm_thumb
def g(r0, r1):
    cmp(r0, r1)
    ite(eq)
    mov(r0, 100)
    mov(r0, 200)



            

Reported by Pylint.

Undefined variable 'eq'
Error

Line: 17 Column: 9

              @micropython.asm_thumb
def g(r0, r1):
    cmp(r0, r1)
    ite(eq)
    mov(r0, 100)
    mov(r0, 200)


print(g(0, 0), g(0, 1))

            

Reported by Pylint.

Undefined variable 'ite'
Error

Line: 17 Column: 5

              @micropython.asm_thumb
def g(r0, r1):
    cmp(r0, r1)
    ite(eq)
    mov(r0, 100)
    mov(r0, 200)


print(g(0, 0), g(0, 1))

            

Reported by Pylint.

Undefined variable 'mov'
Error

Line: 18 Column: 5

              def g(r0, r1):
    cmp(r0, r1)
    ite(eq)
    mov(r0, 100)
    mov(r0, 200)


print(g(0, 0), g(0, 1))

            

Reported by Pylint.

tests/stress/qstr_limit.py
20 issues
Use of exec detected.
Security

Line: 14
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html

                  g = {}
    var = make_id(l)
    try:
        exec(var + "=1", g)
    except RuntimeError:
        print("RuntimeError", l)
        continue
    print(var in g)


            

Reported by Bandit.

Use of exec
Error

Line: 14 Column: 9

                  g = {}
    var = make_id(l)
    try:
        exec(var + "=1", g)
    except RuntimeError:
        print("RuntimeError", l)
        continue
    print(var in g)


            

Reported by Pylint.

Use of exec
Error

Line: 27 Column: 9

              
for l in range(254, 259):
    try:
        exec("f({}=1)".format(make_id(l)))
    except RuntimeError:
        print("RuntimeError", l)

# type construction
for l in range(254, 259):

            

Reported by Pylint.

Use of exec detected.
Security

Line: 27
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html

              
for l in range(254, 259):
    try:
        exec("f({}=1)".format(make_id(l)))
    except RuntimeError:
        print("RuntimeError", l)

# type construction
for l in range(254, 259):

            

Reported by Bandit.

Redefining built-in 'id'
Error

Line: 33 Column: 5

              
# type construction
for l in range(254, 259):
    id = make_id(l)
    try:
        print(type(id, (), {}).__name__)
    except RuntimeError:
        print("RuntimeError", l)


            

Reported by Pylint.

Use of exec
Error

Line: 85 Column: 9

              # import package
for l in (100, 101, 102, 128, 129):
    try:
        exec("import " + make_id(l) + "." + make_id(l, "A"))
    except ImportError:
        print("ok", l)
    except RuntimeError:
        print("RuntimeError", l)

            

Reported by Pylint.

Use of exec detected.
Security

Line: 85
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html

              # import package
for l in (100, 101, 102, 128, 129):
    try:
        exec("import " + make_id(l) + "." + make_id(l, "A"))
    except ImportError:
        print("ok", l)
    except RuntimeError:
        print("RuntimeError", l)

            

Reported by Bandit.

Missing module docstring
Error

Line: 1 Column: 1

              # Test interning qstrs that go over the limit of the maximum qstr length
# (which is 255 bytes for the default configuration)


def make_id(n, base="a"):
    return "".join(chr(ord(base) + i % 26) for i in range(n))


# identifiers in parser

            

Reported by Pylint.

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

Line: 5 Column: 1

              # (which is 255 bytes for the default configuration)


def make_id(n, base="a"):
    return "".join(chr(ord(base) + i % 26) for i in range(n))


# identifiers in parser
for l in range(254, 259):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 1

              # (which is 255 bytes for the default configuration)


def make_id(n, base="a"):
    return "".join(chr(ord(base) + i % 26) for i in range(n))


# identifiers in parser
for l in range(254, 259):

            

Reported by Pylint.