The following issues were found
tests/perf_bench/bm_fft.py
16 issues
Line: 64
Column: 9
def result():
nonlocal fft, fft_inv
fft[1] -= 0.5 * params[1]
fft[-1] -= 0.5 * params[1]
fft_ok = all(abs(f) < 1e-3 for f in fft)
for i in range(len(fft_inv)):
fft_inv[i] -= params[1] * signal[i]
fft_inv_ok = all(abs(f) < 1e-3 for f in fft_inv)
Reported by Pylint.
Line: 65
Column: 9
def result():
nonlocal fft, fft_inv
fft[1] -= 0.5 * params[1]
fft[-1] -= 0.5 * params[1]
fft_ok = all(abs(f) < 1e-3 for f in fft)
for i in range(len(fft_inv)):
fft_inv[i] -= params[1] * signal[i]
fft_inv_ok = all(abs(f) < 1e-3 for f in fft_inv)
return params[0] * params[1], (fft_ok, fft_inv_ok)
Reported by Pylint.
Line: 66
Column: 45
nonlocal fft, fft_inv
fft[1] -= 0.5 * params[1]
fft[-1] -= 0.5 * params[1]
fft_ok = all(abs(f) < 1e-3 for f in fft)
for i in range(len(fft_inv)):
fft_inv[i] -= params[1] * signal[i]
fft_inv_ok = all(abs(f) < 1e-3 for f in fft_inv)
return params[0] * params[1], (fft_ok, fft_inv_ok)
Reported by Pylint.
Line: 68
Column: 13
fft[-1] -= 0.5 * params[1]
fft_ok = all(abs(f) < 1e-3 for f in fft)
for i in range(len(fft_inv)):
fft_inv[i] -= params[1] * signal[i]
fft_inv_ok = all(abs(f) < 1e-3 for f in fft_inv)
return params[0] * params[1], (fft_ok, fft_inv_ok)
return run, result
Reported by Pylint.
Line: 69
Column: 49
fft_ok = all(abs(f) < 1e-3 for f in fft)
for i in range(len(fft_inv)):
fft_inv[i] -= params[1] * signal[i]
fft_inv_ok = all(abs(f) < 1e-3 for f in fft_inv)
return params[0] * params[1], (fft_ok, fft_inv_ok)
return run, result
Reported by Pylint.
Line: 11
Column: 13
# Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.
def reverse(x, bits):
y = 0
for i in range(bits):
y = (y << 1) | (x & 1)
x >>= 1
return y
# Initialization
Reported by Pylint.
Line: 51
Column: 5
def bm_setup(params):
state = None
signal = [math.cos(2 * math.pi * i / params[1]) + 0j for i in range(params[1])]
fft = None
fft_inv = None
def run():
Reported by Pylint.
Line: 1
Column: 1
# Copyright (c) 2019 Project Nayuki. (MIT License)
# https://www.nayuki.io/page/free-small-fft-in-multiple-languages
import math, cmath
def transform_radix2(vector, inverse):
# Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.
def reverse(x, bits):
Reported by Pylint.
Line: 4
Column: 1
# Copyright (c) 2019 Project Nayuki. (MIT License)
# https://www.nayuki.io/page/free-small-fft-in-multiple-languages
import math, cmath
def transform_radix2(vector, inverse):
# Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.
def reverse(x, bits):
Reported by Pylint.
Line: 7
Column: 1
import math, cmath
def transform_radix2(vector, inverse):
# Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.
def reverse(x, bits):
y = 0
for i in range(bits):
y = (y << 1) | (x & 1)
Reported by Pylint.
tests/extmod/uasyncio_wait_task.py
16 issues
Line: 10
Column: 9
import asyncio
except ImportError:
print("SKIP")
raise SystemExit
try:
import utime
Reported by Pylint.
Line: 18
Column: 1
ticks = utime.ticks_ms
ticks_diff = utime.ticks_diff
except:
import time
ticks = lambda: int(time.time() * 1000)
ticks_diff = lambda t1, t0: t1 - t0
Reported by Pylint.
Line: 1
Column: 1
# Test waiting on a task
try:
import uasyncio as asyncio
except ImportError:
try:
import asyncio
except ImportError:
print("SKIP")
Reported by Pylint.
Line: 25
Column: 1
ticks_diff = lambda t1, t0: t1 - t0
async def task(t):
print("task", t)
async def delay_print(t, s):
await asyncio.sleep(t)
Reported by Pylint.
Line: 25
Column: 1
ticks_diff = lambda t1, t0: t1 - t0
async def task(t):
print("task", t)
async def delay_print(t, s):
await asyncio.sleep(t)
Reported by Pylint.
Line: 29
Column: 1
print("task", t)
async def delay_print(t, s):
await asyncio.sleep(t)
print(s)
async def task_raise():
Reported by Pylint.
Line: 29
Column: 1
print("task", t)
async def delay_print(t, s):
await asyncio.sleep(t)
print(s)
async def task_raise():
Reported by Pylint.
Line: 29
Column: 1
print("task", t)
async def delay_print(t, s):
await asyncio.sleep(t)
print(s)
async def task_raise():
Reported by Pylint.
Line: 34
Column: 1
print(s)
async def task_raise():
print("task_raise")
raise ValueError
async def main():
Reported by Pylint.
Line: 39
Column: 1
raise ValueError
async def main():
print("start")
# Wait on a task
t = asyncio.create_task(task(1))
await t
Reported by Pylint.
tests/micropython/viper_ptr16_store.py
16 issues
Line: 4
Column: 2
# test ptr16 type
@micropython.viper
def set(dest: ptr16, val: int):
dest[0] = val
@micropython.viper
Reported by Pylint.
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.
Line: 9
Column: 2
dest[0] = val
@micropython.viper
def set1(dest: ptr16, val: int):
dest[1] = val
@micropython.viper
Reported by Pylint.
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.
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.
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.
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.
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.
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.
Line: 1
Column: 1
# test ptr16 type
@micropython.viper
def set(dest: ptr16, val: int):
dest[0] = val
@micropython.viper
Reported by Pylint.
tests/thread/mutate_dict.py
16 issues
Line: 27
Column: 9
with lock:
global n_finished
n_finished += 1
lock = _thread.allocate_lock()
n_thread = 4
n_finished = 0
Reported by Pylint.
Line: 13
Column: 13
# main thread function
def th(n, lo, hi):
for repeat in range(n):
for i in range(lo, hi):
di[i] = repeat + i
assert di[i] == repeat + i
del di[i]
assert i not in di
Reported by Pylint.
Line: 26
Column: 9
assert di.pop(i) == repeat + i
with lock:
global n_finished
n_finished += 1
lock = _thread.allocate_lock()
n_thread = 4
Reported by Pylint.
Line: 1
Column: 1
# test concurrent mutating access to a shared dict object
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
import _thread
# the shared dict
di = {"a": "A", "b": "B", "c": "C", "d": "D"}
Reported by Pylint.
Line: 11
Column: 1
di = {"a": "A", "b": "B", "c": "C", "d": "D"}
# main thread function
def th(n, lo, hi):
for repeat in range(n):
for i in range(lo, hi):
di[i] = repeat + i
assert di[i] == repeat + i
Reported by Pylint.
Line: 11
Column: 1
di = {"a": "A", "b": "B", "c": "C", "d": "D"}
# main thread function
def th(n, lo, hi):
for repeat in range(n):
for i in range(lo, hi):
di[i] = repeat + i
assert di[i] == repeat + i
Reported by Pylint.
Line: 11
Column: 1
di = {"a": "A", "b": "B", "c": "C", "d": "D"}
# main thread function
def th(n, lo, hi):
for repeat in range(n):
for i in range(lo, hi):
di[i] = repeat + i
assert di[i] == repeat + i
Reported by Pylint.
Line: 11
Column: 1
di = {"a": "A", "b": "B", "c": "C", "d": "D"}
# main thread function
def th(n, lo, hi):
for repeat in range(n):
for i in range(lo, hi):
di[i] = repeat + i
assert di[i] == repeat + i
Reported by Pylint.
Line: 11
Column: 1
di = {"a": "A", "b": "B", "c": "C", "d": "D"}
# main thread function
def th(n, lo, hi):
for repeat in range(n):
for i in range(lo, hi):
di[i] = repeat + i
assert di[i] == repeat + i
Reported by Pylint.
Line: 15
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
for repeat in range(n):
for i in range(lo, hi):
di[i] = repeat + i
assert di[i] == repeat + i
del di[i]
assert i not in di
di[i] = repeat + i
Reported by Bandit.
examples/rp2/pio_pinchange.py
16 issues
Line: 12
Column: 1
# - instantiating 2x StateMachine's with the same program and different pins
import time
from machine import Pin
import rp2
@rp2.asm_pio()
def wait_pin_low():
Reported by Pylint.
Line: 13
Column: 1
import time
from machine import Pin
import rp2
@rp2.asm_pio()
def wait_pin_low():
wrap_target()
Reported by Pylint.
Line: 18
Column: 5
@rp2.asm_pio()
def wait_pin_low():
wrap_target()
wait(0, pin, 0)
irq(block, rel(0))
wait(1, pin, 0)
Reported by Pylint.
Line: 20
Column: 13
def wait_pin_low():
wrap_target()
wait(0, pin, 0)
irq(block, rel(0))
wait(1, pin, 0)
wrap()
Reported by Pylint.
Line: 20
Column: 5
def wait_pin_low():
wrap_target()
wait(0, pin, 0)
irq(block, rel(0))
wait(1, pin, 0)
wrap()
Reported by Pylint.
Line: 21
Column: 9
wrap_target()
wait(0, pin, 0)
irq(block, rel(0))
wait(1, pin, 0)
wrap()
Reported by Pylint.
Line: 21
Column: 5
wrap_target()
wait(0, pin, 0)
irq(block, rel(0))
wait(1, pin, 0)
wrap()
Reported by Pylint.
Line: 21
Column: 16
wrap_target()
wait(0, pin, 0)
irq(block, rel(0))
wait(1, pin, 0)
wrap()
Reported by Pylint.
Line: 22
Column: 5
wait(0, pin, 0)
irq(block, rel(0))
wait(1, pin, 0)
wrap()
def handler(sm):
Reported by Pylint.
Line: 22
Column: 13
wait(0, pin, 0)
irq(block, rel(0))
wait(1, pin, 0)
wrap()
def handler(sm):
Reported by Pylint.
tests/basics/class_super_multinherit.py
16 issues
Line: 1
Column: 1
# test super with multiple inheritance
class A:
def foo(self):
print('A.foo')
class B:
def foo(self):
print('B.foo')
Reported by Pylint.
Line: 3
Column: 1
# test super with multiple inheritance
class A:
def foo(self):
print('A.foo')
class B:
def foo(self):
print('B.foo')
Reported by Pylint.
Line: 3
Column: 1
# test super with multiple inheritance
class A:
def foo(self):
print('A.foo')
class B:
def foo(self):
print('B.foo')
Reported by Pylint.
Line: 3
Column: 1
# test super with multiple inheritance
class A:
def foo(self):
print('A.foo')
class B:
def foo(self):
print('B.foo')
Reported by Pylint.
Line: 4
Column: 5
# test super with multiple inheritance
class A:
def foo(self):
print('A.foo')
class B:
def foo(self):
print('B.foo')
Reported by Pylint.
Line: 4
Column: 5
# test super with multiple inheritance
class A:
def foo(self):
print('A.foo')
class B:
def foo(self):
print('B.foo')
Reported by Pylint.
Line: 4
Column: 5
# test super with multiple inheritance
class A:
def foo(self):
print('A.foo')
class B:
def foo(self):
print('B.foo')
Reported by Pylint.
Line: 7
Column: 1
def foo(self):
print('A.foo')
class B:
def foo(self):
print('B.foo')
class C(A, B):
def foo(self):
Reported by Pylint.
Line: 7
Column: 1
def foo(self):
print('A.foo')
class B:
def foo(self):
print('B.foo')
class C(A, B):
def foo(self):
Reported by Pylint.
Line: 7
Column: 1
def foo(self):
print('A.foo')
class B:
def foo(self):
print('B.foo')
class C(A, B):
def foo(self):
Reported by Pylint.
tests/basics/array1.py
16 issues
Line: 8
Column: 9
import array
except ImportError:
print("SKIP")
raise SystemExit
a = array.array('B', [1, 2, 3])
print(a, len(a))
i = array.array('I', [1, 2, 3])
print(i, len(i))
Reported by Pylint.
Line: 1
Column: 1
try:
import uarray as array
except ImportError:
try:
import array
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 48
Column: 7
print(array.array('b', [0x61, 0x62, 0x63]) != b'abc')
print(array.array('b', [0x61, 0x62, 0x63]) == b'xyz')
print(array.array('b', [0x61, 0x62, 0x63]) != b'xyz')
print(b'abc' == array.array('b', [0x61, 0x62, 0x63]))
print(b'abc' == array.array('B', [0x61, 0x62, 0x63]))
print(b'abc' != array.array('b', [0x61, 0x62, 0x63]))
print(b'xyz' == array.array('b', [0x61, 0x62, 0x63]))
print(b'xyz' != array.array('b', [0x61, 0x62, 0x63]))
Reported by Pylint.
Line: 49
Column: 7
print(array.array('b', [0x61, 0x62, 0x63]) == b'xyz')
print(array.array('b', [0x61, 0x62, 0x63]) != b'xyz')
print(b'abc' == array.array('b', [0x61, 0x62, 0x63]))
print(b'abc' == array.array('B', [0x61, 0x62, 0x63]))
print(b'abc' != array.array('b', [0x61, 0x62, 0x63]))
print(b'xyz' == array.array('b', [0x61, 0x62, 0x63]))
print(b'xyz' != array.array('b', [0x61, 0x62, 0x63]))
compatible_typecodes = []
Reported by Pylint.
Line: 50
Column: 7
print(array.array('b', [0x61, 0x62, 0x63]) != b'xyz')
print(b'abc' == array.array('b', [0x61, 0x62, 0x63]))
print(b'abc' == array.array('B', [0x61, 0x62, 0x63]))
print(b'abc' != array.array('b', [0x61, 0x62, 0x63]))
print(b'xyz' == array.array('b', [0x61, 0x62, 0x63]))
print(b'xyz' != array.array('b', [0x61, 0x62, 0x63]))
compatible_typecodes = []
for t in ["b", "h", "i", "l", "q"]:
Reported by Pylint.
Line: 51
Column: 7
print(b'abc' == array.array('b', [0x61, 0x62, 0x63]))
print(b'abc' == array.array('B', [0x61, 0x62, 0x63]))
print(b'abc' != array.array('b', [0x61, 0x62, 0x63]))
print(b'xyz' == array.array('b', [0x61, 0x62, 0x63]))
print(b'xyz' != array.array('b', [0x61, 0x62, 0x63]))
compatible_typecodes = []
for t in ["b", "h", "i", "l", "q"]:
compatible_typecodes.append((t, t))
Reported by Pylint.
Line: 52
Column: 7
print(b'abc' == array.array('B', [0x61, 0x62, 0x63]))
print(b'abc' != array.array('b', [0x61, 0x62, 0x63]))
print(b'xyz' == array.array('b', [0x61, 0x62, 0x63]))
print(b'xyz' != array.array('b', [0x61, 0x62, 0x63]))
compatible_typecodes = []
for t in ["b", "h", "i", "l", "q"]:
compatible_typecodes.append((t, t))
compatible_typecodes.append((t, t.upper()))
Reported by Pylint.
Line: 56
Column: 1
compatible_typecodes = []
for t in ["b", "h", "i", "l", "q"]:
compatible_typecodes.append((t, t))
compatible_typecodes.append((t, t.upper()))
for a, b in compatible_typecodes:
print(array.array(a, [1, 2]) == array.array(b, [1, 2]))
class X(array.array):
Reported by Pylint.
Line: 57
Column: 1
compatible_typecodes = []
for t in ["b", "h", "i", "l", "q"]:
compatible_typecodes.append((t, t))
compatible_typecodes.append((t, t.upper()))
for a, b in compatible_typecodes:
print(array.array(a, [1, 2]) == array.array(b, [1, 2]))
class X(array.array):
pass
Reported by Pylint.
Line: 59
Column: 1
compatible_typecodes.append((t, t))
compatible_typecodes.append((t, t.upper()))
for a, b in compatible_typecodes:
print(array.array(a, [1, 2]) == array.array(b, [1, 2]))
class X(array.array):
pass
print(bytes(X('b', [0x61, 0x62, 0x63])) == b'abc')
Reported by Pylint.
tests/extmod/vfs_fat_ramdisklarge.py
16 issues
Line: 7
Column: 5
import uos
except ImportError:
print("SKIP")
raise SystemExit
try:
uos.VfsFat
except AttributeError:
print("SKIP")
Reported by Pylint.
Line: 13
Column: 5
uos.VfsFat
except AttributeError:
print("SKIP")
raise SystemExit
class RAMBDevSparse:
SEC_SIZE = 512
Reported by Pylint.
Line: 40
Column: 25
self.data[s] = bytearray(self.SEC_SIZE)
self.data[s][:] = mv[off : off + self.SEC_SIZE]
def ioctl(self, op, arg):
# print("ioctl(%d, %r)" % (op, arg))
if op == 4: # MP_BLOCKDEV_IOCTL_BLOCK_COUNT
return self.blocks
if op == 5: # MP_BLOCKDEV_IOCTL_BLOCK_SIZE
return self.SEC_SIZE
Reported by Pylint.
Line: 53
Column: 5
uos.VfsFat.mkfs(bdev)
except MemoryError:
print("SKIP")
raise SystemExit
vfs = uos.VfsFat(bdev)
uos.mount(vfs, "/ramdisk")
print("statvfs:", vfs.statvfs("/ramdisk"))
Reported by Pylint.
Line: 1
Column: 1
# test making a FAT filesystem on a very large block device
try:
import uos
except ImportError:
print("SKIP")
raise SystemExit
try:
Reported by Pylint.
Line: 16
Column: 1
raise SystemExit
class RAMBDevSparse:
SEC_SIZE = 512
def __init__(self, blocks):
self.blocks = blocks
Reported by Pylint.
Line: 24
Column: 5
self.blocks = blocks
self.data = {}
def readblocks(self, n, buf):
# print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))
assert len(buf) == self.SEC_SIZE
if n not in self.data:
self.data[n] = bytearray(self.SEC_SIZE)
buf[:] = self.data[n]
Reported by Pylint.
Line: 24
Column: 5
self.blocks = blocks
self.data = {}
def readblocks(self, n, buf):
# print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))
assert len(buf) == self.SEC_SIZE
if n not in self.data:
self.data[n] = bytearray(self.SEC_SIZE)
buf[:] = self.data[n]
Reported by Pylint.
Line: 26
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def readblocks(self, n, buf):
# print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))
assert len(buf) == self.SEC_SIZE
if n not in self.data:
self.data[n] = bytearray(self.SEC_SIZE)
buf[:] = self.data[n]
def writeblocks(self, n, buf):
Reported by Bandit.
Line: 31
Column: 5
self.data[n] = bytearray(self.SEC_SIZE)
buf[:] = self.data[n]
def writeblocks(self, n, buf):
# print("writeblocks(%s, %x)" % (n, id(buf)))
mv = memoryview(buf)
for off in range(0, len(buf), self.SEC_SIZE):
s = n + off // self.SEC_SIZE
if s not in self.data:
Reported by Pylint.
tests/extmod/uasyncio_lock.py
16 issues
Line: 10
Column: 9
import asyncio
except ImportError:
print("SKIP")
raise SystemExit
async def task_loop(id, lock):
print("task start", id)
for i in range(3):
Reported by Pylint.
Line: 13
Column: 21
raise SystemExit
async def task_loop(id, lock):
print("task start", id)
for i in range(3):
async with lock:
print("task have", id, i)
print("task end", id)
Reported by Pylint.
Line: 31
Column: 23
lock.release()
async def task_cancel(id, lock, to_cancel=None):
try:
async with lock:
print("task got", id)
await asyncio.sleep(0.1)
print("task release", id)
Reported by Pylint.
Line: 86
Column: 5
# 3 tasks, the second and third being cancelled while waiting on the lock
print("----")
t0 = asyncio.create_task(task_cancel(0, lock))
t1 = asyncio.create_task(task_cancel(1, lock))
t2 = asyncio.create_task(task_cancel(2, lock))
await asyncio.sleep(0.05)
t1.cancel()
await asyncio.sleep(0.1)
Reported by Pylint.
Line: 1
Column: 1
# Test Lock class
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_loop(id, lock):
print("task start", id)
for i in range(3):
async with lock:
print("task have", id, i)
print("task end", id)
Reported by Pylint.
Line: 13
Column: 1
raise SystemExit
async def task_loop(id, lock):
print("task start", id)
for i in range(3):
async with lock:
print("task have", id, i)
print("task end", id)
Reported by Pylint.
Line: 21
Column: 1
print("task end", id)
async def task_sleep(lock):
async with lock:
print("task have", lock.locked())
await asyncio.sleep(0.2)
print("task release", lock.locked())
await lock.acquire()
Reported by Pylint.
Line: 31
Column: 1
lock.release()
async def task_cancel(id, lock, to_cancel=None):
try:
async with lock:
print("task got", id)
await asyncio.sleep(0.1)
print("task release", id)
Reported by Pylint.
Line: 31
Column: 1
lock.release()
async def task_cancel(id, lock, to_cancel=None):
try:
async with lock:
print("task got", id)
await asyncio.sleep(0.1)
print("task release", id)
Reported by Pylint.
tests/basics/class_store_class.py
16 issues
Line: 18
Column: 16
class _ResultMixinStr(object):
def encode(self):
return self._encoded_counterpart(*(x.encode() for x in self))
class _ResultMixinBytes(object):
def decode(self):
return self._decoded_counterpart(*(x.decode() for x in self))
Reported by Pylint.
Line: 18
Column: 64
class _ResultMixinStr(object):
def encode(self):
return self._encoded_counterpart(*(x.encode() for x in self))
class _ResultMixinBytes(object):
def decode(self):
return self._decoded_counterpart(*(x.decode() for x in self))
Reported by Pylint.
Line: 22
Column: 16
class _ResultMixinBytes(object):
def decode(self):
return self._decoded_counterpart(*(x.decode() for x in self))
class DefragResult(_DefragResultBase, _ResultMixinStr):
pass
class DefragResultBytes(_DefragResultBase, _ResultMixinBytes):
Reported by Pylint.
Line: 22
Column: 64
class _ResultMixinBytes(object):
def decode(self):
return self._decoded_counterpart(*(x.decode() for x in self))
class DefragResult(_DefragResultBase, _ResultMixinStr):
pass
class DefragResultBytes(_DefragResultBase, _ResultMixinBytes):
Reported by Pylint.
Line: 12
Column: 9
from ucollections import namedtuple
except ImportError:
print("SKIP")
raise SystemExit
_DefragResultBase = namedtuple('DefragResult', [ 'foo', 'bar' ])
class _ResultMixinStr(object):
def encode(self):
Reported by Pylint.
Line: 31
Column: 1
pass
DefragResult._encoded_counterpart = DefragResultBytes
DefragResultBytes._decoded_counterpart = DefragResult
# Due to differences in type and native subclass printing,
# the best thing we can do here is to just test that no exceptions
# happen
Reported by Pylint.
Line: 32
Column: 1
DefragResult._encoded_counterpart = DefragResultBytes
DefragResultBytes._decoded_counterpart = DefragResult
# Due to differences in type and native subclass printing,
# the best thing we can do here is to just test that no exceptions
# happen
Reported by Pylint.
Line: 1
Column: 1
# Inspired by urlparse.py from CPython 3.3 stdlib
# There was a bug in MicroPython that under some conditions class stored
# in instance attribute later was returned "bound" as if it was a method,
# which caused class constructor to receive extra argument.
try:
from collections import namedtuple
except ImportError:
try:
from ucollections import namedtuple
Reported by Pylint.
Line: 16
Column: 1
_DefragResultBase = namedtuple('DefragResult', [ 'foo', 'bar' ])
class _ResultMixinStr(object):
def encode(self):
return self._encoded_counterpart(*(x.encode() for x in self))
class _ResultMixinBytes(object):
def decode(self):
Reported by Pylint.
Line: 16
Column: 1
_DefragResultBase = namedtuple('DefragResult', [ 'foo', 'bar' ])
class _ResultMixinStr(object):
def encode(self):
return self._encoded_counterpart(*(x.encode() for x in self))
class _ResultMixinBytes(object):
def decode(self):
Reported by Pylint.