The following issues were found

tests/extmod/machine_pulse.py
17 issues
Statement seems to have no effect
Error

Line: 6 Column: 5

                      import umachine as machine
    except ImportError:
        import machine
    machine.PinBase
    machine.time_pulse_us
except:
    print("SKIP")
    raise SystemExit


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 7 Column: 5

                  except ImportError:
        import machine
    machine.PinBase
    machine.time_pulse_us
except:
    print("SKIP")
    raise SystemExit



            

Reported by Pylint.

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

Line: 10 Column: 5

                  machine.time_pulse_us
except:
    print("SKIP")
    raise SystemExit


class ConstPin(machine.PinBase):
    def __init__(self, value):
        self.v = value

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    try:
        import umachine as machine
    except ImportError:
        import machine
    machine.PinBase
    machine.time_pulse_us
except:
    print("SKIP")

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 13 Column: 1

                  raise SystemExit


class ConstPin(machine.PinBase):
    def __init__(self, value):
        self.v = value

    def value(self, v=None):
        if v is None:

            

Reported by Pylint.

Missing class docstring
Error

Line: 13 Column: 1

                  raise SystemExit


class ConstPin(machine.PinBase):
    def __init__(self, value):
        self.v = value

    def value(self, v=None):
        if v is None:

            

Reported by Pylint.

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

Line: 15 Column: 9

              
class ConstPin(machine.PinBase):
    def __init__(self, value):
        self.v = value

    def value(self, v=None):
        if v is None:
            return self.v
        else:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 5

                  def __init__(self, value):
        self.v = value

    def value(self, v=None):
        if v is None:
            return self.v
        else:
            self.v = v


            

Reported by Pylint.

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

Line: 17 Column: 5

                  def __init__(self, value):
        self.v = value

    def value(self, v=None):
        if v is None:
            return self.v
        else:
            self.v = v


            

Reported by Pylint.

Either all return statements in a function should return an expression, or none of them should.
Error

Line: 17 Column: 5

                  def __init__(self, value):
        self.v = value

    def value(self, v=None):
        if v is None:
            return self.v
        else:
            self.v = v


            

Reported by Pylint.

tests/micropython/viper_ptr8_load.py
17 issues
Undefined variable 'micropython'
Error

Line: 4 Column: 2

              # test loading from ptr8 type


@micropython.viper
def get(src: ptr8) -> int:
    return src[0]


@micropython.viper

            

Reported by Pylint.

Undefined variable 'ptr8'
Error

Line: 5 Column: 14

              

@micropython.viper
def get(src: ptr8) -> int:
    return src[0]


@micropython.viper
def get1(src: ptr8) -> int:

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 9 Column: 2

                  return src[0]


@micropython.viper
def get1(src: ptr8) -> int:
    return src[1]


@micropython.viper

            

Reported by Pylint.

Undefined variable 'ptr8'
Error

Line: 10 Column: 15

              

@micropython.viper
def get1(src: ptr8) -> int:
    return src[1]


@micropython.viper
def memadd(src: ptr8, n: int) -> int:

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 14 Column: 2

                  return src[1]


@micropython.viper
def memadd(src: ptr8, n: int) -> int:
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum

            

Reported by Pylint.

Undefined variable 'ptr8'
Error

Line: 15 Column: 17

              

@micropython.viper
def memadd(src: ptr8, n: int) -> int:
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum


            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 22 Column: 2

                  return sum


@micropython.viper
def memadd2(src_in) -> int:
    src = ptr8(src_in)
    n = int(len(src_in))
    sum = 0
    for i in range(n):

            

Reported by Pylint.

Undefined variable 'ptr8'
Error

Line: 24 Column: 11

              
@micropython.viper
def memadd2(src_in) -> int:
    src = ptr8(src_in)
    n = int(len(src_in))
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum

            

Reported by Pylint.

Redefining built-in 'sum'
Error

Line: 16 Column: 5

              
@micropython.viper
def memadd(src: ptr8, n: int) -> int:
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum



            

Reported by Pylint.

Redefining built-in 'sum'
Error

