The following issues were found
tests/multi_bluetooth/ble_gattc_discover_services.py
23 issues
Line: 3
Column: 1
# Test BLE GAP connect/disconnect
from micropython import const
import time, machine, bluetooth
TIMEOUT_MS = 5000
_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)
Reported by Pylint.
Line: 4
Column: 1
# Test BLE GAP connect/disconnect
from micropython import const
import time, machine, bluetooth
TIMEOUT_MS = 5000
_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)
Reported by Pylint.
Line: 4
Column: 1
# Test BLE GAP connect/disconnect
from micropython import const
import time, machine, bluetooth
TIMEOUT_MS = 5000
_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)
Reported by Pylint.
Line: 55
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: 56
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: 56
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: 65
Column: 5
# Acting in peripheral role.
def instance0():
multitest.globals(BDADDR=ble.config("mac"))
ble.gatts_register_services(SERVICES)
print("gap_advertise")
ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
multitest.next()
try:
Reported by Pylint.
Line: 69
Column: 5
ble.gatts_register_services(SERVICES)
print("gap_advertise")
ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
multitest.next()
try:
wait_for_event(_IRQ_CENTRAL_CONNECT, TIMEOUT_MS)
wait_for_event(_IRQ_CENTRAL_DISCONNECT, TIMEOUT_MS)
finally:
ble.active(0)
Reported by Pylint.
Line: 79
Column: 5
# Acting in central role.
def instance1():
multitest.next()
try:
# Connect to peripheral and then disconnect.
print("gap_connect")
ble.gap_connect(*BDADDR)
conn_handle = wait_for_event(_IRQ_PERIPHERAL_CONNECT, TIMEOUT_MS)
Reported by Pylint.
Line: 83
Column: 26
try:
# Connect to peripheral and then disconnect.
print("gap_connect")
ble.gap_connect(*BDADDR)
conn_handle = wait_for_event(_IRQ_PERIPHERAL_CONNECT, TIMEOUT_MS)
# Discover services.
ble.gattc_discover_services(conn_handle)
wait_for_event(_IRQ_GATTC_SERVICE_DONE, TIMEOUT_MS)
Reported by Pylint.
examples/rp2/pio_pwm.py
23 issues
Line: 3
Column: 1
# Example of using PIO for PWM, and fading the brightness of an LED
from machine import Pin
from rp2 import PIO, StateMachine, asm_pio
from time import sleep
@asm_pio(sideset_init=PIO.OUT_LOW)
def pwm_prog():
Reported by Pylint.
Line: 4
Column: 1
# Example of using PIO for PWM, and fading the brightness of an LED
from machine import Pin
from rp2 import PIO, StateMachine, asm_pio
from time import sleep
@asm_pio(sideset_init=PIO.OUT_LOW)
def pwm_prog():
Reported by Pylint.
Line: 11
Column: 5
@asm_pio(sideset_init=PIO.OUT_LOW)
def pwm_prog():
# fmt: off
pull(noblock) .side(0)
mov(x, osr) # Keep most recent pull data stashed in X, for recycling by noblock
mov(y, isr) # ISR must be preloaded with PWM count max
label("pwmloop")
jmp(x_not_y, "skip")
nop() .side(1)
Reported by Pylint.
Line: 11
Column: 10
@asm_pio(sideset_init=PIO.OUT_LOW)
def pwm_prog():
# fmt: off
pull(noblock) .side(0)
mov(x, osr) # Keep most recent pull data stashed in X, for recycling by noblock
mov(y, isr) # ISR must be preloaded with PWM count max
label("pwmloop")
jmp(x_not_y, "skip")
nop() .side(1)
Reported by Pylint.
Line: 12
Column: 9
def pwm_prog():
# fmt: off
pull(noblock) .side(0)
mov(x, osr) # Keep most recent pull data stashed in X, for recycling by noblock
mov(y, isr) # ISR must be preloaded with PWM count max
label("pwmloop")
jmp(x_not_y, "skip")
nop() .side(1)
label("skip")
Reported by Pylint.
Line: 12
Column: 5
def pwm_prog():
# fmt: off
pull(noblock) .side(0)
mov(x, osr) # Keep most recent pull data stashed in X, for recycling by noblock
mov(y, isr) # ISR must be preloaded with PWM count max
label("pwmloop")
jmp(x_not_y, "skip")
nop() .side(1)
label("skip")
Reported by Pylint.
Line: 12
Column: 12
def pwm_prog():
# fmt: off
pull(noblock) .side(0)
mov(x, osr) # Keep most recent pull data stashed in X, for recycling by noblock
mov(y, isr) # ISR must be preloaded with PWM count max
label("pwmloop")
jmp(x_not_y, "skip")
nop() .side(1)
label("skip")
Reported by Pylint.
Line: 13
Column: 12
# fmt: off
pull(noblock) .side(0)
mov(x, osr) # Keep most recent pull data stashed in X, for recycling by noblock
mov(y, isr) # ISR must be preloaded with PWM count max
label("pwmloop")
jmp(x_not_y, "skip")
nop() .side(1)
label("skip")
jmp(y_dec, "pwmloop")
Reported by Pylint.
Line: 13
Column: 5
# fmt: off
pull(noblock) .side(0)
mov(x, osr) # Keep most recent pull data stashed in X, for recycling by noblock
mov(y, isr) # ISR must be preloaded with PWM count max
label("pwmloop")
jmp(x_not_y, "skip")
nop() .side(1)
label("skip")
jmp(y_dec, "pwmloop")
Reported by Pylint.
Line: 13
Column: 9
# fmt: off
pull(noblock) .side(0)
mov(x, osr) # Keep most recent pull data stashed in X, for recycling by noblock
mov(y, isr) # ISR must be preloaded with PWM count max
label("pwmloop")
jmp(x_not_y, "skip")
nop() .side(1)
label("skip")
jmp(y_dec, "pwmloop")
Reported by Pylint.
tests/net_inet/test_tls_nonblock.py
23 issues
Line: 3
Column: 1
try:
import usocket as socket, ussl as ssl, uerrno as errno, sys
except:
import socket, ssl, errno, sys, time, select
def test_one(site, opts):
ai = socket.getaddrinfo(site, 443)
addr = ai[0][-1]
Reported by Pylint.
Line: 7
Column: 20
import socket, ssl, errno, sys, time, select
def test_one(site, opts):
ai = socket.getaddrinfo(site, 443)
addr = ai[0][-1]
print(addr)
# Connect the raw socket
Reported by Pylint.
Line: 30
Column: 21
# Wrap with SSL
try:
if sys.implementation.name == "micropython":
s = ssl.wrap_socket(s, do_handshake=False)
else:
s = ssl.wrap_socket(s, do_handshake_on_connect=False)
except OSError as e:
if e.errno != errno.EINPROGRESS:
raise
Reported by Pylint.
Line: 32
Column: 21
if sys.implementation.name == "micropython":
s = ssl.wrap_socket(s, do_handshake=False)
else:
s = ssl.wrap_socket(s, do_handshake_on_connect=False)
except OSError as e:
if e.errno != errno.EINPROGRESS:
raise
print("wrapped")
Reported by Pylint.
Line: 111
Column: 9
try:
test_one(site, opts)
print(site, "ok")
except Exception as e:
print(site, "error")
print("DONE")
main()
Reported by Pylint.
Line: 111
Column: 16
try:
test_one(site, opts)
print(site, "ok")
except Exception as e:
print(site, "error")
print("DONE")
main()
Reported by Pylint.
Line: 1
Column: 1
try:
import usocket as socket, ussl as ssl, uerrno as errno, sys
except:
import socket, ssl, errno, sys, time, select
def test_one(site, opts):
ai = socket.getaddrinfo(site, 443)
addr = ai[0][-1]
Reported by Pylint.
Line: 2
Column: 5
try:
import usocket as socket, ussl as ssl, uerrno as errno, sys
except:
import socket, ssl, errno, sys, time, select
def test_one(site, opts):
ai = socket.getaddrinfo(site, 443)
addr = ai[0][-1]
Reported by Pylint.
Line: 4
Column: 5
try:
import usocket as socket, ussl as ssl, uerrno as errno, sys
except:
import socket, ssl, errno, sys, time, select
def test_one(site, opts):
ai = socket.getaddrinfo(site, 443)
addr = ai[0][-1]
Reported by Pylint.
Line: 4
Column: 5
try:
import usocket as socket, ussl as ssl, uerrno as errno, sys
except:
import socket, ssl, errno, sys, time, select
def test_one(site, opts):
ai = socket.getaddrinfo(site, 443)
addr = ai[0][-1]
Reported by Pylint.
tests/multi_bluetooth/ble_mtu.py
23 issues
Line: 22
Column: 1
# - btstack doesn't truncate writes to the MTU (it fails instead)
# - btstack (in central mode) doesn't handle the peripheral initiating the MTU exchange
from micropython import const
import time, machine, bluetooth
TIMEOUT_MS = 5000
_IRQ_CENTRAL_CONNECT = const(1)
Reported by Pylint.
Line: 23
Column: 1
# - btstack (in central mode) doesn't handle the peripheral initiating the MTU exchange
from micropython import const
import time, machine, bluetooth
TIMEOUT_MS = 5000
_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)
Reported by Pylint.
Line: 23
Column: 1
# - btstack (in central mode) doesn't handle the peripheral initiating the MTU exchange
from micropython import const
import time, machine, bluetooth
TIMEOUT_MS = 5000
_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)
Reported by Pylint.
Line: 87
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: 88
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: 88
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: 97
Column: 5
# Acting in peripheral role.
def instance0():
multitest.globals(BDADDR=ble.config("mac"))
((char_handle,),) = ble.gatts_register_services(SERVICES)
ble.gatts_set_buffer(char_handle, 500, False)
print("gap_advertise")
ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
multitest.next()
Reported by Pylint.
Line: 102
Column: 5
ble.gatts_set_buffer(char_handle, 500, False)
print("gap_advertise")
ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
multitest.next()
try:
for i in range(7):
if i == 1:
ble.config(mtu=200)
elif i == 2:
Reported by Pylint.
Line: 148
Column: 5
# Acting in central role.
def instance1():
multitest.next()
try:
for i in range(7):
if i < 4:
ble.config(mtu=300)
elif i == 5:
Reported by Pylint.
Line: 164
Column: 40
# Extra scan timeout allows for the peripheral to receive the previous disconnect
# event and start advertising again.
print("gap_connect")
ble.gap_connect(BDADDR[0], BDADDR[1], 5000)
conn_handle = wait_for_event(_IRQ_PERIPHERAL_CONNECT, TIMEOUT_MS)
if i < 4:
print("gattc_exchange_mtu")
ble.gattc_exchange_mtu(conn_handle)
Reported by Pylint.
tests/multi_bluetooth/ble_gap_pair_bond.py
23 issues
Line: 5
Column: 1
# characteristic
# TODO: reconnect after bonding to test that the secrets persist
from micropython import const
import time, machine, bluetooth
if not hasattr(bluetooth.BLE, "gap_pair"):
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 6
Column: 1
# TODO: reconnect after bonding to test that the secrets persist
from micropython import const
import time, machine, bluetooth
if not hasattr(bluetooth.BLE, "gap_pair"):
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 6
Column: 1
# TODO: reconnect after bonding to test that the secrets persist
from micropython import const
import time, machine, bluetooth
if not hasattr(bluetooth.BLE, "gap_pair"):
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 70
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: 71
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: 71
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: 80
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: 85
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: 104
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: 108
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.
tests/extmod/vfs_userfs.py
23 issues
Line: 4
Column: 1
# test VFS functionality with a user-defined filesystem
# also tests parts of uio.IOBase implementation
import usys
try:
import uio
uio.IOBase
Reported by Pylint.
Line: 80
Column: 1
# import files from the user filesystem
usys.path.append("/userfs")
import usermod1
# unmount and undo path addition
uos.umount("/userfs")
usys.path.pop()
Reported by Pylint.
Line: 9
Column: 5
try:
import uio
uio.IOBase
import uos
uos.mount
except (ImportError, AttributeError):
print("SKIP")
Reported by Pylint.
Line: 12
Column: 5
uio.IOBase
import uos
uos.mount
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 15
Column: 5
uos.mount
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
class UserFile(uio.IOBase):
def __init__(self, mode, data):
assert isinstance(data, bytes)
Reported by Pylint.
Line: 80
Column: 1
# import files from the user filesystem
usys.path.append("/userfs")
import usermod1
# unmount and undo path addition
uos.umount("/userfs")
usys.path.pop()
Reported by Pylint.
Line: 1
Column: 1
# test VFS functionality with a user-defined filesystem
# also tests parts of uio.IOBase implementation
import usys
try:
import uio
uio.IOBase
Reported by Pylint.
Line: 18
Column: 1
raise SystemExit
class UserFile(uio.IOBase):
def __init__(self, mode, data):
assert isinstance(data, bytes)
self.is_text = mode.find("b") == -1
self.data = data
self.pos = 0
Reported by Pylint.
Line: 20
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
class UserFile(uio.IOBase):
def __init__(self, mode, data):
assert isinstance(data, bytes)
self.is_text = mode.find("b") == -1
self.data = data
self.pos = 0
def read(self):
Reported by Bandit.
Line: 25
Column: 5
self.data = data
self.pos = 0
def read(self):
if self.is_text:
return str(self.data, "utf8")
else:
return self.data
Reported by Pylint.
ports/esp32/boards/M5STACK_ATOM/modules/atom.py
23 issues
Line: 8
Column: 1
# ATOM Lite https://docs.m5stack.com/en/core/atom_lite
# ATOM Matrix https://docs.m5stack.com/en/core/atom_matrix
from micropython import const
from machine import Pin
import neopixel
# M5STACK ATOM Hardware Pin Assignments
"""
Reported by Pylint.
Line: 9
Column: 1
# ATOM Matrix https://docs.m5stack.com/en/core/atom_matrix
from micropython import const
from machine import Pin
import neopixel
# M5STACK ATOM Hardware Pin Assignments
"""
FRONT
Reported by Pylint.
Line: 10
Column: 1
from micropython import const
from machine import Pin
import neopixel
# M5STACK ATOM Hardware Pin Assignments
"""
FRONT
|3V3|
Reported by Pylint.
Line: 13
Column: 1
import neopixel
# M5STACK ATOM Hardware Pin Assignments
"""
FRONT
|3V3|
|G21| IR G12 |G22|
|G25| BTN G39 |G19|
| 5V| WS2812 G27 |G23|
Reported by Pylint.
Line: 1
Column: 1
# M5Stack ATOM MicroPython Helper Library
# MIT license; Copyright (c) 2021 IAMLIUBO work for M5STACK
#
# Hardware details:
# ATOM Lite https://docs.m5stack.com/en/core/atom_lite
# ATOM Matrix https://docs.m5stack.com/en/core/atom_matrix
from micropython import const
from machine import Pin
Reported by Pylint.
Line: 41
Column: 1
GROVE_PORT_PIN = (const(26), const(32))
class ATOM:
def __init__(self, np_n):
self._np = neopixel.NeoPixel(pin=Pin(WS2812_PIN), n=np_n)
self._btn = Pin(BUTTON_PIN, Pin.IN, Pin.PULL_UP)
def get_button_status(self):
Reported by Pylint.
Line: 46
Column: 5
self._np = neopixel.NeoPixel(pin=Pin(WS2812_PIN), n=np_n)
self._btn = Pin(BUTTON_PIN, Pin.IN, Pin.PULL_UP)
def get_button_status(self):
return self._btn.value()
def set_button_callback(self, cb):
self._btn.irq(trigger=Pin.IRQ_FALLING, handler=cb)
Reported by Pylint.
Line: 49
Column: 5
def get_button_status(self):
return self._btn.value()
def set_button_callback(self, cb):
self._btn.irq(trigger=Pin.IRQ_FALLING, handler=cb)
def set_pixel_color(self, num, r, g, b):
if num <= self._np.n:
self._np[num] = [r, g, b]
Reported by Pylint.
Line: 49
Column: 5
def get_button_status(self):
return self._btn.value()
def set_button_callback(self, cb):
self._btn.irq(trigger=Pin.IRQ_FALLING, handler=cb)
def set_pixel_color(self, num, r, g, b):
if num <= self._np.n:
self._np[num] = [r, g, b]
Reported by Pylint.
Line: 52
Column: 5
def set_button_callback(self, cb):
self._btn.irq(trigger=Pin.IRQ_FALLING, handler=cb)
def set_pixel_color(self, num, r, g, b):
if num <= self._np.n:
self._np[num] = [r, g, b]
self._np.write()
def get_pixel_color(self, num):
Reported by Pylint.
tests/misc/sys_settrace_subdir/sys_settrace_generic.py
23 issues
Line: 44
Column: 5
# import
def test_import():
from sys_settrace_subdir import sys_settrace_importme
sys_settrace_importme.dummy()
sys_settrace_importme.saysomething()
Reported by Pylint.
Line: 52
Column: 5
# class
class TLClass:
def method():
pass
pass
Reported by Pylint.
Line: 24
Column: 12
try:
raise Exception("test_exception")
except Exception:
pass
finally:
pass
Reported by Pylint.
Line: 55
Column: 5
def method():
pass
pass
def test_class():
class TestClass:
__anynum = -9
Reported by Pylint.
Line: 1
Column: 1
print("Now comes the language constructions tests.")
# function
def test_func():
def test_sub_func():
print("test_function")
test_sub_func()
Reported by Pylint.
Line: 4
Column: 1
print("Now comes the language constructions tests.")
# function
def test_func():
def test_sub_func():
print("test_function")
test_sub_func()
Reported by Pylint.
Line: 12
Column: 1
# closure
def test_closure(msg):
def make_closure():
print(msg)
return make_closure
Reported by Pylint.
Line: 20
Column: 1
# exception
def test_exception():
try:
raise Exception("test_exception")
except Exception:
pass
Reported by Pylint.
Line: 24
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b110_try_except_pass.html
try:
raise Exception("test_exception")
except Exception:
pass
finally:
pass
Reported by Bandit.
Line: 32
Column: 1
# listcomp
def test_listcomp():
print("test_listcomp", [x for x in range(3)])
# lambda
def test_lambda():
Reported by Pylint.
tests/misc/sys_settrace_features.py
23 issues
Line: 7
Column: 5
sys.settrace
except AttributeError:
print("SKIP")
raise SystemExit
def print_stacktrace(frame, level=0):
# Ignore CPython specific helpers.
if frame.f_globals["__name__"].find("importlib") != -1:
Reported by Pylint.
Line: 36
Column: 33
class _Prof:
trace_count = 0
def trace_tick(self, frame, event, arg):
self.trace_count += 1
print_stacktrace(frame)
__prof__ = _Prof()
Reported by Pylint.
Line: 36
Column: 40
class _Prof:
trace_count = 0
def trace_tick(self, frame, event, arg):
self.trace_count += 1
print_stacktrace(frame)
__prof__ = _Prof()
Reported by Pylint.
Line: 74
Column: 5
if frame.f_code.co_name != "factorial":
return trace_tick_handler
global alice_handler_set
if event == "call" and not alice_handler_set:
alice_handler_set = True
return trace_tick_handler_alice
global bob_handler_set
Reported by Pylint.
Line: 79
Column: 5
alice_handler_set = True
return trace_tick_handler_alice
global bob_handler_set
if event == "call" and not bob_handler_set:
bob_handler_set = True
return trace_tick_handler_bob
return trace_tick_handler
Reported by Pylint.
Line: 1
Column: 1
import sys
try:
sys.settrace
except AttributeError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 10
Column: 1
raise SystemExit
def print_stacktrace(frame, level=0):
# Ignore CPython specific helpers.
if frame.f_globals["__name__"].find("importlib") != -1:
print_stacktrace(frame.f_back, level)
return
Reported by Pylint.
Line: 33
Column: 1
print_stacktrace(frame.f_back, level + 1)
class _Prof:
trace_count = 0
def trace_tick(self, frame, event, arg):
self.trace_count += 1
print_stacktrace(frame)
Reported by Pylint.
Line: 36
Column: 5
class _Prof:
trace_count = 0
def trace_tick(self, frame, event, arg):
self.trace_count += 1
print_stacktrace(frame)
__prof__ = _Prof()
Reported by Pylint.
Line: 43
Column: 1
__prof__ = _Prof()
alice_handler_set = False
def trace_tick_handler_alice(frame, event, arg):
print("### trace_handler::Alice event:", event)
__prof__.trace_tick(frame, event, arg)
Reported by Pylint.
tests/basics/gc1.py
23 issues
Line: 20
Column: 17
if hasattr(gc, 'mem_free'):
# uPy has these extra functions
# just test they execute and return an int
assert type(gc.mem_free()) is int
assert type(gc.mem_alloc()) is int
if hasattr(gc, 'threshold'):
# uPy has this extra function
# check execution and returns
Reported by Pylint.
Line: 21
Column: 17
# uPy has these extra functions
# just test they execute and return an int
assert type(gc.mem_free()) is int
assert type(gc.mem_alloc()) is int
if hasattr(gc, 'threshold'):
# uPy has this extra function
# check execution and returns
assert(gc.threshold(1) is None)
Reported by Pylint.
Line: 26
Column: 12
if hasattr(gc, 'threshold'):
# uPy has this extra function
# check execution and returns
assert(gc.threshold(1) is None)
assert(gc.threshold() == 0)
assert(gc.threshold(-1) is None)
assert(gc.threshold() == -1)
# Setting a low threshold should trigger collection at the list alloc
Reported by Pylint.
Line: 27
Column: 12
# uPy has this extra function
# check execution and returns
assert(gc.threshold(1) is None)
assert(gc.threshold() == 0)
assert(gc.threshold(-1) is None)
assert(gc.threshold() == -1)
# Setting a low threshold should trigger collection at the list alloc
gc.threshold(1)
Reported by Pylint.
Line: 28
Column: 12
# check execution and returns
assert(gc.threshold(1) is None)
assert(gc.threshold() == 0)
assert(gc.threshold(-1) is None)
assert(gc.threshold() == -1)
# Setting a low threshold should trigger collection at the list alloc
gc.threshold(1)
[[], []]
Reported by Pylint.
Line: 29
Column: 12
assert(gc.threshold(1) is None)
assert(gc.threshold() == 0)
assert(gc.threshold(-1) is None)
assert(gc.threshold() == -1)
# Setting a low threshold should trigger collection at the list alloc
gc.threshold(1)
[[], []]
gc.threshold(-1)
Reported by Pylint.
Line: 32
Column: 5
assert(gc.threshold() == -1)
# Setting a low threshold should trigger collection at the list alloc
gc.threshold(1)
[[], []]
gc.threshold(-1)
Reported by Pylint.
Line: 34
Column: 5
# Setting a low threshold should trigger collection at the list alloc
gc.threshold(1)
[[], []]
gc.threshold(-1)
Reported by Pylint.
Line: 7
Column: 5
import gc
except ImportError:
print("SKIP")
raise SystemExit
print(gc.isenabled())
gc.disable()
print(gc.isenabled())
gc.enable()
Reported by Pylint.
Line: 33
Column: 5
# Setting a low threshold should trigger collection at the list alloc
gc.threshold(1)
[[], []]
gc.threshold(-1)
Reported by Pylint.