The following issues were found
Lib/idlelib/multicall.py
73 issues
Line: 37
Column: 1
import tkinter
# the event type constants, which define the meaning of mc_type
MC_KEYPRESS=0; MC_KEYRELEASE=1; MC_BUTTONPRESS=2; MC_BUTTONRELEASE=3;
MC_ACTIVATE=4; MC_CIRCULATE=5; MC_COLORMAP=6; MC_CONFIGURE=7;
MC_DEACTIVATE=8; MC_DESTROY=9; MC_ENTER=10; MC_EXPOSE=11; MC_FOCUSIN=12;
MC_FOCUSOUT=13; MC_GRAVITY=14; MC_LEAVE=15; MC_MAP=16; MC_MOTION=17;
MC_MOUSEWHEEL=18; MC_PROPERTY=19; MC_REPARENT=20; MC_UNMAP=21; MC_VISIBILITY=22;
# the modifier state constants, which define the meaning of mc_state
Reported by Pylint.
Line: 38
Column: 1
# the event type constants, which define the meaning of mc_type
MC_KEYPRESS=0; MC_KEYRELEASE=1; MC_BUTTONPRESS=2; MC_BUTTONRELEASE=3;
MC_ACTIVATE=4; MC_CIRCULATE=5; MC_COLORMAP=6; MC_CONFIGURE=7;
MC_DEACTIVATE=8; MC_DESTROY=9; MC_ENTER=10; MC_EXPOSE=11; MC_FOCUSIN=12;
MC_FOCUSOUT=13; MC_GRAVITY=14; MC_LEAVE=15; MC_MAP=16; MC_MOTION=17;
MC_MOUSEWHEEL=18; MC_PROPERTY=19; MC_REPARENT=20; MC_UNMAP=21; MC_VISIBILITY=22;
# the modifier state constants, which define the meaning of mc_state
MC_SHIFT = 1<<0; MC_CONTROL = 1<<2; MC_ALT = 1<<3; MC_META = 1<<5
Reported by Pylint.
Line: 39
Column: 1
# the event type constants, which define the meaning of mc_type
MC_KEYPRESS=0; MC_KEYRELEASE=1; MC_BUTTONPRESS=2; MC_BUTTONRELEASE=3;
MC_ACTIVATE=4; MC_CIRCULATE=5; MC_COLORMAP=6; MC_CONFIGURE=7;
MC_DEACTIVATE=8; MC_DESTROY=9; MC_ENTER=10; MC_EXPOSE=11; MC_FOCUSIN=12;
MC_FOCUSOUT=13; MC_GRAVITY=14; MC_LEAVE=15; MC_MAP=16; MC_MOTION=17;
MC_MOUSEWHEEL=18; MC_PROPERTY=19; MC_REPARENT=20; MC_UNMAP=21; MC_VISIBILITY=22;
# the modifier state constants, which define the meaning of mc_state
MC_SHIFT = 1<<0; MC_CONTROL = 1<<2; MC_ALT = 1<<3; MC_META = 1<<5
MC_OPTION = 1<<6; MC_COMMAND = 1<<7
Reported by Pylint.
Line: 40
Column: 1
MC_KEYPRESS=0; MC_KEYRELEASE=1; MC_BUTTONPRESS=2; MC_BUTTONRELEASE=3;
MC_ACTIVATE=4; MC_CIRCULATE=5; MC_COLORMAP=6; MC_CONFIGURE=7;
MC_DEACTIVATE=8; MC_DESTROY=9; MC_ENTER=10; MC_EXPOSE=11; MC_FOCUSIN=12;
MC_FOCUSOUT=13; MC_GRAVITY=14; MC_LEAVE=15; MC_MAP=16; MC_MOTION=17;
MC_MOUSEWHEEL=18; MC_PROPERTY=19; MC_REPARENT=20; MC_UNMAP=21; MC_VISIBILITY=22;
# the modifier state constants, which define the meaning of mc_state
MC_SHIFT = 1<<0; MC_CONTROL = 1<<2; MC_ALT = 1<<3; MC_META = 1<<5
MC_OPTION = 1<<6; MC_COMMAND = 1<<7
Reported by Pylint.
Line: 41
Column: 1
MC_ACTIVATE=4; MC_CIRCULATE=5; MC_COLORMAP=6; MC_CONFIGURE=7;
MC_DEACTIVATE=8; MC_DESTROY=9; MC_ENTER=10; MC_EXPOSE=11; MC_FOCUSIN=12;
MC_FOCUSOUT=13; MC_GRAVITY=14; MC_LEAVE=15; MC_MAP=16; MC_MOTION=17;
MC_MOUSEWHEEL=18; MC_PROPERTY=19; MC_REPARENT=20; MC_UNMAP=21; MC_VISIBILITY=22;
# the modifier state constants, which define the meaning of mc_state
MC_SHIFT = 1<<0; MC_CONTROL = 1<<2; MC_ALT = 1<<3; MC_META = 1<<5
MC_OPTION = 1<<6; MC_COMMAND = 1<<7
# define the list of modifiers, to be used in complex event types.
Reported by Pylint.
Line: 74
Column: 24
# A Python function is called each time an event is generated.
class _SimpleBinder:
def __init__(self, type, widget, widgetinst):
self.type = type
self.sequence = '<'+_types[type][0]+'>'
self.widget = widget
self.widgetinst = widgetinst
self.bindedfuncs = []
Reported by Pylint.
Line: 82
Column: 20
self.bindedfuncs = []
self.handlerid = None
def bind(self, triplet, func):
if not self.handlerid:
def handler(event, l = self.bindedfuncs, mc_type = self.type):
event.mc_type = mc_type
wascalled = {}
for i in range(len(l)-1, -1, -1):
Reported by Pylint.
Line: 84
Column: 13
def bind(self, triplet, func):
if not self.handlerid:
def handler(event, l = self.bindedfuncs, mc_type = self.type):
event.mc_type = mc_type
wascalled = {}
for i in range(len(l)-1, -1, -1):
func = l[i]
if func not in wascalled:
Reported by Pylint.
Line: 87
Column: 21
def handler(event, l = self.bindedfuncs, mc_type = self.type):
event.mc_type = mc_type
wascalled = {}
for i in range(len(l)-1, -1, -1):
func = l[i]
if func not in wascalled:
wascalled[func] = True
r = func(event)
if r:
Reported by Pylint.
Line: 91
Column: 25
func = l[i]
if func not in wascalled:
wascalled[func] = True
r = func(event)
if r:
return r
self.handlerid = self.widget.bind(self.widgetinst,
self.sequence, handler)
self.bindedfuncs.append(func)
Reported by Pylint.
Lib/test/test_pipes.py
73 issues
Line: 1
Column: 1
import pipes
import os
import string
import unittest
import shutil
from test.support import run_unittest, reap_children, unix_shell
from test.support.os_helper import TESTFN, unlink
Reported by Pylint.
Line: 21
Column: 1
# tr a-z A-Z is not portable, so make the ranges explicit
s_command = 'tr %s %s' % (string.ascii_lowercase, string.ascii_uppercase)
class SimplePipeTests(unittest.TestCase):
def tearDown(self):
for f in (TESTFN, TESTFN2):
unlink(f)
def testSimplePipe1(self):
Reported by Pylint.
Line: 23
Column: 13
class SimplePipeTests(unittest.TestCase):
def tearDown(self):
for f in (TESTFN, TESTFN2):
unlink(f)
def testSimplePipe1(self):
if shutil.which('tr') is None:
self.skipTest('tr is not available')
Reported by Pylint.
Line: 26
Column: 5
for f in (TESTFN, TESTFN2):
unlink(f)
def testSimplePipe1(self):
if shutil.which('tr') is None:
self.skipTest('tr is not available')
t = pipes.Template()
t.append(s_command, pipes.STDIN_STDOUT)
with t.open(TESTFN, 'w') as f:
Reported by Pylint.
Line: 26
Column: 5
for f in (TESTFN, TESTFN2):
unlink(f)
def testSimplePipe1(self):
if shutil.which('tr') is None:
self.skipTest('tr is not available')
t = pipes.Template()
t.append(s_command, pipes.STDIN_STDOUT)
with t.open(TESTFN, 'w') as f:
Reported by Pylint.
Line: 29
Column: 9
def testSimplePipe1(self):
if shutil.which('tr') is None:
self.skipTest('tr is not available')
t = pipes.Template()
t.append(s_command, pipes.STDIN_STDOUT)
with t.open(TESTFN, 'w') as f:
f.write('hello world #1')
with open(TESTFN) as f:
self.assertEqual(f.read(), 'HELLO WORLD #1')
Reported by Pylint.
Line: 31
Column: 37
self.skipTest('tr is not available')
t = pipes.Template()
t.append(s_command, pipes.STDIN_STDOUT)
with t.open(TESTFN, 'w') as f:
f.write('hello world #1')
with open(TESTFN) as f:
self.assertEqual(f.read(), 'HELLO WORLD #1')
def testSimplePipe2(self):
Reported by Pylint.
Line: 33
Column: 30
t.append(s_command, pipes.STDIN_STDOUT)
with t.open(TESTFN, 'w') as f:
f.write('hello world #1')
with open(TESTFN) as f:
self.assertEqual(f.read(), 'HELLO WORLD #1')
def testSimplePipe2(self):
if shutil.which('tr') is None:
self.skipTest('tr is not available')
Reported by Pylint.
Line: 36
Column: 5
with open(TESTFN) as f:
self.assertEqual(f.read(), 'HELLO WORLD #1')
def testSimplePipe2(self):
if shutil.which('tr') is None:
self.skipTest('tr is not available')
with open(TESTFN, 'w') as f:
f.write('hello world #2')
t = pipes.Template()
Reported by Pylint.
Line: 36
Column: 5
with open(TESTFN) as f:
self.assertEqual(f.read(), 'HELLO WORLD #1')
def testSimplePipe2(self):
if shutil.which('tr') is None:
self.skipTest('tr is not available')
with open(TESTFN, 'w') as f:
f.write('hello world #2')
t = pipes.Template()
Reported by Pylint.
Lib/xml/etree/ElementPath.py
73 issues
Line: 260
Column: 9
# [@attribute='value'] or [@attribute!='value']
key = predicate[1]
value = predicate[-1]
def select(context, result):
for elem in result:
if elem.get(key) == value:
yield elem
def select_negated(context, result):
for elem in result:
Reported by Pylint.
Line: 272
Column: 9
if signature == "-" and not re.match(r"\-?\d+$", predicate[0]):
# [tag]
tag = predicate[0]
def select(context, result):
for elem in result:
if elem.find(tag) is not None:
yield elem
return select
if signature == ".='" or signature == ".!='" or (
Reported by Pylint.
Line: 284
Column: 13
tag = predicate[0]
value = predicate[-1]
if tag:
def select(context, result):
for elem in result:
for e in elem.findall(tag):
if "".join(e.itertext()) == value:
yield elem
break
Reported by Pylint.
Line: 290
Column: 13
if "".join(e.itertext()) == value:
yield elem
break
def select_negated(context, result):
for elem in result:
for e in elem.iterfind(tag):
if "".join(e.itertext()) != value:
yield elem
break
Reported by Pylint.
Line: 297
Column: 13
yield elem
break
else:
def select(context, result):
for elem in result:
if "".join(elem.itertext()) == value:
yield elem
def select_negated(context, result):
for elem in result:
Reported by Pylint.
Line: 301
Column: 13
for elem in result:
if "".join(elem.itertext()) == value:
yield elem
def select_negated(context, result):
for elem in result:
if "".join(elem.itertext()) != value:
yield elem
return select_negated if '!=' in signature else select
if signature == "-" or signature == "-()" or signature == "-()-":
Reported by Pylint.
Line: 325
Column: 9
raise SyntaxError("XPath offset from last() must be negative")
else:
index = -1
def select(context, result):
parent_map = get_parent_map(context)
for elem in result:
try:
parent = parent_map[elem]
# FIXME: what if the selector is "*" ?
Reported by Pylint.
Line: 118
Column: 20
# Same as '*', but no comments or processing instructions.
# It can be a surprise that '*' includes those, but there is no
# justification for '{*}*' doing the same.
def select(context, result):
for elem in result:
if _isinstance(elem.tag, _str):
yield elem
elif tag == '{}*':
# Any tag that is not in a namespace.
Reported by Pylint.
Line: 124
Column: 20
yield elem
elif tag == '{}*':
# Any tag that is not in a namespace.
def select(context, result):
for elem in result:
el_tag = elem.tag
if _isinstance(el_tag, _str) and el_tag[0] != '{':
yield elem
elif tag[:3] == '{*}':
Reported by Pylint.
Line: 134
Column: 20
suffix = tag[2:] # '}name'
no_ns = slice(-len(suffix), None)
tag = tag[3:]
def select(context, result):
for elem in result:
el_tag = elem.tag
if el_tag == tag or _isinstance(el_tag, _str) and el_tag[no_ns] == suffix:
yield elem
elif tag[-2:] == '}*':
Reported by Pylint.
Lib/test/test_multibytecodec.py
73 issues
Line: 63
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html
try:
for enc in ALL_CJKENCODINGS:
code = '# coding: {}\n'.format(enc)
exec(code)
finally:
os_helper.unlink(TESTFN)
def test_init_segfault(self):
# bug #3305: this used to segfault
Reported by Bandit.
Line: 63
Column: 17
try:
for enc in ALL_CJKENCODINGS:
code = '# coding: {}\n'.format(enc)
exec(code)
finally:
os_helper.unlink(TESTFN)
def test_init_segfault(self):
# bug #3305: this used to segfault
Reported by Pylint.
Line: 1
Column: 1
#
# test_multibytecodec.py
# Unit test for multibytecodec itself
#
import _multibytecodec
import codecs
import io
import sys
Reported by Pylint.
Line: 7
Column: 1
#
import _multibytecodec
import codecs
import io
import sys
import textwrap
import unittest
from test import support
Reported by Pylint.
Line: 8
Column: 1
import _multibytecodec
import codecs
import io
import sys
import textwrap
import unittest
from test import support
from test.support import os_helper
Reported by Pylint.
Line: 9
Column: 1
import _multibytecodec
import codecs
import io
import sys
import textwrap
import unittest
from test import support
from test.support import os_helper
from test.support.os_helper import TESTFN
Reported by Pylint.
Line: 10
Column: 1
import codecs
import io
import sys
import textwrap
import unittest
from test import support
from test.support import os_helper
from test.support.os_helper import TESTFN
Reported by Pylint.
Line: 11
Column: 1
import io
import sys
import textwrap
import unittest
from test import support
from test.support import os_helper
from test.support.os_helper import TESTFN
ALL_CJKENCODINGS = [
Reported by Pylint.
Line: 12
Column: 1
import sys
import textwrap
import unittest
from test import support
from test.support import os_helper
from test.support.os_helper import TESTFN
ALL_CJKENCODINGS = [
# _codecs_cn
Reported by Pylint.
Line: 13
Column: 1
import textwrap
import unittest
from test import support
from test.support import os_helper
from test.support.os_helper import TESTFN
ALL_CJKENCODINGS = [
# _codecs_cn
'gb2312', 'gbk', 'gb18030', 'hz',
Reported by Pylint.
Tools/iobench/iobench.py
73 issues
Line: 350
Column: 9
# Text writes
if "t" in options and "w" in options:
print("\n** Text append **\n")
def make_test_source(name, size):
with text_open(name, "r") as f:
return f.read()
run_test_family(write_tests, "b", text_files,
lambda fn: text_open(os.devnull, "w"), make_test_source)
Reported by Pylint.
Line: 359
Column: 9
# Binary overwrites
if "b" in options and "w" in options:
print("\n** Binary overwrite **\n")
def make_test_source(name, size):
with open(name, "rb") as f:
return f.read()
run_test_family(modify_tests, "t", binary_files,
lambda fn: open(fn, "r+b"), make_test_source)
Reported by Pylint.
Line: 368
Column: 9
# Text overwrites
if "t" in options and "w" in options:
print("\n** Text overwrite **\n")
def make_test_source(name, size):
with text_open(name, "r") as f:
return f.read()
run_test_family(modify_tests, "b", text_files,
lambda fn: text_open(fn, "r+"), make_test_source)
Reported by Pylint.
Line: 10
Column: 1
import re
import sys
import time
from optparse import OptionParser
out = sys.stdout
TEXT_ENCODING = 'utf8'
NEWLINES = 'lf'
Reported by Pylint.
Line: 96
Column: 9
def read_lines(f):
""" read one line at a time """
f.seek(0)
for line in f:
pass
@with_open_mode("r")
@with_sizes("medium")
def seek_forward_bytewise(f):
Reported by Pylint.
Line: 207
Column: 3
f.write(source[i:i+1000])
f.seek(i+2000)
# XXX the 2 following tests don't work with py3k's text IO
@with_open_mode("wb+")
@with_sizes("medium")
def read_modify_bytewise(f, source):
""" alternate read & write one unit """
f.seek(0)
Reported by Pylint.
Line: 341
Column: 36
# Binary writes
if "b" in options and "w" in options:
print("\n** Binary append **\n")
def make_test_source(name, size):
with open(name, "rb") as f:
return f.read()
run_test_family(write_tests, "t", binary_files,
lambda fn: open(os.devnull, "wb"), make_test_source)
Reported by Pylint.
Line: 350
Column: 36
# Text writes
if "t" in options and "w" in options:
print("\n** Text append **\n")
def make_test_source(name, size):
with text_open(name, "r") as f:
return f.read()
run_test_family(write_tests, "b", text_files,
lambda fn: text_open(os.devnull, "w"), make_test_source)
Reported by Pylint.
Line: 359
Column: 36
# Binary overwrites
if "b" in options and "w" in options:
print("\n** Binary overwrite **\n")
def make_test_source(name, size):
with open(name, "rb") as f:
return f.read()
run_test_family(modify_tests, "t", binary_files,
lambda fn: open(fn, "r+b"), make_test_source)
Reported by Pylint.
Line: 368
Column: 36
# Text overwrites
if "t" in options and "w" in options:
print("\n** Text overwrite **\n")
def make_test_source(name, size):
with text_open(name, "r") as f:
return f.read()
run_test_family(modify_tests, "b", text_files,
lambda fn: text_open(fn, "r+"), make_test_source)
Reported by Pylint.
Lib/unittest/test/test_async_case.py
73 issues
Line: 91
Column: 17
async def test_func(self):
events.append('test')
raise Exception()
self.addAsyncCleanup(self.on_cleanup)
async def asyncTearDown(self):
events.append('asyncTearDown')
async def on_cleanup(self):
Reported by Pylint.
Line: 199
Column: 17
async def test_base(self):
events.append("test_base")
raise BaseException()
events.append("not it")
async def test_no_err(self):
events.append("test_no_err")
async def test_cancel(self):
Reported by Pylint.
Line: 235
Column: 9
asyncio.create_task(coro())
test = Test("test_leaking_task")
output = test.run()
self.assertTrue(cancelled)
Reported by Pylint.
Line: 1
Column: 1
import asyncio
import unittest
def tearDownModule():
asyncio.set_event_loop_policy(None)
class TestAsyncCase(unittest.TestCase):
Reported by Pylint.
Line: 5
Column: 1
import unittest
def tearDownModule():
asyncio.set_event_loop_policy(None)
class TestAsyncCase(unittest.TestCase):
def test_full_cycle(self):
Reported by Pylint.
Line: 5
Column: 1
import unittest
def tearDownModule():
asyncio.set_event_loop_policy(None)
class TestAsyncCase(unittest.TestCase):
def test_full_cycle(self):
Reported by Pylint.
Line: 9
Column: 1
asyncio.set_event_loop_policy(None)
class TestAsyncCase(unittest.TestCase):
def test_full_cycle(self):
events = []
class Test(unittest.IsolatedAsyncioTestCase):
def setUp(self):
Reported by Pylint.
Line: 10
Column: 5
class TestAsyncCase(unittest.TestCase):
def test_full_cycle(self):
events = []
class Test(unittest.IsolatedAsyncioTestCase):
def setUp(self):
self.assertEqual(events, [])
Reported by Pylint.
Line: 13
Column: 9
def test_full_cycle(self):
events = []
class Test(unittest.IsolatedAsyncioTestCase):
def setUp(self):
self.assertEqual(events, [])
events.append('setUp')
async def asyncSetUp(self):
Reported by Pylint.
Line: 14
Column: 13
events = []
class Test(unittest.IsolatedAsyncioTestCase):
def setUp(self):
self.assertEqual(events, [])
events.append('setUp')
async def asyncSetUp(self):
self.assertEqual(events, ['setUp'])
Reported by Pylint.
Lib/xdrlib.py
72 issues
Line: 24
Column: 5
msg -- contains the message
"""
def __init__(self, msg):
self.msg = msg
def __repr__(self):
return repr(self.msg)
def __str__(self):
return str(self.msg)
Reported by Pylint.
Line: 113
Column: 25
pack_opaque = pack_string
pack_bytes = pack_string
def pack_list(self, list, pack_item):
for item in list:
self.pack_uint(1)
pack_item(item)
self.pack_uint(0)
Reported by Pylint.
Line: 119
Column: 30
pack_item(item)
self.pack_uint(0)
def pack_farray(self, n, list, pack_item):
if len(list) != n:
raise ValueError('wrong array size')
for item in list:
pack_item(item)
Reported by Pylint.
Line: 125
Column: 26
for item in list:
pack_item(item)
def pack_array(self, list, pack_item):
n = len(list)
self.pack_uint(n)
self.pack_farray(n, list, pack_item)
Reported by Pylint.
Line: 146
Column: 9
return self.__pos
def set_position(self, position):
self.__pos = position
def get_buffer(self):
return self.__buf
def done(self):
Reported by Pylint.
Line: 157
Column: 9
def unpack_uint(self):
i = self.__pos
self.__pos = j = i+4
data = self.__buf[i:j]
if len(data) < 4:
raise EOFError
return struct.unpack('>L', data)[0]
Reported by Pylint.
Line: 165
Column: 9
def unpack_int(self):
i = self.__pos
self.__pos = j = i+4
data = self.__buf[i:j]
if len(data) < 4:
raise EOFError
return struct.unpack('>l', data)[0]
Reported by Pylint.
Line: 189
Column: 9
def unpack_float(self):
i = self.__pos
self.__pos = j = i+4
data = self.__buf[i:j]
if len(data) < 4:
raise EOFError
return struct.unpack('>f', data)[0]
Reported by Pylint.
Line: 197
Column: 9
def unpack_double(self):
i = self.__pos
self.__pos = j = i+8
data = self.__buf[i:j]
if len(data) < 8:
raise EOFError
return struct.unpack('>d', data)[0]
Reported by Pylint.
Line: 210
Column: 9
j = i + (n+3)//4*4
if j > len(self.__buf):
raise EOFError
self.__pos = j
return self.__buf[i:i+n]
unpack_fopaque = unpack_fstring
def unpack_string(self):
Reported by Pylint.
Tools/pynche/DetailsViewer.py
72 issues
Line: 55
Column: 1
Shift + Right == +25
"""
from tkinter import *
STOP = 'Stop'
WRAP = 'Wrap Around'
RATIO = 'Preserve Distance'
GRAV = 'Squash'
Reported by Pylint.
Line: 71
Column: 30
optiondb = switchboard.optiondb()
self.__red, self.__green, self.__blue = switchboard.current_rgb()
# GUI
root = self.__root = Toplevel(master, class_='Pynche')
root.protocol('WM_DELETE_WINDOW', self.withdraw)
root.title('Pynche Details Window')
root.iconname('Pynche Details Window')
root.bind('<Alt-q>', self.__quit)
root.bind('<Alt-Q>', self.__quit)
Reported by Pylint.
Line: 88
Column: 32
root.bind('<Shift-KeyPress-Right>', self.__plus25)
#
# color ties
frame = self.__frame = Frame(root)
frame.pack(expand=YES, fill=X)
self.__l1 = Label(frame, text='Move Sliders:')
self.__l1.grid(row=1, column=0, sticky=E)
self.__rvar = IntVar()
self.__rvar.set(optiondb.get('RSLIDER', 4))
Reported by Pylint.
Line: 89
Column: 37
#
# color ties
frame = self.__frame = Frame(root)
frame.pack(expand=YES, fill=X)
self.__l1 = Label(frame, text='Move Sliders:')
self.__l1.grid(row=1, column=0, sticky=E)
self.__rvar = IntVar()
self.__rvar.set(optiondb.get('RSLIDER', 4))
self.__radio1 = Checkbutton(frame, text='Red',
Reported by Pylint.
Line: 89
Column: 27
#
# color ties
frame = self.__frame = Frame(root)
frame.pack(expand=YES, fill=X)
self.__l1 = Label(frame, text='Move Sliders:')
self.__l1.grid(row=1, column=0, sticky=E)
self.__rvar = IntVar()
self.__rvar.set(optiondb.get('RSLIDER', 4))
self.__radio1 = Checkbutton(frame, text='Red',
Reported by Pylint.
Line: 90
Column: 21
# color ties
frame = self.__frame = Frame(root)
frame.pack(expand=YES, fill=X)
self.__l1 = Label(frame, text='Move Sliders:')
self.__l1.grid(row=1, column=0, sticky=E)
self.__rvar = IntVar()
self.__rvar.set(optiondb.get('RSLIDER', 4))
self.__radio1 = Checkbutton(frame, text='Red',
variable=self.__rvar,
Reported by Pylint.
Line: 91
Column: 48
frame = self.__frame = Frame(root)
frame.pack(expand=YES, fill=X)
self.__l1 = Label(frame, text='Move Sliders:')
self.__l1.grid(row=1, column=0, sticky=E)
self.__rvar = IntVar()
self.__rvar.set(optiondb.get('RSLIDER', 4))
self.__radio1 = Checkbutton(frame, text='Red',
variable=self.__rvar,
command=self.__effect,
Reported by Pylint.
Line: 92
Column: 23
frame.pack(expand=YES, fill=X)
self.__l1 = Label(frame, text='Move Sliders:')
self.__l1.grid(row=1, column=0, sticky=E)
self.__rvar = IntVar()
self.__rvar.set(optiondb.get('RSLIDER', 4))
self.__radio1 = Checkbutton(frame, text='Red',
variable=self.__rvar,
command=self.__effect,
onvalue=4, offvalue=0)
Reported by Pylint.
Line: 94
Column: 25
self.__l1.grid(row=1, column=0, sticky=E)
self.__rvar = IntVar()
self.__rvar.set(optiondb.get('RSLIDER', 4))
self.__radio1 = Checkbutton(frame, text='Red',
variable=self.__rvar,
command=self.__effect,
onvalue=4, offvalue=0)
self.__radio1.grid(row=1, column=1, sticky=W)
self.__gvar = IntVar()
Reported by Pylint.
Line: 98
Column: 52
variable=self.__rvar,
command=self.__effect,
onvalue=4, offvalue=0)
self.__radio1.grid(row=1, column=1, sticky=W)
self.__gvar = IntVar()
self.__gvar.set(optiondb.get('GSLIDER', 2))
self.__radio2 = Checkbutton(frame, text='Green',
variable=self.__gvar,
command=self.__effect,
Reported by Pylint.
Lib/warnings.py
72 issues
Line: 492
Column: 1
f"coroutine '{coro.__qualname__}' was never awaited\n"
]
if coro.cr_origin is not None:
import linecache, traceback
def extract():
for filename, lineno, funcname in reversed(coro.cr_origin):
line = linecache.getline(filename, lineno)
yield (filename, lineno, funcname, line)
msg_lines.append("Coroutine created at (most recent call last)\n")
Reported by Pylint.
Line: 43
Column: 16
try:
import linecache
line = linecache.getline(msg.filename, msg.lineno)
except Exception:
# When a warning is logged during Python shutdown, linecache
# and the import machinery don't work anymore
line = None
linecache = None
else:
Reported by Pylint.
Line: 59
Column: 16
import tracemalloc
# Logging a warning should not raise a new exception:
# catch Exception, not only ImportError and RecursionError.
except Exception:
# don't suggest to enable tracemalloc if it's not available
tracing = True
tb = None
else:
tracing = tracemalloc.is_tracing()
Reported by Pylint.
Line: 67
Column: 20
tracing = tracemalloc.is_tracing()
try:
tb = tracemalloc.get_object_traceback(msg.source)
except Exception:
# When a warning is logged during Python shutdown, tracemalloc
# and the import machinery don't work anymore
tb = None
if tb is not None:
Reported by Pylint.
Line: 83
Column: 24
line = linecache.getline(frame.filename, frame.lineno)
else:
line = None
except Exception:
line = None
if line:
line = line.strip()
s += ' %s\n' % line
elif not tracing:
Reported by Pylint.
Line: 202
Column: 5
class _OptionError(Exception):
"""Exception used by option processing helpers."""
pass
# Helper to process -W options passed via sys.warnoptions
def _processoptions(args):
for arg in args:
try:
Reported by Pylint.
Line: 300
Column: 50
"not '{:s}'".format(type(category).__name__))
# Get context information
try:
if stacklevel <= 1 or _is_internal_frame(sys._getframe(1)):
# If frame is too small to care or if the warning originated in
# internal code, then do not try to hide any frames.
frame = sys._getframe(stacklevel)
else:
frame = sys._getframe(1)
Reported by Pylint.
Line: 303
Column: 21
if stacklevel <= 1 or _is_internal_frame(sys._getframe(1)):
# If frame is too small to care or if the warning originated in
# internal code, then do not try to hide any frames.
frame = sys._getframe(stacklevel)
else:
frame = sys._getframe(1)
# Look for one frame less since the above line starts us off.
for x in range(stacklevel-1):
frame = _next_external_frame(frame)
Reported by Pylint.
Line: 305
Column: 21
# internal code, then do not try to hide any frames.
frame = sys._getframe(stacklevel)
else:
frame = sys._getframe(1)
# Look for one frame less since the above line starts us off.
for x in range(stacklevel-1):
frame = _next_external_frame(frame)
if frame is None:
raise ValueError
Reported by Pylint.
Line: 307
Column: 17
else:
frame = sys._getframe(1)
# Look for one frame less since the above line starts us off.
for x in range(stacklevel-1):
frame = _next_external_frame(frame)
if frame is None:
raise ValueError
except ValueError:
globals = sys.__dict__
Reported by Pylint.
Lib/test/libregrtest/main.py
72 issues
Line: 556
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b605_start_process_with_a_shell.html
print("Tests result: %s" % self.get_tests_result())
if self.ns.runleaks:
os.system("leaks %d" % os.getpid())
def save_xml_result(self):
if not self.ns.xmlpath and not self.testsuite_xml:
return
Reported by Bandit.
Line: 175
Column: 12
def parse_args(self, kwargs):
ns = _parse_args(sys.argv[1:], **kwargs)
if ns.xmlpath:
support.junit_xml_list = self.testsuite_xml = []
worker_args = ns.worker_args
if worker_args is not None:
from test.libregrtest.runtest_mp import parse_worker_args
Reported by Pylint.
Line: 189
Column: 13
removepy(ns.args)
if ns.huntrleaks:
warmup, repetitions, _ = ns.huntrleaks
if warmup < 1 or repetitions < 1:
msg = ("Invalid values for the --huntrleaks/-R parameters. The "
"number of warmups and repetitions must be at least 1 "
"each (1:1).")
print(msg, file=sys.stderr, flush=True)
Reported by Pylint.
Line: 262
Column: 12
pass
# Remove all the selected tests that precede start if it's set.
if self.ns.start:
try:
del self.selected[:self.selected.index(self.ns.start)]
except ValueError:
print("Couldn't find starting test (%s), using all tests"
% self.ns.start, file=sys.stderr)
Reported by Pylint.
Line: 264
Column: 56
# Remove all the selected tests that precede start if it's set.
if self.ns.start:
try:
del self.selected[:self.selected.index(self.ns.start)]
except ValueError:
print("Couldn't find starting test (%s), using all tests"
% self.ns.start, file=sys.stderr)
if self.ns.randomize:
Reported by Pylint.
Line: 267
Column: 25
del self.selected[:self.selected.index(self.ns.start)]
except ValueError:
print("Couldn't find starting test (%s), using all tests"
% self.ns.start, file=sys.stderr)
if self.ns.randomize:
if self.ns.random_seed is None:
self.ns.random_seed = random.randrange(10000000)
random.seed(self.ns.random_seed)
Reported by Pylint.
Line: 454
Column: 21
# Unload the newly imported modules (best effort finalization)
for module in sys.modules.keys():
if module not in save_modules and module.startswith("test."):
support.unload(module)
if self.ns.failfast and is_failed(result, self.ns):
break
if previous_test:
Reported by Pylint.
Line: 513
Column: 13
self.display_header()
if self.ns.huntrleaks:
warmup, repetitions, _ = self.ns.huntrleaks
if warmup < 3:
msg = ("WARNING: Running tests with --huntrleaks/-R and less than "
"3 warmup repetitions can give false positives!")
print(msg, file=sys.stdout, flush=True)
Reported by Pylint.
Line: 559
Column: 16
os.system("leaks %d" % os.getpid())
def save_xml_result(self):
if not self.ns.xmlpath and not self.testsuite_xml:
return
import xml.etree.ElementTree as ET
root = ET.Element("testsuites")
Reported by Pylint.
Line: 578
Column: 52
for k, v in totals.items():
root.set(k, str(v))
xmlpath = os.path.join(os_helper.SAVEDCWD, self.ns.xmlpath)
with open(xmlpath, 'wb') as f:
for s in ET.tostringlist(root):
f.write(s)
def set_temp_dir(self):
Reported by Pylint.