Line: 26 Column: 5

              def memadd2(src_in) -> int:
    src = ptr8(src_in)
    n = int(len(src_in))
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum



            

Reported by Pylint.

tests/basics/special_comparisons.py
17 issues
Use of possibly insecure function - consider using safer ast.literal_eval.
Security blacklist

Line: 28
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b307-eval

              
def test(s):
    print(s)
    print(eval(s))

for x in 'abcd':
    for y in 'abcd':
        test('{} == {}'.format(x,y))
        test('{} != {}'.format(x,y))

            

Reported by Bandit.

Use of eval
Error

Line: 28 Column: 11

              
def test(s):
    print(s)
    print(eval(s))

for x in 'abcd':
    for y in 'abcd':
        test('{} == {}'.format(x,y))
        test('{} != {}'.format(x,y))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              class A:
    def __eq__(self, other):
        print("A __eq__ called")
        return True

class B:
    def __ne__(self, other):
        print("B __ne__ called")
        return True

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 1 Column: 1

              class A:
    def __eq__(self, other):
        print("A __eq__ called")
        return True

class B:
    def __ne__(self, other):
        print("B __ne__ called")
        return True

            

Reported by Pylint.

Missing class docstring
Error

Line: 1 Column: 1

              class A:
    def __eq__(self, other):
        print("A __eq__ called")
        return True

class B:
    def __ne__(self, other):
        print("B __ne__ called")
        return True

            

Reported by Pylint.

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

Line: 1 Column: 1

              class A:
    def __eq__(self, other):
        print("A __eq__ called")
        return True

class B:
    def __ne__(self, other):
        print("B __ne__ called")
        return True

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 6 Column: 1

                      print("A __eq__ called")
        return True

class B:
    def __ne__(self, other):
        print("B __ne__ called")
        return True

class C:

            

Reported by Pylint.

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

Line: 6 Column: 1

                      print("A __eq__ called")
        return True

class B:
    def __ne__(self, other):
        print("B __ne__ called")
        return True

class C:

            

Reported by Pylint.

Missing class docstring
Error

Line: 6 Column: 1

                      print("A __eq__ called")
        return True

class B:
    def __ne__(self, other):
        print("B __ne__ called")
        return True

class C:

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 11 Column: 1

                      print("B __ne__ called")
        return True

class C:
    def __eq__(self, other):
        print("C __eq__ called")
        return False

class D:

            

Reported by Pylint.

examples/bluetooth/ble_temperature.py
17 issues
Unable to import 'bluetooth'
Error

Line: 6 Column: 1

              # The sensor's local value updates every second, and it will notify
# any connected central every 10 seconds.

import bluetooth
import random
import struct
import time
from ble_advertising import advertising_payload


            

Reported by Pylint.

Unable to import 'micropython'
Error

Line: 12 Column: 1

              import time
from ble_advertising import advertising_payload

from micropython import const

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)
_IRQ_GATTS_INDICATE_DONE = const(20)


            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 93 Column: 9

                      temp.set_temperature(t, notify=i == 0, indicate=False)
        # Random walk the temperature.
        t += random.uniform(-0.5, 0.5)
        time.sleep_ms(1000)


if __name__ == "__main__":
    demo()

            

Reported by Pylint.

Unused variable 'status'
Error

Line: 61 Column: 40

                          # Start advertising again to allow a new connection.
            self._advertise()
        elif event == _IRQ_GATTS_INDICATE_DONE:
            conn_handle, value_handle, status = data

    def set_temperature(self, temp_deg_c, notify=False, indicate=False):
        # Data is sint16 in degrees Celsius with a resolution of 0.01 degrees Celsius.
        # Write the local value, ready for a central to read.
        self._ble.gatts_write(self._handle, struct.pack("<h", int(temp_deg_c * 100)))

            

Reported by Pylint.

Unused variable 'value_handle'
Error

