The following issues were found
tests/basics/string_format_error.py
10 issues
Line: 62
Column: 5
print('ValueError')
try:
'{}{}'.format(1)
except IndexError:
print('IndexError')
try:
'{0:+s}'.format('1')
Reported by Pylint.
Line: 14
Column: 5
print('IndexError')
try:
'}'.format('zzzz')
except ValueError:
print('ValueError')
# end of format parsing conversion specifier
try:
Reported by Pylint.
Line: 20
Column: 5
# end of format parsing conversion specifier
try:
'{!'.format('a')
except ValueError:
print('ValueError')
# unknown conversion specifier
try:
Reported by Pylint.
Line: 31
Column: 5
print('ValueError')
try:
'{abc'.format('zzzz')
except ValueError:
print('ValueError')
# expected ':' after specifier
try:
Reported by Pylint.
Line: 37
Column: 5
# expected ':' after specifier
try:
'{!s :}'.format(2)
except ValueError:
print('ValueError')
try:
'{}{0}'.format(1, 2)
Reported by Pylint.
Line: 42
Column: 5
print('ValueError')
try:
'{}{0}'.format(1, 2)
except ValueError:
print('ValueError')
try:
'{1:}'.format(1)
Reported by Pylint.
Line: 52
Column: 5
print('IndexError')
try:
'{ 0 :*^10}'.format(12)
except KeyError:
print('KeyError')
try:
'{0}{}'.format(1)
Reported by Pylint.
Line: 57
Column: 5
print('KeyError')
try:
'{0}{}'.format(1)
except ValueError:
print('ValueError')
try:
'{}{}'.format(1)
Reported by Pylint.
Line: 1
Column: 1
# tests for errors in {} format string
try:
'{0:0}'.format('zzz')
except (ValueError):
print('ValueError')
try:
'{1:}'.format(1)
Reported by Pylint.
Line: 5
Column: 1
try:
'{0:0}'.format('zzz')
except (ValueError):
print('ValueError')
try:
'{1:}'.format(1)
except IndexError:
Reported by Pylint.
tests/unix/ffi_callback.py
10 issues
Line: 5
Column: 5
import ffi
except ImportError:
print("SKIP")
raise SystemExit
def ffi_open(names):
err = None
for n in names:
Reported by Pylint.
Line: 1
Column: 1
try:
import ffi
except ImportError:
print("SKIP")
raise SystemExit
def ffi_open(names):
err = None
Reported by Pylint.
Line: 8
Column: 1
raise SystemExit
def ffi_open(names):
err = None
for n in names:
try:
mod = ffi.open(n)
return mod
Reported by Pylint.
Line: 10
Column: 9
def ffi_open(names):
err = None
for n in names:
try:
mod = ffi.open(n)
return mod
except OSError as e:
err = e
Reported by Pylint.
Line: 14
Column: 9
try:
mod = ffi.open(n)
return mod
except OSError as e:
err = e
raise err
libc = ffi_open(("libc.so", "libc.so.0", "libc.so.6", "libc.dylib"))
Reported by Pylint.
Line: 24
Column: 1
qsort = libc.func("v", "qsort", "piip")
def cmp(pa, pb):
a = ffi.as_bytearray(pa, 1)
b = ffi.as_bytearray(pb, 1)
# print("cmp:", a, b)
return a[0] - b[0]
Reported by Pylint.
Line: 24
Column: 1
qsort = libc.func("v", "qsort", "piip")
def cmp(pa, pb):
a = ffi.as_bytearray(pa, 1)
b = ffi.as_bytearray(pb, 1)
# print("cmp:", a, b)
return a[0] - b[0]
Reported by Pylint.
Line: 24
Column: 1
qsort = libc.func("v", "qsort", "piip")
def cmp(pa, pb):
a = ffi.as_bytearray(pa, 1)
b = ffi.as_bytearray(pb, 1)
# print("cmp:", a, b)
return a[0] - b[0]
Reported by Pylint.
Line: 25
Column: 5
def cmp(pa, pb):
a = ffi.as_bytearray(pa, 1)
b = ffi.as_bytearray(pb, 1)
# print("cmp:", a, b)
return a[0] - b[0]
Reported by Pylint.
Line: 26
Column: 5
def cmp(pa, pb):
a = ffi.as_bytearray(pa, 1)
b = ffi.as_bytearray(pb, 1)
# print("cmp:", a, b)
return a[0] - b[0]
cmp_c = ffi.callback("i", cmp, "pp")
Reported by Pylint.
tests/thread/thread_lock4.py
10 issues
Line: 14
Column: 9
def fac(n):
x = 1
for i in range(1, n + 1):
x *= i
return x
def thread_entry():
Reported by Pylint.
Line: 23
Column: 20
while True:
with jobs_lock:
try:
f, arg = jobs.pop(0)
except IndexError:
return
ans = f(arg)
with output_lock:
output.append((arg, ans))
Reported by Pylint.
Line: 26
Column: 9
f, arg = jobs.pop(0)
except IndexError:
return
ans = f(arg)
with output_lock:
output.append((arg, ans))
# create a list of jobs
Reported by Pylint.
Line: 1
Column: 1
# test using lock to coordinate access to global mutable objects
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
try:
import utime as time
except ImportError:
import time
import _thread
Reported by Pylint.
Line: 12
Column: 1
import _thread
def fac(n):
x = 1
for i in range(1, n + 1):
x *= i
return x
Reported by Pylint.
Line: 12
Column: 1
import _thread
def fac(n):
x = 1
for i in range(1, n + 1):
x *= i
return x
Reported by Pylint.
Line: 13
Column: 5
def fac(n):
x = 1
for i in range(1, n + 1):
x *= i
return x
Reported by Pylint.
Line: 15
Column: 9
def fac(n):
x = 1
for i in range(1, n + 1):
x *= i
return x
def thread_entry():
while True:
Reported by Pylint.
Line: 19
Column: 1
return x
def thread_entry():
while True:
with jobs_lock:
try:
f, arg = jobs.pop(0)
except IndexError:
Reported by Pylint.
Line: 23
Column: 17
while True:
with jobs_lock:
try:
f, arg = jobs.pop(0)
except IndexError:
return
ans = f(arg)
with output_lock:
output.append((arg, ans))
Reported by Pylint.
tests/basics/class_inplace_op.py
10 issues
Line: 1
Column: 1
# Case 1: Immutable object (e.g. number-like)
# __iadd__ should not be defined, will be emulated using __add__
class A:
def __init__(self, v):
self.v = v
def __add__(self, o):
Reported by Pylint.
Line: 4
Column: 1
# Case 1: Immutable object (e.g. number-like)
# __iadd__ should not be defined, will be emulated using __add__
class A:
def __init__(self, v):
self.v = v
def __add__(self, o):
Reported by Pylint.
Line: 4
Column: 1
# Case 1: Immutable object (e.g. number-like)
# __iadd__ should not be defined, will be emulated using __add__
class A:
def __init__(self, v):
self.v = v
def __add__(self, o):
Reported by Pylint.
Line: 7
Column: 9
class A:
def __init__(self, v):
self.v = v
def __add__(self, o):
return A(self.v + o.v)
def __repr__(self):
Reported by Pylint.
Line: 9
Column: 5
def __init__(self, v):
self.v = v
def __add__(self, o):
return A(self.v + o.v)
def __repr__(self):
return "A({})".format(self.v)
Reported by Pylint.
Line: 25
Column: 1
# Case 2: Mutable object (e.g. list-like)
# __iadd__ should be defined
class L:
def __init__(self, v):
self.v = v
def __add__(self, o):
Reported by Pylint.
Line: 25
Column: 1
# Case 2: Mutable object (e.g. list-like)
# __iadd__ should be defined
class L:
def __init__(self, v):
self.v = v
def __add__(self, o):
Reported by Pylint.
Line: 28
Column: 9
class L:
def __init__(self, v):
self.v = v
def __add__(self, o):
# Should not be caled in this test
print("L.__add__")
return L(self.v + o.v)
Reported by Pylint.
Line: 30
Column: 5
def __init__(self, v):
self.v = v
def __add__(self, o):
# Should not be caled in this test
print("L.__add__")
return L(self.v + o.v)
def __iadd__(self, o):
Reported by Pylint.
Line: 35
Column: 5
print("L.__add__")
return L(self.v + o.v)
def __iadd__(self, o):
self.v += o.v
return self
def __repr__(self):
return "L({})".format(self.v)
Reported by Pylint.
tests/extmod/uasyncio_lock_cancel.py
10 issues
Line: 10
Column: 9
import asyncio
except ImportError:
print("SKIP")
raise SystemExit
async def task(i, lock, lock_flag):
print("task", i, "start")
try:
Reported by Pylint.
Line: 35
Column: 5
lock_flag = [True]
# Create 4 tasks and let them all run
t0 = asyncio.create_task(task(0, lock, lock_flag))
t1 = asyncio.create_task(task(1, lock, lock_flag))
t2 = asyncio.create_task(task(2, lock, lock_flag))
t3 = asyncio.create_task(task(3, lock, lock_flag))
await asyncio.sleep(0)
Reported by Pylint.
Line: 38
Column: 5
t0 = asyncio.create_task(task(0, lock, lock_flag))
t1 = asyncio.create_task(task(1, lock, lock_flag))
t2 = asyncio.create_task(task(2, lock, lock_flag))
t3 = asyncio.create_task(task(3, lock, lock_flag))
await asyncio.sleep(0)
# Cancel 2 of the tasks (which are waiting on the lock) and release the lock
t1.cancel()
t2.cancel()
Reported by Pylint.
Line: 1
Column: 1
# Test that locks work when cancelling multiple waiters on the lock
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(i, lock, lock_flag):
print("task", i, "start")
try:
await lock.acquire()
except asyncio.CancelledError:
print("task", i, "cancel")
Reported by Pylint.
Line: 28
Column: 1
print("task", i, "done")
async def main():
# Create a lock and acquire it so the tasks below must wait
lock = asyncio.Lock()
await lock.acquire()
lock_flag = [True]
Reported by Pylint.
Line: 35
Column: 5
lock_flag = [True]
# Create 4 tasks and let them all run
t0 = asyncio.create_task(task(0, lock, lock_flag))
t1 = asyncio.create_task(task(1, lock, lock_flag))
t2 = asyncio.create_task(task(2, lock, lock_flag))
t3 = asyncio.create_task(task(3, lock, lock_flag))
await asyncio.sleep(0)
Reported by Pylint.
Line: 36
Column: 5
# Create 4 tasks and let them all run
t0 = asyncio.create_task(task(0, lock, lock_flag))
t1 = asyncio.create_task(task(1, lock, lock_flag))
t2 = asyncio.create_task(task(2, lock, lock_flag))
t3 = asyncio.create_task(task(3, lock, lock_flag))
await asyncio.sleep(0)
# Cancel 2 of the tasks (which are waiting on the lock) and release the lock
Reported by Pylint.
Line: 37
Column: 5
# Create 4 tasks and let them all run
t0 = asyncio.create_task(task(0, lock, lock_flag))
t1 = asyncio.create_task(task(1, lock, lock_flag))
t2 = asyncio.create_task(task(2, lock, lock_flag))
t3 = asyncio.create_task(task(3, lock, lock_flag))
await asyncio.sleep(0)
# Cancel 2 of the tasks (which are waiting on the lock) and release the lock
t1.cancel()
Reported by Pylint.
Line: 38
Column: 5
t0 = asyncio.create_task(task(0, lock, lock_flag))
t1 = asyncio.create_task(task(1, lock, lock_flag))
t2 = asyncio.create_task(task(2, lock, lock_flag))
t3 = asyncio.create_task(task(3, lock, lock_flag))
await asyncio.sleep(0)
# Cancel 2 of the tasks (which are waiting on the lock) and release the lock
t1.cancel()
t2.cancel()
Reported by Pylint.
tests/basics/class_descriptor.py
10 issues
Line: 25
Column: 5
m.__class__
except AttributeError:
print("SKIP")
raise SystemExit
r = m.Forward
if 'Descriptor' in repr(r.__class__):
print('SKIP')
raise SystemExit
Reported by Pylint.
Line: 1
Column: 1
class Descriptor:
def __get__(self, obj, cls):
print('get')
print(type(obj) is Main)
print(cls is Main)
return 'result'
def __set__(self, obj, val):
print('set')
Reported by Pylint.
Line: 1
Column: 1
class Descriptor:
def __get__(self, obj, cls):
print('get')
print(type(obj) is Main)
print(cls is Main)
return 'result'
def __set__(self, obj, val):
print('set')
Reported by Pylint.
Line: 4
Column: 15
class Descriptor:
def __get__(self, obj, cls):
print('get')
print(type(obj) is Main)
print(cls is Main)
return 'result'
def __set__(self, obj, val):
print('set')
Reported by Pylint.
Line: 10
Column: 15
def __set__(self, obj, val):
print('set')
print(type(obj) is Main)
print(val)
def __delete__(self, obj):
print('delete')
print(type(obj) is Main)
Reported by Pylint.
Line: 15
Column: 15
def __delete__(self, obj):
print('delete')
print(type(obj) is Main)
class Main:
Forward = Descriptor()
m = Main()
Reported by Pylint.
Line: 17
Column: 1
print('delete')
print(type(obj) is Main)
class Main:
Forward = Descriptor()
m = Main()
try:
m.__class__
Reported by Pylint.
Line: 17
Column: 1
print('delete')
print(type(obj) is Main)
class Main:
Forward = Descriptor()
m = Main()
try:
m.__class__
Reported by Pylint.
Line: 27
Column: 1
print("SKIP")
raise SystemExit
r = m.Forward
if 'Descriptor' in repr(r.__class__):
print('SKIP')
raise SystemExit
print(r)
Reported by Pylint.
Line: 33
Column: 1
raise SystemExit
print(r)
m.Forward = 'a'
del m.Forward
Reported by Pylint.
tests/basics/class3.py
10 issues
Line: 4
Column: 5
# inheritance
class A:
def a():
print('A.a() called')
class B(A):
pass
Reported by Pylint.
Line: 1
Column: 1
# inheritance
class A:
def a():
print('A.a() called')
class B(A):
pass
Reported by Pylint.
Line: 3
Column: 1
# inheritance
class A:
def a():
print('A.a() called')
class B(A):
pass
Reported by Pylint.
Line: 3
Column: 1
# inheritance
class A:
def a():
print('A.a() called')
class B(A):
pass
Reported by Pylint.
Line: 3
Column: 1
# inheritance
class A:
def a():
print('A.a() called')
class B(A):
pass
Reported by Pylint.
Line: 4
Column: 5
# inheritance
class A:
def a():
print('A.a() called')
class B(A):
pass
Reported by Pylint.
Line: 4
Column: 5
# inheritance
class A:
def a():
print('A.a() called')
class B(A):
pass
Reported by Pylint.
Line: 7
Column: 1
def a():
print('A.a() called')
class B(A):
pass
print(type(A))
print(type(B))
Reported by Pylint.
Line: 7
Column: 1
def a():
print('A.a() called')
class B(A):
pass
print(type(A))
print(type(B))
Reported by Pylint.
Line: 7
Column: 1
def a():
print('A.a() called')
class B(A):
pass
print(type(A))
print(type(B))
Reported by Pylint.
tests/basics/generator_name.py
10 issues
Line: 16
Column: 5
print(A().Fun.__name__)
except AttributeError:
print('SKIP')
raise SystemExit
Reported by Pylint.
Line: 1
Column: 1
# test __name__ on generator functions
def Fun():
yield
class A:
def Fun(self):
yield
Reported by Pylint.
Line: 3
Column: 1
# test __name__ on generator functions
def Fun():
yield
class A:
def Fun(self):
yield
Reported by Pylint.
Line: 3
Column: 1
# test __name__ on generator functions
def Fun():
yield
class A:
def Fun(self):
yield
Reported by Pylint.
Line: 6
Column: 1
def Fun():
yield
class A:
def Fun(self):
yield
try:
print(Fun.__name__)
Reported by Pylint.
Line: 6
Column: 1
def Fun():
yield
class A:
def Fun(self):
yield
try:
print(Fun.__name__)
Reported by Pylint.
Line: 6
Column: 1
def Fun():
yield
class A:
def Fun(self):
yield
try:
print(Fun.__name__)
Reported by Pylint.
Line: 7
Column: 5
yield
class A:
def Fun(self):
yield
try:
print(Fun.__name__)
print(A.Fun.__name__)
Reported by Pylint.
Line: 7
Column: 5
yield
class A:
def Fun(self):
yield
try:
print(Fun.__name__)
print(A.Fun.__name__)
Reported by Pylint.
Line: 7
Column: 5
yield
class A:
def Fun(self):
yield
try:
print(Fun.__name__)
print(A.Fun.__name__)
Reported by Pylint.
tests/internal_bench/func_args-1.2-pos_3.py
10 issues
Line: 4
Column: 10
import bench
def func(a, b, c):
pass
def test(num):
for i in iter(range(num)):
Reported by Pylint.
Line: 4
Column: 16
import bench
def func(a, b, c):
pass
def test(num):
for i in iter(range(num)):
Reported by Pylint.
Line: 4
Column: 13
import bench
def func(a, b, c):
pass
def test(num):
for i in iter(range(num)):
Reported by Pylint.
Line: 1
Column: 1
import bench
def func(a, b, c):
pass
def test(num):
for i in iter(range(num)):
Reported by Pylint.
Line: 1
Column: 1
import bench
def func(a, b, c):
pass
def test(num):
for i in iter(range(num)):
Reported by Pylint.
Line: 4
Column: 1
import bench
def func(a, b, c):
pass
def test(num):
for i in iter(range(num)):
Reported by Pylint.
Line: 4
Column: 1
import bench
def func(a, b, c):
pass
def test(num):
for i in iter(range(num)):
Reported by Pylint.
Line: 4
Column: 1
import bench
def func(a, b, c):
pass
def test(num):
for i in iter(range(num)):
Reported by Pylint.
Line: 4
Column: 1
import bench
def func(a, b, c):
pass
def test(num):
for i in iter(range(num)):
Reported by Pylint.
Line: 8
Column: 1
pass
def test(num):
for i in iter(range(num)):
func(i, i, i)
bench.run(test)
Reported by Pylint.
tests/basics/slice_attrs.py
10 issues
Line: 12
Column: 5
t = A()[1:2]
except:
print("SKIP")
raise SystemExit
A()[1:2:3]
# test storing to attr (shouldn't be allowed)
Reported by Pylint.
Line: 15
Column: 1
raise SystemExit
A()[1:2:3]
# test storing to attr (shouldn't be allowed)
class B:
def __getitem__(self, idx):
try:
Reported by Pylint.
Line: 24
Column: 1
idx.start = 0
except AttributeError:
print('AttributeError')
B()[:]
Reported by Pylint.
Line: 1
Column: 1
# test builtin slice attributes access
# print slice attributes
class A:
def __getitem__(self, idx):
print(idx.start, idx.stop, idx.step)
try:
t = A()[1:2]
Reported by Pylint.
Line: 4
Column: 1
# test builtin slice attributes access
# print slice attributes
class A:
def __getitem__(self, idx):
print(idx.start, idx.stop, idx.step)
try:
t = A()[1:2]
Reported by Pylint.
Line: 4
Column: 1
# test builtin slice attributes access
# print slice attributes
class A:
def __getitem__(self, idx):
print(idx.start, idx.stop, idx.step)
try:
t = A()[1:2]
Reported by Pylint.
Line: 4
Column: 1
# test builtin slice attributes access
# print slice attributes
class A:
def __getitem__(self, idx):
print(idx.start, idx.stop, idx.step)
try:
t = A()[1:2]
Reported by Pylint.
Line: 18
Column: 1
A()[1:2:3]
# test storing to attr (shouldn't be allowed)
class B:
def __getitem__(self, idx):
try:
idx.start = 0
except AttributeError:
print('AttributeError')
Reported by Pylint.
Line: 18
Column: 1
A()[1:2:3]
# test storing to attr (shouldn't be allowed)
class B:
def __getitem__(self, idx):
try:
idx.start = 0
except AttributeError:
print('AttributeError')
Reported by Pylint.
Line: 18
Column: 1
A()[1:2:3]
# test storing to attr (shouldn't be allowed)
class B:
def __getitem__(self, idx):
try:
idx.start = 0
except AttributeError:
print('AttributeError')
Reported by Pylint.