The following issues were found

tests/micropython/viper_ptr16_store.py
16 issues
Undefined variable 'micropython'
Error

Line: 4 Column: 2

              # test ptr16 type


@micropython.viper
def set(dest: ptr16, val: int):
    dest[0] = val


@micropython.viper

            

Reported by Pylint.

Undefined variable 'ptr16'
Error

Line: 5 Column: 15

              

@micropython.viper
def set(dest: ptr16, val: int):
    dest[0] = val


@micropython.viper
def set1(dest: ptr16, val: int):

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 9 Column: 2

                  dest[0] = val


@micropython.viper
def set1(dest: ptr16, val: int):
    dest[1] = val


@micropython.viper

            

Reported by Pylint.

Undefined variable 'ptr16'
Error

Line: 10 Column: 16

              

@micropython.viper
def set1(dest: ptr16, val: int):
    dest[1] = val


@micropython.viper
def memset(dest: ptr16, val: int, n: int):

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 14 Column: 2

                  dest[1] = val


@micropython.viper
def memset(dest: ptr16, val: int, n: int):
    for i in range(n):
        dest[i] = val



            

Reported by Pylint.

Undefined variable 'ptr16'
Error

Line: 15 Column: 18

              

@micropython.viper
def memset(dest: ptr16, val: int, n: int):
    for i in range(n):
        dest[i] = val


@micropython.viper

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 20 Column: 2

                      dest[i] = val


@micropython.viper
def memset2(dest_in, val: int):
    dest = ptr16(dest_in)
    n = int(len(dest_in)) >> 1
    for i in range(n):
        dest[i] = val

            

Reported by Pylint.

Undefined variable 'ptr16'
Error

Line: 22 Column: 12

              
@micropython.viper
def memset2(dest_in, val: int):
    dest = ptr16(dest_in)
    n = int(len(dest_in)) >> 1
    for i in range(n):
        dest[i] = val



            

Reported by Pylint.

Redefining built-in 'set'
Error

Line: 5 Column: 1

              

@micropython.viper
def set(dest: ptr16, val: int):
    dest[0] = val


@micropython.viper
def set1(dest: ptr16, val: int):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test ptr16 type


@micropython.viper
def set(dest: ptr16, val: int):
    dest[0] = val


@micropython.viper

            

Reported by Pylint.

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

Line: 7 Column: 5

                  object.__new__
except AttributeError:
    print("SKIP")
    raise SystemExit

class A:
    def __new__(cls):
        print("A.__new__")
        return super(cls, A).__new__(cls)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    # If we don't expose object.__new__ (small ports), there's
    # nothing to test.
    object.__new__
except AttributeError:
    print("SKIP")
    raise SystemExit

class A:

            

Reported by Pylint.

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

Line: 9 Column: 1

                  print("SKIP")
    raise SystemExit

class A:
    def __new__(cls):
        print("A.__new__")
        return super(cls, A).__new__(cls)

    def __init__(self):

            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

                  print("SKIP")
    raise SystemExit