Line: 61 Column: 26

                          # Start advertising again to allow a new connection.
            self._advertise()
        elif event == _IRQ_GATTS_INDICATE_DONE:
            conn_handle, value_handle, status = data

    def set_temperature(self, temp_deg_c, notify=False, indicate=False):
        # Data is sint16 in degrees Celsius with a resolution of 0.01 degrees Celsius.
        # Write the local value, ready for a central to read.
        self._ble.gatts_write(self._handle, struct.pack("<h", int(temp_deg_c * 100)))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # This example demonstrates a simple temperature sensor peripheral.
#
# The sensor's local value updates every second, and it will notify
# any connected central every 10 seconds.

import bluetooth
import random
import struct
import time

            

Reported by Pylint.

standard import "import random" should be placed before "import bluetooth"
Error

Line: 7 Column: 1

              # any connected central every 10 seconds.

import bluetooth
import random
import struct
import time
from ble_advertising import advertising_payload

from micropython import const

            

Reported by Pylint.

standard import "import struct" should be placed before "import bluetooth"
Error

Line: 8 Column: 1

              
import bluetooth
import random
import struct
import time
from ble_advertising import advertising_payload

from micropython import const


            

Reported by Pylint.

standard import "import time" should be placed before "import bluetooth"
Error

Line: 9 Column: 1

              import bluetooth
import random
import struct
import time
from ble_advertising import advertising_payload

from micropython import const

_IRQ_CENTRAL_CONNECT = const(1)

            

Reported by Pylint.

third party import "from micropython import const" should be placed before "import bluetooth"
Error

Line: 12 Column: 1

              import time
from ble_advertising import advertising_payload

from micropython import const

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)
_IRQ_GATTS_INDICATE_DONE = const(20)


            

Reported by Pylint.

tests/micropython/viper_ptr16_load.py
17 issues
Undefined variable 'micropython'
Error

Line: 5 Column: 2

              # only works on little endian machines


@micropython.viper
def get(src: ptr16) -> int:
    return src[0]


@micropython.viper

            

Reported by Pylint.

Undefined variable 'ptr16'
Error

Line: 6 Column: 14

              

@micropython.viper
def get(src: ptr16) -> int:
    return src[0]


@micropython.viper
def get1(src: ptr16) -> int:

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 10 Column: 2

                  return src[0]


@micropython.viper
def get1(src: ptr16) -> int:
    return src[1]


@micropython.viper

            

Reported by Pylint.

Undefined variable 'ptr16'
Error

Line: 11 Column: 15

              

@micropython.viper
def get1(src: ptr16) -> int:
    return src[1]


@micropython.viper
def memadd(src: ptr16, n: int) -> int:

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 15 Column: 2

                  return src[1]


@micropython.viper
def memadd(src: ptr16, n: int) -> int:
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum

            

Reported by Pylint.

Undefined variable 'ptr16'
Error

Line: 16 Column: 17

              

@micropython.viper
def memadd(src: ptr16, n: int) -> int:
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum


            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 23 Column: 2

                  return sum


@micropython.viper
def memadd2(src_in) -> int:
    src = ptr16(src_in)
    n = int(len(src_in)) >> 1
    sum = 0
    for i in range(n):

            

Reported by Pylint.

Undefined variable 'ptr16'
Error

Line: 25 Column: 11

              
@micropython.viper
def memadd2(src_in) -> int:
    src = ptr16(src_in)
    n = int(len(src_in)) >> 1
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum

            

Reported by Pylint.

Redefining built-in 'sum'
Error

Line: 17 Column: 5

              
@micropython.viper
def memadd(src: ptr16, n: int) -> int:
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum



            

Reported by Pylint.

Redefining built-in 'sum'
Error

Line: 27 Column: 5

              def memadd2(src_in) -> int:
    src = ptr16(src_in)
    n = int(len(src_in)) >> 1
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum



            

Reported by Pylint.

examples/bluetooth/ble_simple_peripheral.py
17 issues
Unable to import 'bluetooth'
Error

Line: 3 Column: 1

              # This example demonstrates a UART periperhal.

import bluetooth
import random
import struct
import time
from ble_advertising import advertising_payload

from micropython import const

            

Reported by Pylint.

