The following issues were found
tests/extmod/uasyncio_wait_for.py
22 issues
Line: 10
Column: 9
import asyncio
except ImportError:
print("SKIP")
raise SystemExit
async def task(id, t):
print("task start", id)
await asyncio.sleep(t)
Reported by Pylint.
Line: 13
Column: 16
raise SystemExit
async def task(id, t):
print("task start", id)
await asyncio.sleep(t)
print("task end", id)
return id * 2
Reported by Pylint.
Line: 41
Column: 32
other.cancel()
async def task_wait_for_cancel(id, t, t_wait):
print("task_wait_for_cancel start")
try:
await asyncio.wait_for(task(id, t), t_wait)
except asyncio.CancelledError as er:
print("task_wait_for_cancel cancelled")
Reported by Pylint.
Line: 1
Column: 1
# Test asyncio.wait_for
try:
import uasyncio as asyncio
except ImportError:
try:
import asyncio
except ImportError:
print("SKIP")
Reported by Pylint.
Line: 13
Column: 1
raise SystemExit
async def task(id, t):
print("task start", id)
await asyncio.sleep(t)
print("task end", id)
return id * 2
Reported by Pylint.
Line: 13
Column: 1
raise SystemExit
async def task(id, t):
print("task start", id)
await asyncio.sleep(t)
print("task end", id)
return id * 2
Reported by Pylint.
Line: 13
Column: 1
raise SystemExit
async def task(id, t):
print("task start", id)
await asyncio.sleep(t)
print("task end", id)
return id * 2
Reported by Pylint.
Line: 20
Column: 1
return id * 2
async def task_catch():
print("task_catch start")
try:
await asyncio.sleep(0.2)
except asyncio.CancelledError:
print("ignore cancel")
Reported by Pylint.
Line: 29
Column: 1
print("task_catch done")
async def task_raise():
print("task start")
raise ValueError
async def task_cancel_other(t, other):
Reported by Pylint.
Line: 34
Column: 1
raise ValueError
async def task_cancel_other(t, other):
print("task_cancel_other start")
await asyncio.sleep(t)
print("task_cancel_other cancel")
other.cancel()
Reported by Pylint.
examples/rp2/pio_uart_tx.py
21 issues
Line: 3
Column: 1
# Example using PIO to create a UART TX interface
from machine import Pin
from rp2 import PIO, StateMachine, asm_pio
UART_BAUD = 115200
PIN_BASE = 10
NUM_UARTS = 8
Reported by Pylint.
Line: 4
Column: 1
# Example using PIO to create a UART TX interface
from machine import Pin
from rp2 import PIO, StateMachine, asm_pio
UART_BAUD = 115200
PIN_BASE = 10
NUM_UARTS = 8
Reported by Pylint.
Line: 15
Column: 5
def uart_tx():
# fmt: off
# Block with TX deasserted until data available
pull()
# Initialise bit counter, assert start bit for 8 cycles
set(x, 7) .side(0) [7]
# Shift out 8 data bits, 8 execution cycles per bit
label("bitloop")
out(pins, 1) [6]
Reported by Pylint.
Line: 17
Column: 9
# Block with TX deasserted until data available
pull()
# Initialise bit counter, assert start bit for 8 cycles
set(x, 7) .side(0) [7]
# Shift out 8 data bits, 8 execution cycles per bit
label("bitloop")
out(pins, 1) [6]
jmp(x_dec, "bitloop")
# Assert stop bit for 8 cycles total (incl 1 for pull())
Reported by Pylint.
Line: 17
Column: 5
# Block with TX deasserted until data available
pull()
# Initialise bit counter, assert start bit for 8 cycles
set(x, 7) .side(0) [7]
# Shift out 8 data bits, 8 execution cycles per bit
label("bitloop")
out(pins, 1) [6]
jmp(x_dec, "bitloop")
# Assert stop bit for 8 cycles total (incl 1 for pull())
Reported by Pylint.
Line: 19
Column: 5
# Initialise bit counter, assert start bit for 8 cycles
set(x, 7) .side(0) [7]
# Shift out 8 data bits, 8 execution cycles per bit
label("bitloop")
out(pins, 1) [6]
jmp(x_dec, "bitloop")
# Assert stop bit for 8 cycles total (incl 1 for pull())
nop() .side(1) [6]
# fmt: on
Reported by Pylint.
Line: 20
Column: 5
set(x, 7) .side(0) [7]
# Shift out 8 data bits, 8 execution cycles per bit
label("bitloop")
out(pins, 1) [6]
jmp(x_dec, "bitloop")
# Assert stop bit for 8 cycles total (incl 1 for pull())
nop() .side(1) [6]
# fmt: on
Reported by Pylint.
Line: 20
Column: 9
set(x, 7) .side(0) [7]
# Shift out 8 data bits, 8 execution cycles per bit
label("bitloop")
out(pins, 1) [6]
jmp(x_dec, "bitloop")
# Assert stop bit for 8 cycles total (incl 1 for pull())
nop() .side(1) [6]
# fmt: on
Reported by Pylint.
Line: 21
Column: 9
# Shift out 8 data bits, 8 execution cycles per bit
label("bitloop")
out(pins, 1) [6]
jmp(x_dec, "bitloop")
# Assert stop bit for 8 cycles total (incl 1 for pull())
nop() .side(1) [6]
# fmt: on
Reported by Pylint.
Line: 21
Column: 5
# Shift out 8 data bits, 8 execution cycles per bit
label("bitloop")
out(pins, 1) [6]
jmp(x_dec, "bitloop")
# Assert stop bit for 8 cycles total (incl 1 for pull())
nop() .side(1) [6]
# fmt: on
Reported by Pylint.
tests/basics/string_format_modulo.py
21 issues
Line: 17
Column: 11
print("=%r=" % "str")
try:
print("=%s=%s=" % 1)
except TypeError:
print("TypeError")
try:
print("=%s=%s=%s=" % (1, 2))
Reported by Pylint.
Line: 22
Column: 11
print("TypeError")
try:
print("=%s=%s=%s=" % (1, 2))
except TypeError:
print("TypeError")
try:
print("=%s=" % (1, 2))
Reported by Pylint.
Line: 27
Column: 11
print("TypeError")
try:
print("=%s=" % (1, 2))
except TypeError:
print("TypeError")
print("%s" % True)
print("%s" % 1)
Reported by Pylint.
Line: 43
Column: 7
print("%10s" % 'abc')
print("%-10s" % 'abc')
print('%c' % False)
print('%c' % True)
# Should be able to print dicts; in this case they aren't used
# to lookup keywords in formats like %(foo)s
print('%s' % {})
Reported by Pylint.
Line: 44
Column: 7
print("%-10s" % 'abc')
print('%c' % False)
print('%c' % True)
# Should be able to print dicts; in this case they aren't used
# to lookup keywords in formats like %(foo)s
print('%s' % {})
print('%s' % ({},))
Reported by Pylint.
Line: 53
Column: 11
# Cases when "*" used and there's not enough values total
try:
print("%*s" % 5)
except TypeError:
print("TypeError")
try:
print("%*.*s" % (1, 15))
except TypeError:
Reported by Pylint.
Line: 57
Column: 11
except TypeError:
print("TypeError")
try:
print("%*.*s" % (1, 15))
except TypeError:
print("TypeError")
print("%(foo)s" % {"foo": "bar", "baz": False})
print("%s %(foo)s %(foo)s" % {"foo": 1})
Reported by Pylint.
Line: 62
Column: 7
print("TypeError")
print("%(foo)s" % {"foo": "bar", "baz": False})
print("%s %(foo)s %(foo)s" % {"foo": 1})
try:
print("%(foo)s" % {})
except KeyError:
print("KeyError")
# Using in "*" with dict got to fail
Reported by Pylint.
Line: 64
Column: 11
print("%(foo)s" % {"foo": "bar", "baz": False})
print("%s %(foo)s %(foo)s" % {"foo": 1})
try:
print("%(foo)s" % {})
except KeyError:
print("KeyError")
# Using in "*" with dict got to fail
try:
print("%(foo)*s" % {"foo": "bar"})
Reported by Pylint.
Line: 69
Column: 11
print("KeyError")
# Using in "*" with dict got to fail
try:
print("%(foo)*s" % {"foo": "bar"})
except TypeError:
print("TypeError")
# When using %(foo)s format the single argument must be a dict
try:
Reported by Pylint.
examples/pins.py
21 issues
Line: 5
Column: 1
# Requires pins_af.py from ports/stm32/build-PYBV10/ directory.
import pyb
import pins_af
def af():
max_name_width = 0
max_af_width = 0
Reported by Pylint.
Line: 25
Column: 9
def pins():
mode_str = {
pyb.Pin.IN: "IN",
pyb.Pin.OUT_PP: "OUT_PP",
pyb.Pin.OUT_OD: "OUT_OD",
pyb.Pin.AF_PP: "AF_PP",
pyb.Pin.AF_OD: "AF_OD",
pyb.Pin.ANALOG: "ANALOG",
Reported by Pylint.
Line: 26
Column: 9
def pins():
mode_str = {
pyb.Pin.IN: "IN",
pyb.Pin.OUT_PP: "OUT_PP",
pyb.Pin.OUT_OD: "OUT_OD",
pyb.Pin.AF_PP: "AF_PP",
pyb.Pin.AF_OD: "AF_OD",
pyb.Pin.ANALOG: "ANALOG",
}
Reported by Pylint.
Line: 27
Column: 9
mode_str = {
pyb.Pin.IN: "IN",
pyb.Pin.OUT_PP: "OUT_PP",
pyb.Pin.OUT_OD: "OUT_OD",
pyb.Pin.AF_PP: "AF_PP",
pyb.Pin.AF_OD: "AF_OD",
pyb.Pin.ANALOG: "ANALOG",
}
pull_str = {pyb.Pin.PULL_NONE: "", pyb.Pin.PULL_UP: "PULL_UP", pyb.Pin.PULL_DOWN: "PULL_DOWN"}
Reported by Pylint.
Line: 28
Column: 9
pyb.Pin.IN: "IN",
pyb.Pin.OUT_PP: "OUT_PP",
pyb.Pin.OUT_OD: "OUT_OD",
pyb.Pin.AF_PP: "AF_PP",
pyb.Pin.AF_OD: "AF_OD",
pyb.Pin.ANALOG: "ANALOG",
}
pull_str = {pyb.Pin.PULL_NONE: "", pyb.Pin.PULL_UP: "PULL_UP", pyb.Pin.PULL_DOWN: "PULL_DOWN"}
width = [0, 0, 0, 0]
Reported by Pylint.
Line: 29
Column: 9
pyb.Pin.OUT_PP: "OUT_PP",
pyb.Pin.OUT_OD: "OUT_OD",
pyb.Pin.AF_PP: "AF_PP",
pyb.Pin.AF_OD: "AF_OD",
pyb.Pin.ANALOG: "ANALOG",
}
pull_str = {pyb.Pin.PULL_NONE: "", pyb.Pin.PULL_UP: "PULL_UP", pyb.Pin.PULL_DOWN: "PULL_DOWN"}
width = [0, 0, 0, 0]
rows = []
Reported by Pylint.
Line: 30
Column: 9
pyb.Pin.OUT_OD: "OUT_OD",
pyb.Pin.AF_PP: "AF_PP",
pyb.Pin.AF_OD: "AF_OD",
pyb.Pin.ANALOG: "ANALOG",
}
pull_str = {pyb.Pin.PULL_NONE: "", pyb.Pin.PULL_UP: "PULL_UP", pyb.Pin.PULL_DOWN: "PULL_DOWN"}
width = [0, 0, 0, 0]
rows = []
for pin_entry in pins_af.PINS_AF:
Reported by Pylint.
Line: 32
Column: 40
pyb.Pin.AF_OD: "AF_OD",
pyb.Pin.ANALOG: "ANALOG",
}
pull_str = {pyb.Pin.PULL_NONE: "", pyb.Pin.PULL_UP: "PULL_UP", pyb.Pin.PULL_DOWN: "PULL_DOWN"}
width = [0, 0, 0, 0]
rows = []
for pin_entry in pins_af.PINS_AF:
row = []
pin_name = pin_entry[0]
Reported by Pylint.
Line: 32
Column: 68
pyb.Pin.AF_OD: "AF_OD",
pyb.Pin.ANALOG: "ANALOG",
}
pull_str = {pyb.Pin.PULL_NONE: "", pyb.Pin.PULL_UP: "PULL_UP", pyb.Pin.PULL_DOWN: "PULL_DOWN"}
width = [0, 0, 0, 0]
rows = []
for pin_entry in pins_af.PINS_AF:
row = []
pin_name = pin_entry[0]
Reported by Pylint.
Line: 32
Column: 17
pyb.Pin.AF_OD: "AF_OD",
pyb.Pin.ANALOG: "ANALOG",
}
pull_str = {pyb.Pin.PULL_NONE: "", pyb.Pin.PULL_UP: "PULL_UP", pyb.Pin.PULL_DOWN: "PULL_DOWN"}
width = [0, 0, 0, 0]
rows = []
for pin_entry in pins_af.PINS_AF:
row = []
pin_name = pin_entry[0]
Reported by Pylint.
tests/extmod/vfs_lfs.py
21 issues
Line: 6
Column: 5
try:
import uos
uos.VfsLfs1
uos.VfsLfs2
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 7
Column: 5
import uos
uos.VfsLfs1
uos.VfsLfs2
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 10
Column: 5
uos.VfsLfs2
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
class RAMBlockDevice:
ERASE_BLOCK_SIZE = 1024
Reported by Pylint.
Line: 29
Column: 25
for i in range(len(buf)):
self.data[addr + i] = buf[i]
def ioctl(self, op, arg):
if op == 4: # block count
return len(self.data) // self.ERASE_BLOCK_SIZE
if op == 5: # block size
return self.ERASE_BLOCK_SIZE
if op == 6: # erase block
Reported by Pylint.
Line: 43
Column: 10
print(st[:6], st[6] if print_size else -1, type(st[7]), type(st[8]), type(st[9]))
def test(bdev, vfs_class):
print("test", vfs_class)
# mkfs
vfs_class.mkfs(bdev)
Reported by Pylint.
Line: 1
Column: 1
# Test for VfsLittle using a RAM device
try:
import uos
uos.VfsLfs1
uos.VfsLfs2
except (ImportError, AttributeError):
print("SKIP")
Reported by Pylint.
Line: 13
Column: 1
raise SystemExit
class RAMBlockDevice:
ERASE_BLOCK_SIZE = 1024
def __init__(self, blocks):
self.data = bytearray(blocks * self.ERASE_BLOCK_SIZE)
Reported by Pylint.
Line: 19
Column: 5
def __init__(self, blocks):
self.data = bytearray(blocks * self.ERASE_BLOCK_SIZE)
def readblocks(self, block, buf, off):
addr = block * self.ERASE_BLOCK_SIZE + off
for i in range(len(buf)):
buf[i] = self.data[addr + i]
def writeblocks(self, block, buf, off):
Reported by Pylint.
Line: 21
Column: 9
def readblocks(self, block, buf, off):
addr = block * self.ERASE_BLOCK_SIZE + off
for i in range(len(buf)):
buf[i] = self.data[addr + i]
def writeblocks(self, block, buf, off):
addr = block * self.ERASE_BLOCK_SIZE + off
for i in range(len(buf)):
Reported by Pylint.
Line: 24
Column: 5
for i in range(len(buf)):
buf[i] = self.data[addr + i]
def writeblocks(self, block, buf, off):
addr = block * self.ERASE_BLOCK_SIZE + off
for i in range(len(buf)):
self.data[addr + i] = buf[i]
def ioctl(self, op, arg):
Reported by Pylint.
ports/esp32/boards/UM_TINYPICO/modules/tinypico.py
21 issues
Line: 12
Column: 1
# 2019-Oct-23 - v1.1 - Removed temp sensor code, prep for frozen modules
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time, esp32
# TinyPICO Hardware Pin Assignments
Reported by Pylint.
Line: 13
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time, esp32
# TinyPICO Hardware Pin Assignments
# Battery
Reported by Pylint.
Line: 14
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time, esp32
# TinyPICO Hardware Pin Assignments
# Battery
BAT_VOLTAGE = const(35)
Reported by Pylint.
Line: 14
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time, esp32
# TinyPICO Hardware Pin Assignments
# Battery
BAT_VOLTAGE = const(35)
Reported by Pylint.
Line: 13
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time, esp32
# TinyPICO Hardware Pin Assignments
# Battery
Reported by Pylint.
Line: 14
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time, esp32
# TinyPICO Hardware Pin Assignments
# Battery
BAT_VOLTAGE = const(35)
Reported by Pylint.
Line: 68
Column: 9
measuredVal = 0 # start our reading at 0
io = Pin(BAT_CHARGE, Pin.IN) # Assign the pin to read
for y in range(
0, 10
): # loop through 10 times adding the read values together to ensure no false positives
measuredVal += io.value()
return measuredVal == 0 # return True if the value is 0
Reported by Pylint.
Line: 1
Column: 1
# TinyPICO MicroPython Helper Library
# 2019 Seon Rozenblum, Matt Trentini
#
# Project home:
# https://github.com/TinyPICO
#
# 2019-Mar-12 - v0.1 - Initial implementation
# 2019-May-20 - v1.0 - Initial Release
# 2019-Oct-23 - v1.1 - Removed temp sensor code, prep for frozen modules
Reported by Pylint.
Line: 14
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time, esp32
# TinyPICO Hardware Pin Assignments
# Battery
BAT_VOLTAGE = const(35)
Reported by Pylint.
Line: 14
Column: 1
# Import required libraries
from micropython import const
from machine import Pin, SPI, ADC
import machine, time, esp32
# TinyPICO Hardware Pin Assignments
# Battery
BAT_VOLTAGE = const(35)
Reported by Pylint.
tests/basics/int_big1.py
21 issues
Line: 77
Column: 1
try:
print(int("123456789012345678901234567890abcdef"))
except ValueError:
print('ValueError');
try:
print(int("123456789012345678901234567890\x01"))
except ValueError:
print('ValueError');
Reported by Pylint.
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.
Line: 1
Column: 1
# to test arbitrariy precision integers
x = 1000000000000000000000000000000
xn = -1000000000000000000000000000000
y = 2000000000000000000000000000000
# printing
print(x)
print(y)
Reported by Pylint.
Line: 3
Column: 1
# to test arbitrariy precision integers
x = 1000000000000000000000000000000
xn = -1000000000000000000000000000000
y = 2000000000000000000000000000000
# printing
print(x)
print(y)
Reported by Pylint.
Line: 4
Column: 1
# to test arbitrariy precision integers
x = 1000000000000000000000000000000
xn = -1000000000000000000000000000000
y = 2000000000000000000000000000000
# printing
print(x)
print(y)
Reported by Pylint.
Line: 5
Column: 1
x = 1000000000000000000000000000000
xn = -1000000000000000000000000000000
y = 2000000000000000000000000000000
# printing
print(x)
print(y)
print('%#X' % (x - x)) # print prefix
Reported by Pylint.
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.
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.
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.
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_fileio2.py
21 issues
Line: 6
Column: 5
import uos
except ImportError:
print("SKIP")
raise SystemExit
try:
uos.VfsFat
except AttributeError:
print("SKIP")
Reported by Pylint.
Line: 12
Column: 5
uos.VfsFat
except AttributeError:
print("SKIP")
raise SystemExit
class RAMFS:
SEC_SIZE = 512
Reported by Pylint.
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.
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.
Line: 1
Column: 1
try:
import uerrno
import uos
except ImportError:
print("SKIP")
raise SystemExit
try:
uos.VfsFat
Reported by Pylint.
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.
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.
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.
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.
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/thread/mutate_instance.py
21 issues
Line: 26
Column: 9
with lock:
global n_finished
n_finished += 1
lock = _thread.allocate_lock()
n_repeat = 30
n_range = 50 # 300 for stressful test (uses more heap)
Reported by Pylint.
Line: 20
Column: 13
# main thread function
def th(n, lo, hi):
for repeat in range(n):
for i in range(lo, hi):
setattr(user, "attr_%u" % i, repeat + i)
assert getattr(user, "attr_%u" % i) == repeat + i
with lock:
global n_finished
Reported by Pylint.
Line: 25
Column: 9
assert getattr(user, "attr_%u" % i) == repeat + i
with lock:
global n_finished
n_finished += 1
lock = _thread.allocate_lock()
n_repeat = 30
Reported by Pylint.
Line: 1
Column: 1
# test concurrent mutating access to a shared user instance
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
import _thread
# the shared user class and instance
class User:
def __init__(self):
Reported by Pylint.
Line: 8
Column: 1
import _thread
# the shared user class and instance
class User:
def __init__(self):
self.a = "A"
self.b = "B"
self.c = "C"
Reported by Pylint.
Line: 8
Column: 1
import _thread
# the shared user class and instance
class User:
def __init__(self):
self.a = "A"
self.b = "B"
self.c = "C"
Reported by Pylint.
Line: 10
Column: 9
# the shared user class and instance
class User:
def __init__(self):
self.a = "A"
self.b = "B"
self.c = "C"
user = User()
Reported by Pylint.
Line: 11
Column: 9
class User:
def __init__(self):
self.a = "A"
self.b = "B"
self.c = "C"
user = User()
Reported by Pylint.
Line: 12
Column: 9
def __init__(self):
self.a = "A"
self.b = "B"
self.c = "C"
user = User()
# main thread function
Reported by Pylint.
Line: 18
Column: 1
user = User()
# main thread function
def th(n, lo, hi):
for repeat in range(n):
for i in range(lo, hi):
setattr(user, "attr_%u" % i, repeat + i)
assert getattr(user, "attr_%u" % i) == repeat + i
Reported by Pylint.
tests/multi_bluetooth/ble_gap_pair.py
21 issues
Line: 4
Column: 1
# Test BLE GAP connect/disconnect with pairing, and read an encrypted characteristic
# TODO: add gap_passkey testing
from micropython import const
import time, machine, bluetooth
if not hasattr(bluetooth.BLE, "gap_pair"):
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 5
Column: 1
# TODO: add gap_passkey testing
from micropython import const
import time, machine, bluetooth
if not hasattr(bluetooth.BLE, "gap_pair"):
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 5
Column: 1
# TODO: add gap_passkey testing
from micropython import const
import time, machine, bluetooth
if not hasattr(bluetooth.BLE, "gap_pair"):
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 65
Column: 10
def wait_for_event(event, timeout_ms):
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
if event in waiting_events:
return waiting_events.pop(event)
machine.idle()
raise ValueError("Timeout waiting for {}".format(event))
Reported by Pylint.
Line: 66
Column: 27
def wait_for_event(event, timeout_ms):
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
if event in waiting_events:
return waiting_events.pop(event)
machine.idle()
raise ValueError("Timeout waiting for {}".format(event))
Reported by Pylint.
Line: 66
Column: 11
def wait_for_event(event, timeout_ms):
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
if event in waiting_events:
return waiting_events.pop(event)
machine.idle()
raise ValueError("Timeout waiting for {}".format(event))
Reported by Pylint.
Line: 75
Column: 5
# Acting in peripheral role.
def instance0():
multitest.globals(BDADDR=ble.config("mac"))
((char_handle,),) = ble.gatts_register_services((SERVICE,))
ble.gatts_write(char_handle, "encrypted")
print("gap_advertise")
ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
multitest.next()
Reported by Pylint.
Line: 80
Column: 5
ble.gatts_write(char_handle, "encrypted")
print("gap_advertise")
ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
multitest.next()
try:
# Wait for central to connect.
wait_for_event(_IRQ_CENTRAL_CONNECT, TIMEOUT_MS)
# Wait for pairing event.
Reported by Pylint.
Line: 99
Column: 5
# Acting in central role.
def instance1():
multitest.next()
try:
# Connect to peripheral.
print("gap_connect")
ble.gap_connect(*BDADDR)
conn_handle = wait_for_event(_IRQ_PERIPHERAL_CONNECT, TIMEOUT_MS)
Reported by Pylint.
Line: 103
Column: 26
try:
# Connect to peripheral.
print("gap_connect")
ble.gap_connect(*BDADDR)
conn_handle = wait_for_event(_IRQ_PERIPHERAL_CONNECT, TIMEOUT_MS)
# Discover characteristics (before pairing, doesn't need to be encrypted).
ble.gattc_discover_characteristics(conn_handle, 1, 65535)
value_handle = wait_for_event(_IRQ_GATTC_CHARACTERISTIC_RESULT, TIMEOUT_MS)
Reported by Pylint.