class A:
    def __new__(cls):
        print("A.__new__")
        return super(cls, A).__new__(cls)

    def __init__(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 5

                  def __init__(self):
        print("A.__init__")

    def meth(self):
        print('A.meth')

#print(A.__new__)
#print(A.__init__)


            

Reported by Pylint.

Method could be a function
Error

Line: 17 Column: 5

                  def __init__(self):
        print("A.__init__")

    def meth(self):
        print('A.meth')

#print(A.__new__)
#print(A.__init__)


            

Reported by Pylint.

Missing class docstring
Error

Line: 40 Column: 1

              # __new__ returns not an instance of the class (None here), __init__
# should not be called

class B:
    def __new__(self, v1, v2):
        print("B.__new__", v1, v2)

    def __init__(self, v1, v2):
        # Should not be called in this test

            

Reported by Pylint.

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

Line: 40 Column: 1

              # __new__ returns not an instance of the class (None here), __init__
# should not be called

class B:
    def __new__(self, v1, v2):
        print("B.__new__", v1, v2)

    def __init__(self, v1, v2):
        # Should not be called in this test

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 40 Column: 1

              # __new__ returns not an instance of the class (None here), __init__
# should not be called

class B:
    def __new__(self, v1, v2):
        print("B.__new__", v1, v2)

    def __init__(self, v1, v2):
        # Should not be called in this test

            

Reported by Pylint.

Class method __new__ should have 'cls' as first argument
Error

Line: 41 Column: 5

              # should not be called

class B:
    def __new__(self, v1, v2):
        print("B.__new__", v1, v2)

    def __init__(self, v1, v2):
        # Should not be called in this test
        print("B.__init__", v1, v2)

            

Reported by Pylint.

ports/nrf/examples/ubluepy_eddystone.py
16 issues
Unable to import 'ubluepy'
Error

Line: 1 Column: 1

              from ubluepy import Peripheral, constants

BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = const(0x02)
BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = const(0x04)

BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE = const(
    BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
)


            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 3 Column: 41

              from ubluepy import Peripheral, constants

BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = const(0x02)
BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = const(0x04)

BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE = const(
    BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
)


            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 4 Column: 41

              from ubluepy import Peripheral, constants

BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = const(0x02)
BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = const(0x04)

BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE = const(
    BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
)


            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 6 Column: 47

              BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = const(0x02)
BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = const(0x04)

BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE = const(
    BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
)

EDDYSTONE_FRAME_TYPE_URL = const(0x10)
EDDYSTONE_URL_PREFIX_HTTP_WWW = const(0x00)  # "http://www".

            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 10 Column: 28

                  BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
)

EDDYSTONE_FRAME_TYPE_URL = const(0x10)
EDDYSTONE_URL_PREFIX_HTTP_WWW = const(0x00)  # "http://www".
EDDYSTONE_URL_SUFFIX_DOT_COM = const(0x01)  # ".com"


def string_to_binarray(text):

            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 11 Column: 33

              )

EDDYSTONE_FRAME_TYPE_URL = const(0x10)
EDDYSTONE_URL_PREFIX_HTTP_WWW = const(0x00)  # "http://www".
EDDYSTONE_URL_SUFFIX_DOT_COM = const(0x01)  # ".com"


def string_to_binarray(text):
    b = bytearray([])

            

Reported by Pylint.

Undefined variable 'const'
Error

Line: 12 Column: 32

              
EDDYSTONE_FRAME_TYPE_URL = const(0x10)
EDDYSTONE_URL_PREFIX_HTTP_WWW = const(0x00)  # "http://www".
EDDYSTONE_URL_SUFFIX_DOT_COM = const(0x01)  # ".com"


def string_to_binarray(text):
    b = bytearray([])
    for c in text:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from ubluepy import Peripheral, constants

BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = const(0x02)
BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = const(0x04)

BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE = const(
    BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 1

              EDDYSTONE_URL_SUFFIX_DOT_COM = const(0x01)  # ".com"


def string_to_binarray(text):
    b = bytearray([])
    for c in text:
        b.append(ord(c))
    return b


            

Reported by Pylint.

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

Line: 16 Column: 5

              

def string_to_binarray(text):
    b = bytearray([])
    for c in text:
        b.append(ord(c))
    return b



            

Reported by Pylint.

tests/basics/builtin_hash.py
16 issues
__hash__ does not return int
Error

Line: 39 Column: 5

              
# __hash__ must return an int
class D:
    def __hash__(self):
        return None
try:
    hash(D())
except TypeError:
    print("TypeError")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test builtin hash function

print(hash(False))
print(hash(True))
print({():1}) # hash tuple
print({(1,):1}) # hash non-empty tuple
print(hash in {hash:1}) # hash function

try:

            

Reported by Pylint.

Missing class docstring
Error

Line: 14 Column: 1

              except TypeError:
    print("TypeError")

class A:
    def __hash__(self):
        return 123
    def __repr__(self):
        return "a instance"


            

Reported by Pylint.

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

Line: 14 Column: 1

              except TypeError:
    print("TypeError")

class A:
    def __hash__(self):
        return 123
    def __repr__(self):
        return "a instance"


            

Reported by Pylint.

Missing class docstring
Error

Line: 24 Column: 1

              print({A():1})

# all user-classes have default __hash__
class B:
    pass
hash(B())

# if __eq__ is defined then default __hash__ is not used
class C:

            

Reported by Pylint.

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

Line: 24 Column: 1

              print({A():1})

# all user-classes have default __hash__
class B:
    pass
hash(B())

# if __eq__ is defined then default __hash__ is not used
class C:

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 24 Column: 1

              print({A():1})

# all user-classes have default __hash__
class B:
    pass
hash(B())

# if __eq__ is defined then default __hash__ is not used
class C:

            

Reported by Pylint.

Missing class docstring
Error

Line: 29 Column: 1

              hash(B())

# if __eq__ is defined then default __hash__ is not used
class C:
    def __eq__(self, another):
        return True
try:
    hash(C())
except TypeError:

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 29 Column: 1

              hash(B())

# if __eq__ is defined then default __hash__ is not used
class C:
    def __eq__(self, another):
        return True
try:
    hash(C())
except TypeError:

            

Reported by Pylint.

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

Line: 29 Column: 1

              hash(B())

# if __eq__ is defined then default __hash__ is not used
class C:
    def __eq__(self, another):
        return True
try:
    hash(C())
except TypeError:

            

Reported by Pylint.

tests/inlineasm/asmfpldrstr.py
15 issues
Unable to import 'uarray'
Error

Line: 1 Column: 1

              import uarray as array


@micropython.asm_thumb  # test vldr, vstr
def arrayadd(r0):
    vldr(s0, [r0, 0])
    vldr(s1, [r0, 4])
    vadd(s2, s0, s1)
    vstr(s2, [r0, 8])

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 4 Column: 2

              import uarray as array


@micropython.asm_thumb  # test vldr, vstr
def arrayadd(r0):
    vldr(s0, [r0, 0])
    vldr(s1, [r0, 4])
    vadd(s2, s0, s1)
    vstr(s2, [r0, 8])

            

Reported by Pylint.

Undefined variable 's0'
Error

Line: 6 Column: 10

              
@micropython.asm_thumb  # test vldr, vstr
def arrayadd(r0):
    vldr(s0, [r0, 0])
    vldr(s1, [r0, 4])
    vadd(s2, s0, s1)
    vstr(s2, [r0, 8])



            

Reported by Pylint.

Undefined variable 'vldr'
Error

Line: 6 Column: 5

              
@micropython.asm_thumb  # test vldr, vstr
def arrayadd(r0):
    vldr(s0, [r0, 0])
    vldr(s1, [r0, 4])
    vadd(s2, s0, s1)
    vstr(s2, [r0, 8])



            

Reported by Pylint.

Undefined variable 's1'
Error

Line: 7 Column: 10

              @micropython.asm_thumb  # test vldr, vstr
def arrayadd(r0):
    vldr(s0, [r0, 0])
    vldr(s1, [r0, 4])
    vadd(s2, s0, s1)
    vstr(s2, [r0, 8])


z = array.array("f", [2, 4, 10])

            

Reported by Pylint.

Undefined variable 'vldr'
Error

Line: 7 Column: 5

              @micropython.asm_thumb  # test vldr, vstr
def arrayadd(r0):
    vldr(s0, [r0, 0])
    vldr(s1, [r0, 4])
    vadd(s2, s0, s1)
    vstr(s2, [r0, 8])


z = array.array("f", [2, 4, 10])

            

Reported by Pylint.

Undefined variable 's1'
Error

Line: 8 Column: 18

              def arrayadd(r0):
    vldr(s0, [r0, 0])
    vldr(s1, [r0, 4])
    vadd(s2, s0, s1)
    vstr(s2, [r0, 8])


z = array.array("f", [2, 4, 10])
arrayadd(z)

            

Reported by Pylint.

Undefined variable 'vadd'
Error

Line: 8 Column: 5

              def arrayadd(r0):
    vldr(s0, [r0, 0])
    vldr(s1, [r0, 4])
    vadd(s2, s0, s1)
    vstr(s2, [r0, 8])


z = array.array("f", [2, 4, 10])
arrayadd(z)

            

Reported by Pylint.

Undefined variable 's2'
Error

Line: 8 Column: 10

              def arrayadd(r0):
    vldr(s0, [r0, 0])
    vldr(s1, [r0, 4])
    vadd(s2, s0, s1)
    vstr(s2, [r0, 8])


z = array.array("f", [2, 4, 10])
arrayadd(z)

            

Reported by Pylint.

Undefined variable 's0'
Error

Line: 8 Column: 14

              def arrayadd(r0):
    vldr(s0, [r0, 0])
    vldr(s1, [r0, 4])
    vadd(s2, s0, s1)
    vstr(s2, [r0, 8])


z = array.array("f", [2, 4, 10])
arrayadd(z)

            

Reported by Pylint.

tests/basics/fun_calldblstar.py
15 issues
Redefining name 'a' from outer scope (line 20)
Error

Line: 3 Column: 7

              # test calling a function with keywords given by **dict

def f(a, b):
    print(a, b)

f(1, **{'b':2})
f(1, **{'b':val for val in range(1)})

try:

            

Reported by Pylint.

Redefining name 'a' from outer scope (line 20)
Error

Line: 17 Column: 17

              # test calling a method with keywords given by **dict

class A:
    def f(self, a, b):
        print(a, b)

a = A()
a.f(1, **{'b':2})
a.f(1, **{'b':val for val in range(1)})

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test calling a function with keywords given by **dict

def f(a, b):
    print(a, b)

f(1, **{'b':2})
f(1, **{'b':val for val in range(1)})

try:

            

Reported by Pylint.

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

Line: 3 Column: 1

              # test calling a function with keywords given by **dict

def f(a, b):
    print(a, b)

f(1, **{'b':2})
f(1, **{'b':val for val in range(1)})

try:

            

Reported by Pylint.

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

Line: 3 Column: 1

              # test calling a function with keywords given by **dict

def f(a, b):
    print(a, b)

f(1, **{'b':2})
f(1, **{'b':val for val in range(1)})

try:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 3 Column: 1

              # test calling a function with keywords given by **dict

def f(a, b):
    print(a, b)

f(1, **{'b':2})
f(1, **{'b':val for val in range(1)})

try:

            

Reported by Pylint.

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

Line: 3 Column: 1

              # test calling a function with keywords given by **dict

def f(a, b):
    print(a, b)

f(1, **{'b':2})
f(1, **{'b':val for val in range(1)})

try:

            

Reported by Pylint.

Missing class docstring
Error

Line: 16 Column: 1

              
# test calling a method with keywords given by **dict

class A:
    def f(self, a, b):
        print(a, b)

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

            

Reported by Pylint.

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

Line: 16 Column: 1

              
# test calling a method with keywords given by **dict

class A:
    def f(self, a, b):
        print(a, b)

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

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 16 Column: 1

              
# test calling a method with keywords given by **dict

class A:
    def f(self, a, b):
        print(a, b)

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

            

Reported by Pylint.

tests/extmod/vfs_fat_oldproto.py
15 issues
Unused import uerrno
Error

Line: 2 Column: 5

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

try:
    uos.VfsFat

            

Reported by Pylint.

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_OLD:

    SEC_SIZE = 512

            

Reported by Pylint.

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

Line: 43 Column: 5

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

uos.VfsFat.mkfs(bdev)
vfs = uos.VfsFat(bdev)
uos.mount(vfs, "/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.

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

Line: 15 Column: 1

                  raise SystemExit


class RAMFS_OLD:

    SEC_SIZE = 512

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

            

Reported by Pylint.

Missing class docstring
Error

Line: 15 Column: 1

                  raise SystemExit


class RAMFS_OLD:

    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.

ports/esp8266/modules/ntptime.py
15 issues
Unable to import 'machine'
Error

Line: 35 Column: 5

              # There's currently no timezone support in MicroPython, and the RTC is set in UTC time.
def settime():
    t = time()
    import machine
    import utime

    tm = utime.gmtime(t)
    machine.RTC().datetime((tm[0], tm[1], tm[2], tm[6] + 1, tm[3], tm[4], tm[5], 0))

            

Reported by Pylint.

Unable to import 'utime'
Error

Line: 36 Column: 5

              def settime():
    t = time()
    import machine
    import utime

    tm = utime.gmtime(t)
    machine.RTC().datetime((tm[0], tm[1], tm[2], tm[6] + 1, tm[3], tm[4], tm[5], 0))

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 3 Column: 1

              try:
    import usocket as socket
except:
    import socket
try:
    import ustruct as struct
except:
    import struct


            

Reported by Pylint.

No exception type(s) specified
Error

Line: 7 Column: 1

                  import socket
try:
    import ustruct as struct
except:
    import struct

# (date(2000, 1, 1) - date(1900, 1, 1)).days * 24*60*60
NTP_DELTA = 3155673600


            

Reported by Pylint.

Unused variable 'res'
Error

Line: 24 Column: 9

                  s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    try:
        s.settimeout(1)
        res = s.sendto(NTP_QUERY, addr)
        msg = s.recv(48)
    finally:
        s.close()
    val = struct.unpack("!I", msg[40:44])[0]
    return val - NTP_DELTA

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    import usocket as socket
except:
    import socket
try:
    import ustruct as struct
except:
    import struct


            

Reported by Pylint.

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

Line: 14 Column: 1

              NTP_DELTA = 3155673600

# The NTP host can be configured at runtime by doing: ntptime.host = 'myhost.org'
host = "pool.ntp.org"


def time():
    NTP_QUERY = bytearray(48)
    NTP_QUERY[0] = 0x1B

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

              host = "pool.ntp.org"


def time():
    NTP_QUERY = bytearray(48)
    NTP_QUERY[0] = 0x1B
    addr = socket.getaddrinfo(host, 123)[0][-1]
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    try:

            

Reported by Pylint.

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

Line: 18 Column: 5

              

def time():
    NTP_QUERY = bytearray(48)
    NTP_QUERY[0] = 0x1B
    addr = socket.getaddrinfo(host, 123)[0][-1]
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    try:
        s.settimeout(1)

            

Reported by Pylint.

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

Line: 21 Column: 5

                  NTP_QUERY = bytearray(48)
    NTP_QUERY[0] = 0x1B
    addr = socket.getaddrinfo(host, 123)[0][-1]
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    try:
        s.settimeout(1)
        res = s.sendto(NTP_QUERY, addr)
        msg = s.recv(48)
    finally:

            

Reported by Pylint.

tests/net_inet/tls_num_errors.py
15 issues
Unable to import 'micropython'
Error

Line: 8 Column: 5

              except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:
    print("SKIP")
    raise SystemExit



            

Reported by Pylint.

Unused import sys
Error

Line: 4 Column: 5

              # test that modtls produces a numerical error message when out of heap

try:
    import usocket as socket, ussl as ssl, sys
except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 5 Column: 1

              
try:
    import usocket as socket, ussl as ssl, sys
except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:
    print("SKIP")

            

Reported by Pylint.

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

Line: 11 Column: 5

                  from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:
    print("SKIP")
    raise SystemExit


# test with heap locked to see it switch to number-only error message
def test(addr):
    alloc_emergency_exception_buf(256)

            

Reported by Pylint.

Redefining name 'addr' from outer scope (line 43)
Error

Line: 15 Column: 10

              

# test with heap locked to see it switch to number-only error message
def test(addr):
    alloc_emergency_exception_buf(256)
    s = socket.socket()
    s.connect(addr)
    try:
        s.setblocking(False)

            

Reported by Pylint.

Using deprecated method wrap_socket()
Error

Line: 21 Column: 13

                  s.connect(addr)
    try:
        s.setblocking(False)
        s = ssl.wrap_socket(s, do_handshake=False)
        heap_lock()
        print("heap is locked")
        while True:
            ret = s.write("foo")
            if ret:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test that modtls produces a numerical error message when out of heap

try:
    import usocket as socket, ussl as ssl, sys
except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:

            

Reported by Pylint.

Multiple imports on one line (usocket, ussl, sys)
Error

Line: 4 Column: 5

              # test that modtls produces a numerical error message when out of heap

try:
    import usocket as socket, ussl as ssl, sys
except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:

            

Reported by Pylint.

Imports from package sys are not grouped
Error

Line: 6 Column: 5

              try:
    import usocket as socket, ussl as ssl, sys
except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:
    print("SKIP")
    raise SystemExit

            

Reported by Pylint.

Multiple imports on one line (socket, ssl, sys)
Error

Line: 6 Column: 5

              try:
    import usocket as socket, ussl as ssl, sys
except:
    import socket, ssl, sys
try:
    from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock
except:
    print("SKIP")
    raise SystemExit

            

Reported by Pylint.

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

Line: 10 Column: 9

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


async def task(s, allow_cancel):
    try:
        print("task start")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test cancelling a task

try:
    import uasyncio as asyncio
except ImportError:
    try:
        import asyncio
    except ImportError:
        print("SKIP")

            

Reported by Pylint.

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

Line: 13 Column: 1

                      raise SystemExit


async def task(s, allow_cancel):
    try:
        print("task start")
        await asyncio.sleep(s)
        print("task done")
    except asyncio.CancelledError as er:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                      raise SystemExit


async def task(s, allow_cancel):
    try:
        print("task start")
        await asyncio.sleep(s)
        print("task done")
    except asyncio.CancelledError as er:

            

Reported by Pylint.

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

Line: 18 Column: 5

                      print("task start")
        await asyncio.sleep(s)
        print("task done")
    except asyncio.CancelledError as er:
        print("task cancel")
        if allow_cancel:
            raise er



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 1

                          raise er


async def task2(allow_cancel):
    print("task 2")
    try:
        await asyncio.create_task(task(0.05, allow_cancel))
    except asyncio.CancelledError as er:
        print("task 2 cancel")

            

Reported by Pylint.

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

Line: 28 Column: 5

                  print("task 2")
    try:
        await asyncio.create_task(task(0.05, allow_cancel))
    except asyncio.CancelledError as er:
        print("task 2 cancel")
        raise er
    print("task 2 done")



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 34 Column: 1

                  print("task 2 done")


async def main():
    # Cancel task immediately
    t = asyncio.create_task(task(2, True))
    print(t.cancel())

    # Cancel task after it has started

            

Reported by Pylint.

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

Line: 36 Column: 5

              
async def main():
    # Cancel task immediately
    t = asyncio.create_task(task(2, True))
    print(t.cancel())

    # Cancel task after it has started
    t = asyncio.create_task(task(2, True))
    await asyncio.sleep(0.01)

            

Reported by Pylint.

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

Line: 40 Column: 5

                  print(t.cancel())

    # Cancel task after it has started
    t = asyncio.create_task(task(2, True))
    await asyncio.sleep(0.01)
    print(t.cancel())
    print("main sleep")
    await asyncio.sleep(0.01)


            

Reported by Pylint.