Unable to import 'micropython'
Error

Line: 9 Column: 1

              import time
from ble_advertising import advertising_payload

from micropython import const

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)
_IRQ_GATTS_WRITE = const(3)


            

Reported by Pylint.

Module 'time' has no 'sleep_ms' member
Error

Line: 97 Column: 9

                              print("TX", data)
                p.send(data)
                i += 1
        time.sleep_ms(100)


if __name__ == "__main__":
    demo()

            

Reported by Pylint.

Unused import random
Error

Line: 4 Column: 1

              # This example demonstrates a UART periperhal.

import bluetooth
import random
import struct
import time
from ble_advertising import advertising_payload

from micropython import const

            

Reported by Pylint.

Unused import struct
Error

Line: 5 Column: 1

              
import bluetooth
import random
import struct
import time
from ble_advertising import advertising_payload

from micropython import const


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # This example demonstrates a UART periperhal.

import bluetooth
import random
import struct
import time
from ble_advertising import advertising_payload

from micropython import const

            

Reported by Pylint.

standard import "import random" should be placed before "import bluetooth"
Error

Line: 4 Column: 1

              # This example demonstrates a UART periperhal.

import bluetooth
import random
import struct
import time
from ble_advertising import advertising_payload

from micropython import const

            

Reported by Pylint.

standard import "import struct" should be placed before "import bluetooth"
Error

Line: 5 Column: 1

              
import bluetooth
import random
import struct
import time
from ble_advertising import advertising_payload

from micropython import const


            

Reported by Pylint.

standard import "import time" should be placed before "import bluetooth"
Error

Line: 6 Column: 1

              import bluetooth
import random
import struct
import time
from ble_advertising import advertising_payload

from micropython import const

_IRQ_CENTRAL_CONNECT = const(1)

            

Reported by Pylint.

third party import "from micropython import const" should be placed before "import bluetooth"
Error

Line: 9 Column: 1

              import time
from ble_advertising import advertising_payload

from micropython import const

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)
_IRQ_GATTS_WRITE = const(3)


            

Reported by Pylint.

tests/basics/del_global.py
17 issues
Undefined variable 'x'
Error

Line: 5 Column: 9

              
def do_del():
    global x
    del x

x = 1
print(x)
do_del()
try:

            

Reported by Pylint.

Using the global statement
Error

Line: 4 Column: 5

              # del global

def do_del():
    global x
    del x

x = 1
print(x)
do_del()

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 16 Column: 1

                  print("NameError")
try:
    do_del()
except: # NameError:
    # FIXME uPy returns KeyError for this
    print("NameError")

# delete globals using a list


            

Reported by Pylint.

FIXME uPy returns KeyError for this
Error

Line: 17 Column: 3

              try:
    do_del()
except: # NameError:
    # FIXME uPy returns KeyError for this
    print("NameError")

# delete globals using a list

a = 1

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # del global

def do_del():
    global x
    del x

x = 1
print(x)
do_del()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 3 Column: 1

              # del global

def do_del():
    global x
    del x

x = 1
print(x)
do_del()

            

Reported by Pylint.

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

Line: 4 Column: 5

              # del global

def do_del():
    global x
    del x

x = 1
print(x)
do_del()

            

Reported by Pylint.

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

Line: 7 Column: 1

                  global x
    del x

x = 1
print(x)
do_del()
try:
    print(x)
except NameError:

            

Reported by Pylint.

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

Line: 22 Column: 1

              
# delete globals using a list

a = 1
del (a,)
try:
    print(a)
except NameError:
    print("NameError")

            

Reported by Pylint.

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

Line: 29 Column: 1

              except NameError:
    print("NameError")

a = 2
b = 3
del (a, b)
try:
    print(a)
except NameError:

            

Reported by Pylint.

tests/micropython/viper_ptr32_load.py
17 issues
Undefined variable 'micropython'
Error

Line: 4 Column: 2

              # test loading from ptr32 type


@micropython.viper
def get(src: ptr32) -> int:
    return src[0]


@micropython.viper

            

Reported by Pylint.

Undefined variable 'ptr32'
Error

Line: 5 Column: 14

              

@micropython.viper
def get(src: ptr32) -> int:
    return src[0]


@micropython.viper
def get1(src: ptr32) -> int:

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 9 Column: 2

                  return src[0]


@micropython.viper
def get1(src: ptr32) -> int:
    return src[1]


@micropython.viper

            

Reported by Pylint.

Undefined variable 'ptr32'
Error

Line: 10 Column: 15

              

@micropython.viper
def get1(src: ptr32) -> int:
    return src[1]


@micropython.viper
def memadd(src: ptr32, n: int) -> int:

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 14 Column: 2

                  return src[1]


@micropython.viper
def memadd(src: ptr32, n: int) -> int:
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum

            

Reported by Pylint.

Undefined variable 'ptr32'
Error

Line: 15 Column: 17

              

@micropython.viper
def memadd(src: ptr32, n: int) -> int:
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum


            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 22 Column: 2

                  return sum


@micropython.viper
def memadd2(src_in) -> int:
    src = ptr32(src_in)
    n = int(len(src_in)) >> 2
    sum = 0
    for i in range(n):

            

Reported by Pylint.

Undefined variable 'ptr32'
Error

Line: 24 Column: 11

              
@micropython.viper
def memadd2(src_in) -> int:
    src = ptr32(src_in)
    n = int(len(src_in)) >> 2
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum

            

Reported by Pylint.

Redefining built-in 'sum'
Error

Line: 16 Column: 5

              
@micropython.viper
def memadd(src: ptr32, n: int) -> int:
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum



            

Reported by Pylint.

Redefining built-in 'sum'
Error

Line: 26 Column: 5

              def memadd2(src_in) -> int:
    src = ptr32(src_in)
    n = int(len(src_in)) >> 2
    sum = 0
    for i in range(n):
        sum += src[i]
    return sum



            

Reported by Pylint.

tests/basics/try_finally2.py
17 issues
Unused argument 'b'
Error

Line: 3 Column: 11

              # check that the Python stack does not overflow when the finally
# block itself uses more stack than the rest of the function
def f1(a, b):
    pass
def test1():
    val = 1
    try:
        raise ValueError()
    finally:

            

Reported by Pylint.

Unused argument 'a'
Error

Line: 3 Column: 8

              # check that the Python stack does not overflow when the finally
# block itself uses more stack than the rest of the function
def f1(a, b):
    pass
def test1():
    val = 1
    try:
        raise ValueError()
    finally:

            

Reported by Pylint.

Unused argument 'c'
Error

Line: 18 Column: 14

                  pass

# same as above but with 3 args instead of 2, to use an extra stack entry
def f2(a, b, c):
    pass
def test2():
    val = 1
    try:
        raise ValueError()

            

Reported by Pylint.

Unused argument 'b'
Error

Line: 18 Column: 11

                  pass

# same as above but with 3 args instead of 2, to use an extra stack entry
def f2(a, b, c):
    pass
def test2():
    val = 1
    try:
        raise ValueError()

            

Reported by Pylint.

Unused argument 'a'
Error

Line: 18 Column: 8

                  pass

# same as above but with 3 args instead of 2, to use an extra stack entry
def f2(a, b, c):
    pass
def test2():
    val = 1
    try:
        raise ValueError()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # check that the Python stack does not overflow when the finally
# block itself uses more stack than the rest of the function
def f1(a, b):
    pass
def test1():
    val = 1
    try:
        raise ValueError()
    finally:

            

Reported by Pylint.

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

Line: 3 Column: 1

              # check that the Python stack does not overflow when the finally
# block itself uses more stack than the rest of the function
def f1(a, b):
    pass
def test1():
    val = 1
    try:
        raise ValueError()
    finally:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 3 Column: 1

              # check that the Python stack does not overflow when the finally
# block itself uses more stack than the rest of the function
def f1(a, b):
    pass
def test1():
    val = 1
    try:
        raise ValueError()
    finally:

            

Reported by Pylint.

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

Line: 3 Column: 1

              # check that the Python stack does not overflow when the finally
# block itself uses more stack than the rest of the function
def f1(a, b):
    pass
def test1():
    val = 1
    try:
        raise ValueError()
    finally:

            

Reported by Pylint.

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

Line: 3 Column: 1

              # check that the Python stack does not overflow when the finally
# block itself uses more stack than the rest of the function
def f1(a, b):
    pass
def test1():
    val = 1
    try:
        raise ValueError()
    finally:

            

Reported by Pylint.

py/makeqstrdata.py
17 issues
Unable to import 'htmlentitydefs'
Error

Line: 19 Column: 5

              
if platform.python_version_tuple()[0] == "2":
    bytes_cons = lambda val, enc=None: bytearray(val)
    from htmlentitydefs import codepoint2name
elif platform.python_version_tuple()[0] == "3":
    bytes_cons = bytes
    from html.entities import codepoint2name
# end compatibility code


            

Reported by Pylint.

Redefining built-in 'hash'
Error

Line: 227 Column: 5

              
# this must match the equivalent function in qstr.c
def compute_hash(qstr, bytes_hash):
    hash = 5381
    for b in qstr:
        hash = (hash * 33) ^ b
    # Make sure that valid hash is never zero, zero means "hash not computed"
    return (hash & ((1 << (8 * bytes_hash)) - 1)) or 1


            

Reported by Pylint.

Unused variable 'order'
Error

Line: 358 Column: 9

                  )

    # go through each qstr and print it out
    for order, ident, qstr in sorted(qstrs.values(), key=lambda x: x[0]):
        qbytes = make_bytes(cfg_bytes_len, cfg_bytes_hash, qstr)
        print("QDEF(MP_QSTR_%s, %s)" % (ident, qbytes))


def do_work(infiles):

            

Reported by Pylint.

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

Line: 21 Column: 5

                  bytes_cons = lambda val, enc=None: bytearray(val)
    from htmlentitydefs import codepoint2name
elif platform.python_version_tuple()[0] == "3":
    bytes_cons = bytes
    from html.entities import codepoint2name
# end compatibility code

codepoint2name[ord("-")] = "hyphen"


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 226 Column: 1

              ]

# this must match the equivalent function in qstr.c
def compute_hash(qstr, bytes_hash):
    hash = 5381
    for b in qstr:
        hash = (hash * 33) ^ b
    # Make sure that valid hash is never zero, zero means "hash not computed"
    return (hash & ((1 << (8 * bytes_hash)) - 1)) or 1

            

Reported by Pylint.

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

Line: 228 Column: 9

              # this must match the equivalent function in qstr.c
def compute_hash(qstr, bytes_hash):
    hash = 5381
    for b in qstr:
        hash = (hash * 33) ^ b
    # Make sure that valid hash is never zero, zero means "hash not computed"
    return (hash & ((1 << (8 * bytes_hash)) - 1)) or 1



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 234 Column: 1

                  return (hash & ((1 << (8 * bytes_hash)) - 1)) or 1


def qstr_escape(qst):
    def esc_char(m):
        c = ord(m.group(0))
        try:
            name = codepoint2name[c]
        except KeyError:

            

Reported by Pylint.

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

Line: 235 Column: 5

              

def qstr_escape(qst):
    def esc_char(m):
        c = ord(m.group(0))
        try:
            name = codepoint2name[c]
        except KeyError:
            name = "0x%02x" % c

            

Reported by Pylint.

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

Line: 236 Column: 9

              
def qstr_escape(qst):
    def esc_char(m):
        c = ord(m.group(0))
        try:
            name = codepoint2name[c]
        except KeyError:
            name = "0x%02x" % c
        return "_" + name + "_"

            

Reported by Pylint.

Too many branches (13/12)
Error

Line: 246 Column: 1

                  return re.sub(r"[^A-Za-z0-9_]", esc_char, qst)


def parse_input_headers(infiles):
    qcfgs = {}
    qstrs = {}

    # add static qstrs
    for qstr in static_qstr_list:

            

Reported by Pylint.