The following issues were found
Lib/test/test_codecencodings_jp.py
15 issues
Line: 1
Column: 1
#
# test_codecencodings_jp.py
# Codec encoding tests for Japanese encodings.
#
from test import multibytecodec_support
import unittest
class Test_CP932(multibytecodec_support.TestBase, unittest.TestCase):
Reported by Pylint.
Line: 9
Column: 1
from test import multibytecodec_support
import unittest
class Test_CP932(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'cp932'
tstring = multibytecodec_support.load_teststring('shift_jis')
codectests = (
# invalid bytes
(b"abc\x81\x00\x81\x00\x82\x84", "strict", None),
Reported by Pylint.
Line: 9
Column: 1
from test import multibytecodec_support
import unittest
class Test_CP932(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'cp932'
tstring = multibytecodec_support.load_teststring('shift_jis')
codectests = (
# invalid bytes
(b"abc\x81\x00\x81\x00\x82\x84", "strict", None),
Reported by Pylint.
Line: 42
Column: 1
(b"\x8eXY", "replace", "\ufffdXY"),
)
class Test_EUC_JIS_2004(multibytecodec_support.TestBase,
unittest.TestCase):
encoding = 'euc_jis_2004'
tstring = multibytecodec_support.load_teststring('euc_jisx0213')
codectests = euc_commontests
xmlcharnametest = (
Reported by Pylint.
Line: 42
Column: 1
(b"\x8eXY", "replace", "\ufffdXY"),
)
class Test_EUC_JIS_2004(multibytecodec_support.TestBase,
unittest.TestCase):
encoding = 'euc_jis_2004'
tstring = multibytecodec_support.load_teststring('euc_jisx0213')
codectests = euc_commontests
xmlcharnametest = (
Reported by Pylint.
Line: 52
Column: 1
b"\xa9\xa8ℜ\xa9\xb2 = ⟨ሴ⟩"
)
class Test_EUC_JISX0213(multibytecodec_support.TestBase,
unittest.TestCase):
encoding = 'euc_jisx0213'
tstring = multibytecodec_support.load_teststring('euc_jisx0213')
codectests = euc_commontests
xmlcharnametest = (
Reported by Pylint.
Line: 52
Column: 1
b"\xa9\xa8ℜ\xa9\xb2 = ⟨ሴ⟩"
)
class Test_EUC_JISX0213(multibytecodec_support.TestBase,
unittest.TestCase):
encoding = 'euc_jisx0213'
tstring = multibytecodec_support.load_teststring('euc_jisx0213')
codectests = euc_commontests
xmlcharnametest = (
Reported by Pylint.
Line: 62
Column: 1
b"\xa9\xa8ℜ\xa9\xb2 = ⟨ሴ⟩"
)
class Test_EUC_JP_COMPAT(multibytecodec_support.TestBase,
unittest.TestCase):
encoding = 'euc_jp'
tstring = multibytecodec_support.load_teststring('euc_jp')
codectests = euc_commontests + (
("\xa5", "strict", b"\x5c"),
Reported by Pylint.
Line: 62
Column: 1
b"\xa9\xa8ℜ\xa9\xb2 = ⟨ሴ⟩"
)
class Test_EUC_JP_COMPAT(multibytecodec_support.TestBase,
unittest.TestCase):
encoding = 'euc_jp'
tstring = multibytecodec_support.load_teststring('euc_jp')
codectests = euc_commontests + (
("\xa5", "strict", b"\x5c"),
Reported by Pylint.
Line: 77
Column: 1
(b"abc\x80\x80\x82\x84def", "ignore", "abc\uff44def"),
)
class Test_SJIS_COMPAT(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'shift_jis'
tstring = multibytecodec_support.load_teststring('shift_jis')
codectests = shiftjis_commonenctests + (
(b"abc\x80\x80\x82\x84", "replace", "abc\ufffd\ufffd\uff44"),
(b"abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\ufffd\uff44\ufffd"),
Reported by Pylint.
Lib/test/pydoc_mod.py
15 issues
Line: 10
Column: 5
class A:
"""Hello and goodbye"""
def __init__():
"""Wow, I have no function!"""
pass
class B(object):
NO_MEANING: str = "eggs"
Reported by Pylint.
Line: 12
Column: 9
"""Hello and goodbye"""
def __init__():
"""Wow, I have no function!"""
pass
class B(object):
NO_MEANING: str = "eggs"
pass
Reported by Pylint.
Line: 16
Column: 5
class B(object):
NO_MEANING: str = "eggs"
pass
class C(object):
def say_no(self):
return "no"
def get_answer(self):
Reported by Pylint.
Line: 8
Column: 1
__version__ = "1.2.3.4"
__xyz__ = "X, Y and Z"
class A:
"""Hello and goodbye"""
def __init__():
"""Wow, I have no function!"""
pass
Reported by Pylint.
Line: 8
Column: 1
__version__ = "1.2.3.4"
__xyz__ = "X, Y and Z"
class A:
"""Hello and goodbye"""
def __init__():
"""Wow, I have no function!"""
pass
Reported by Pylint.
Line: 14
Column: 1
"""Wow, I have no function!"""
pass
class B(object):
NO_MEANING: str = "eggs"
pass
class C(object):
def say_no(self):
Reported by Pylint.
Line: 14
Column: 1
"""Wow, I have no function!"""
pass
class B(object):
NO_MEANING: str = "eggs"
pass
class C(object):
def say_no(self):
Reported by Pylint.
Line: 14
Column: 1
"""Wow, I have no function!"""
pass
class B(object):
NO_MEANING: str = "eggs"
pass
class C(object):
def say_no(self):
Reported by Pylint.
Line: 14
Column: 1
"""Wow, I have no function!"""
pass
class B(object):
NO_MEANING: str = "eggs"
pass
class C(object):
def say_no(self):
Reported by Pylint.
Line: 18
Column: 1
NO_MEANING: str = "eggs"
pass
class C(object):
def say_no(self):
return "no"
def get_answer(self):
""" Return say_no() """
return self.say_no()
Reported by Pylint.
Lib/test/signalinterproctester.py
15 issues
Line: 18
Column: 30
def setUp(self):
self.got_signals = {'SIGHUP': 0, 'SIGUSR1': 0, 'SIGALRM': 0}
def sighup_handler(self, signum, frame):
self.got_signals['SIGHUP'] += 1
def sigusr1_handler(self, signum, frame):
self.got_signals['SIGUSR1'] += 1
raise SIGUSR1Exception
Reported by Pylint.
Line: 18
Column: 38
def setUp(self):
self.got_signals = {'SIGHUP': 0, 'SIGUSR1': 0, 'SIGALRM': 0}
def sighup_handler(self, signum, frame):
self.got_signals['SIGHUP'] += 1
def sigusr1_handler(self, signum, frame):
self.got_signals['SIGUSR1'] += 1
raise SIGUSR1Exception
Reported by Pylint.
Line: 21
Column: 39
def sighup_handler(self, signum, frame):
self.got_signals['SIGHUP'] += 1
def sigusr1_handler(self, signum, frame):
self.got_signals['SIGUSR1'] += 1
raise SIGUSR1Exception
def wait_signal(self, child, signame):
if child is not None:
Reported by Pylint.
Line: 21
Column: 31
def sighup_handler(self, signum, frame):
self.got_signals['SIGHUP'] += 1
def sigusr1_handler(self, signum, frame):
self.got_signals['SIGUSR1'] += 1
raise SIGUSR1Exception
def wait_signal(self, child, signame):
if child is not None:
Reported by Pylint.
Line: 1
Column: 1
import os
import signal
import subprocess
import sys
import time
import unittest
from test import support
Reported by Pylint.
Line: 3
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import os
import signal
import subprocess
import sys
import time
import unittest
from test import support
Reported by Bandit.
Line: 10
Column: 1
from test import support
class SIGUSR1Exception(Exception):
pass
class InterProcessSignalTests(unittest.TestCase):
def setUp(self):
Reported by Pylint.
Line: 14
Column: 1
pass
class InterProcessSignalTests(unittest.TestCase):
def setUp(self):
self.got_signals = {'SIGHUP': 0, 'SIGUSR1': 0, 'SIGALRM': 0}
def sighup_handler(self, signum, frame):
self.got_signals['SIGHUP'] += 1
Reported by Pylint.
Line: 18
Column: 5
def setUp(self):
self.got_signals = {'SIGHUP': 0, 'SIGUSR1': 0, 'SIGALRM': 0}
def sighup_handler(self, signum, frame):
self.got_signals['SIGHUP'] += 1
def sigusr1_handler(self, signum, frame):
self.got_signals['SIGUSR1'] += 1
raise SIGUSR1Exception
Reported by Pylint.
Line: 21
Column: 5
def sighup_handler(self, signum, frame):
self.got_signals['SIGHUP'] += 1
def sigusr1_handler(self, signum, frame):
self.got_signals['SIGUSR1'] += 1
raise SIGUSR1Exception
def wait_signal(self, child, signame):
if child is not None:
Reported by Pylint.
Lib/test/dtracedata/call_stack.py
15 issues
Line: 9
Column: 16
function_1()
# CALL_FUNCTION_VAR
def function_3(dummy, dummy2):
pass
# CALL_FUNCTION_KW
def function_4(**dummy):
return 1
Reported by Pylint.
Line: 9
Column: 23
function_1()
# CALL_FUNCTION_VAR
def function_3(dummy, dummy2):
pass
# CALL_FUNCTION_KW
def function_4(**dummy):
return 1
Reported by Pylint.
Line: 13
Column: 1
pass
# CALL_FUNCTION_KW
def function_4(**dummy):
return 1
return 2 # unreachable
# CALL_FUNCTION_VAR_KW
def function_5(dummy, dummy2, **dummy3):
Reported by Pylint.
Line: 15
Column: 5
# CALL_FUNCTION_KW
def function_4(**dummy):
return 1
return 2 # unreachable
# CALL_FUNCTION_VAR_KW
def function_5(dummy, dummy2, **dummy3):
if False:
return 7
Reported by Pylint.
Line: 18
Column: 1
return 2 # unreachable
# CALL_FUNCTION_VAR_KW
def function_5(dummy, dummy2, **dummy3):
if False:
return 7
return 8
def start():
Reported by Pylint.
Line: 18
Column: 23
return 2 # unreachable
# CALL_FUNCTION_VAR_KW
def function_5(dummy, dummy2, **dummy3):
if False:
return 7
return 8
def start():
Reported by Pylint.
Line: 18
Column: 16
return 2 # unreachable
# CALL_FUNCTION_VAR_KW
def function_5(dummy, dummy2, **dummy3):
if False:
return 7
return 8
def start():
Reported by Pylint.
Line: 19
Column: 5
# CALL_FUNCTION_VAR_KW
def function_5(dummy, dummy2, **dummy3):
if False:
return 7
return 8
def start():
function_1()
Reported by Pylint.
Line: 1
Column: 1
def function_1():
function_3(1, 2)
# Check stacktrace
def function_2():
function_1()
# CALL_FUNCTION_VAR
def function_3(dummy, dummy2):
Reported by Pylint.
Line: 1
Column: 1
def function_1():
function_3(1, 2)
# Check stacktrace
def function_2():
function_1()
# CALL_FUNCTION_VAR
def function_3(dummy, dummy2):
Reported by Pylint.
Lib/test/test_importlib/partial/cfimport.py
15 issues
Line: 13
Column: 9
def t1():
try:
from concurrent.futures import ThreadPoolExecutor
except Exception:
traceback.print_exc()
os._exit(1)
def t2():
Reported by Pylint.
Line: 14
Column: 12
def t1():
try:
from concurrent.futures import ThreadPoolExecutor
except Exception:
traceback.print_exc()
os._exit(1)
def t2():
try:
Reported by Pylint.
Line: 16
Column: 9
from concurrent.futures import ThreadPoolExecutor
except Exception:
traceback.print_exc()
os._exit(1)
def t2():
try:
from concurrent.futures.thread import ThreadPoolExecutor
except Exception:
Reported by Pylint.
Line: 20
Column: 9
def t2():
try:
from concurrent.futures.thread import ThreadPoolExecutor
except Exception:
traceback.print_exc()
os._exit(1)
def main():
Reported by Pylint.
Line: 21
Column: 12
def t2():
try:
from concurrent.futures.thread import ThreadPoolExecutor
except Exception:
traceback.print_exc()
os._exit(1)
def main():
for j in range(NLOOPS):
Reported by Pylint.
Line: 23
Column: 9
from concurrent.futures.thread import ThreadPoolExecutor
except Exception:
traceback.print_exc()
os._exit(1)
def main():
for j in range(NLOOPS):
threads = []
for i in range(NTHREADS):
Reported by Pylint.
Line: 26
Column: 9
os._exit(1)
def main():
for j in range(NLOOPS):
threads = []
for i in range(NTHREADS):
threads.append(threading.Thread(target=t2 if i % 1 else t1))
for thread in threads:
thread.start()
Reported by Pylint.
Line: 1
Column: 1
import os
import sys
import threading
import traceback
NLOOPS = 50
NTHREADS = 30
Reported by Pylint.
Line: 11
Column: 1
NTHREADS = 30
def t1():
try:
from concurrent.futures import ThreadPoolExecutor
except Exception:
traceback.print_exc()
os._exit(1)
Reported by Pylint.
Line: 11
Column: 1
NTHREADS = 30
def t1():
try:
from concurrent.futures import ThreadPoolExecutor
except Exception:
traceback.print_exc()
os._exit(1)
Reported by Pylint.
Lib/idlelib/idle_test/test_warning.py
15 issues
Line: 10
Column: 1
'''
from idlelib import run
from idlelib import pyshell as shell
import unittest
from test.support import captured_stderr
import warnings
# Try to capture default showwarning before Idle modules are imported.
showwarning = warnings.showwarning
Reported by Pylint.
Line: 11
Column: 1
from idlelib import run
from idlelib import pyshell as shell
import unittest
from test.support import captured_stderr
import warnings
# Try to capture default showwarning before Idle modules are imported.
showwarning = warnings.showwarning
# But if we run this file within idle, we are in the middle of the run.main loop
Reported by Pylint.
Line: 12
Column: 1
from idlelib import pyshell as shell
import unittest
from test.support import captured_stderr
import warnings
# Try to capture default showwarning before Idle modules are imported.
showwarning = warnings.showwarning
# But if we run this file within idle, we are in the middle of the run.main loop
# and default showwarnings has already been replaced.
Reported by Pylint.
Line: 22
Column: 1
# The following was generated from pyshell.idle_formatwarning
# and checked as matching expectation.
idlemsg = '''
Warning (from warnings module):
File "test_warning.py", line 99
Line of code
UserWarning: Test
'''
Reported by Pylint.
Line: 28
Column: 1
Line of code
UserWarning: Test
'''
shellmsg = idlemsg + ">>> "
class RunWarnTest(unittest.TestCase):
@unittest.skipIf(running_in_idle, "Does not work when run within Idle.")
Reported by Pylint.
Line: 31
Column: 1
shellmsg = idlemsg + ">>> "
class RunWarnTest(unittest.TestCase):
@unittest.skipIf(running_in_idle, "Does not work when run within Idle.")
def test_showwarnings(self):
self.assertIs(warnings.showwarning, showwarning)
run.capture_warnings(True)
Reported by Pylint.
Line: 34
Column: 5
class RunWarnTest(unittest.TestCase):
@unittest.skipIf(running_in_idle, "Does not work when run within Idle.")
def test_showwarnings(self):
self.assertIs(warnings.showwarning, showwarning)
run.capture_warnings(True)
self.assertIs(warnings.showwarning, run.idle_showwarning_subproc)
run.capture_warnings(False)
self.assertIs(warnings.showwarning, showwarning)
Reported by Pylint.
Line: 41
Column: 5
run.capture_warnings(False)
self.assertIs(warnings.showwarning, showwarning)
def test_run_show(self):
with captured_stderr() as f:
run.idle_showwarning_subproc(
'Test', UserWarning, 'test_warning.py', 99, f, 'Line of code')
# The following uses .splitlines to erase line-ending differences
self.assertEqual(idlemsg.splitlines(), f.getvalue().splitlines())
Reported by Pylint.
Line: 42
Column: 35
self.assertIs(warnings.showwarning, showwarning)
def test_run_show(self):
with captured_stderr() as f:
run.idle_showwarning_subproc(
'Test', UserWarning, 'test_warning.py', 99, f, 'Line of code')
# The following uses .splitlines to erase line-ending differences
self.assertEqual(idlemsg.splitlines(), f.getvalue().splitlines())
Reported by Pylint.
Line: 49
Column: 1
self.assertEqual(idlemsg.splitlines(), f.getvalue().splitlines())
class ShellWarnTest(unittest.TestCase):
@unittest.skipIf(running_in_idle, "Does not work when run within Idle.")
def test_showwarnings(self):
self.assertIs(warnings.showwarning, showwarning)
shell.capture_warnings(True)
Reported by Pylint.
Lib/lib2to3/btm_utils.py
15 issues
Line: 3
Column: 1
"Utility functions used by the btm_matcher module"
from . import pytree
from .pgen2 import grammar, token
from .pygram import pattern_symbols, python_symbols
syms = pattern_symbols
pysyms = python_symbols
tokens = grammar.opmap
Reported by Pylint.
Line: 4
Column: 1
"Utility functions used by the btm_matcher module"
from . import pytree
from .pgen2 import grammar, token
from .pygram import pattern_symbols, python_symbols
syms = pattern_symbols
pysyms = python_symbols
tokens = grammar.opmap
Reported by Pylint.
Line: 5
Column: 1
from . import pytree
from .pgen2 import grammar, token
from .pygram import pattern_symbols, python_symbols
syms = pattern_symbols
pysyms = python_symbols
tokens = grammar.opmap
token_labels = token
Reported by Pylint.
Line: 21
Column: 24
pattern tree during the conversion to sets of leaf-to-root
subpatterns"""
def __init__(self, type=None, name=None):
self.type = type
self.name = name
self.children = []
self.leaf = False
self.parent = None
Reported by Pylint.
Line: 161
Column: 9
#skip whole unit if its optional
return None
leaf = True
details_node = None
alternatives_node = None
has_repeater = False
repeater_node = None
has_variable_name = False
Reported by Pylint.
Line: 221
Column: 2
#reduce to a single occurrence i.e. do nothing
pass
else:
#TODO: handle {min, max} repeaters
raise NotImplementedError
#add children
if details_node and new_node is not None:
for child in details_node.children[1:-1]:
Reported by Pylint.
Line: 16
Column: 1
TYPE_ALTERNATIVES = -2
TYPE_GROUP = -3
class MinNode(object):
"""This class serves as an intermediate representation of the
pattern tree during the conversion to sets of leaf-to-root
subpatterns"""
def __init__(self, type=None, name=None):
Reported by Pylint.
Line: 42
Column: 17
while node:
if node.type == TYPE_ALTERNATIVES:
node.alternatives.append(subp)
if len(node.alternatives) == len(node.children):
#last alternative
subp = [tuple(node.alternatives)]
node.alternatives = []
node = node.parent
continue
Reported by Pylint.
Line: 56
Column: 17
if node.type == TYPE_GROUP:
node.group.append(subp)
#probably should check the number of leaves
if len(node.group) == len(node.children):
subp = get_characteristic_subpattern(node.group)
node.group = []
node = node.parent
continue
else:
Reported by Pylint.
Line: 75
Column: 5
node = node.parent
return subp
def get_linear_subpattern(self):
"""Drives the leaf_to_root method. The reason that
leaf_to_root must be run multiple times is because we need to
reject 'group' matches; for example the alternative form
(a | b c) creates a group [b c] that needs to be matched. Since
matching multiple linear patterns overcomes the automaton's
Reported by Pylint.
Lib/lib2to3/fixes/fix_operator.py
15 issues
Line: 77
Column: 30
def _isNumberType(self, node, results):
return self._handle_type2abc(node, results, "numbers", "Number")
def _handle_rename(self, node, results, name):
method = results["method"][0]
method.value = name
method.changed()
def _handle_type2abc(self, node, results, module, abc):
Reported by Pylint.
Line: 19
Column: 1
from lib2to3.fixer_util import Call, Name, String, touch_import
def invocation(s):
def dec(f):
f.invocation = s
return f
return dec
Reported by Pylint.
Line: 19
Column: 1
from lib2to3.fixer_util import Call, Name, String, touch_import
def invocation(s):
def dec(f):
f.invocation = s
return f
return dec
Reported by Pylint.
Line: 20
Column: 5
def invocation(s):
def dec(f):
f.invocation = s
return f
return dec
Reported by Pylint.
Line: 26
Column: 1
return dec
class FixOperator(fixer_base.BaseFix):
BM_compatible = True
order = "pre"
methods = """
method=('isCallable'|'sequenceIncludes'
Reported by Pylint.
Line: 43
Column: 5
power< %(methods)s trailer< %(obj)s > >
""" % dict(methods=methods, obj=obj)
def transform(self, node, results):
method = self._check_method(node, results)
if method is not None:
return method(node, results)
@invocation("operator.contains(%s)")
Reported by Pylint.
Line: 49
Column: 5
return method(node, results)
@invocation("operator.contains(%s)")
def _sequenceIncludes(self, node, results):
return self._handle_rename(node, results, "contains")
@invocation("callable(%s)")
def _isCallable(self, node, results):
obj = results["obj"]
Reported by Pylint.
Line: 53
Column: 5
return self._handle_rename(node, results, "contains")
@invocation("callable(%s)")
def _isCallable(self, node, results):
obj = results["obj"]
return Call(Name("callable"), [obj.clone()], prefix=node.prefix)
@invocation("operator.mul(%s)")
def _repeat(self, node, results):
Reported by Pylint.
Line: 53
Column: 5
return self._handle_rename(node, results, "contains")
@invocation("callable(%s)")
def _isCallable(self, node, results):
obj = results["obj"]
return Call(Name("callable"), [obj.clone()], prefix=node.prefix)
@invocation("operator.mul(%s)")
def _repeat(self, node, results):
Reported by Pylint.
Line: 66
Column: 5
return self._handle_rename(node, results, "imul")
@invocation("isinstance(%s, collections.abc.Sequence)")
def _isSequenceType(self, node, results):
return self._handle_type2abc(node, results, "collections.abc", "Sequence")
@invocation("isinstance(%s, collections.abc.Mapping)")
def _isMappingType(self, node, results):
return self._handle_type2abc(node, results, "collections.abc", "Mapping")
Reported by Pylint.
Lib/asyncio/staggered.py
15 issues
Line: 8
Column: 1
import contextlib
import typing
from . import events
from . import exceptions as exceptions_mod
from . import locks
from . import tasks
Reported by Pylint.
Line: 9
Column: 1
import typing
from . import events
from . import exceptions as exceptions_mod
from . import locks
from . import tasks
async def staggered_race(
Reported by Pylint.
Line: 10
Column: 1
from . import events
from . import exceptions as exceptions_mod
from . import locks
from . import tasks
async def staggered_race(
coro_fns: typing.Iterable[typing.Callable[[], typing.Awaitable]],
Reported by Pylint.
Line: 11
Column: 1
from . import events
from . import exceptions as exceptions_mod
from . import locks
from . import tasks
async def staggered_race(
coro_fns: typing.Iterable[typing.Callable[[], typing.Awaitable]],
delay: typing.Optional[float],
Reported by Pylint.
Line: 116
Column: 20
else:
# Store winner's results
nonlocal winner_index, winner_result
assert winner_index is None
winner_index = this_index
winner_result = result
# Cancel all other tasks. We take care to not cancel the current
# task as well. If we do so, then since there is no `await` after
# here and CancelledError are usually thrown at one, we will
Reported by Pylint.
Line: 74
Column: 3
coroutine's entry is ``None``.
"""
# TODO: when we have aiter() and anext(), allow async iterables in coro_fns.
loop = loop or events.get_running_loop()
enum_coro_fns = enumerate(coro_fns)
winner_result = None
winner_index = None
exceptions = []
Reported by Pylint.
Line: 110
Column: 16
result = await coro_fn()
except (SystemExit, KeyboardInterrupt):
raise
except BaseException as e:
exceptions[this_index] = e
this_failed.set() # Kickstart the next coroutine
else:
# Store winner's results
nonlocal winner_index, winner_result
Reported by Pylint.
Line: 3
Column: 1
"""Support for running coroutines in parallel with staggered start times."""
__all__ = 'staggered_race',
import contextlib
import typing
from . import events
from . import exceptions as exceptions_mod
Reported by Pylint.
Line: 101
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
this_failed = locks.Event()
next_task = loop.create_task(run_one_coro(this_failed))
running_tasks.append(next_task)
assert len(running_tasks) == this_index + 2
# Prepare place to put this coroutine's exceptions if not won
exceptions.append(None)
assert len(exceptions) == this_index + 1
try:
Reported by Bandit.
Line: 104
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
assert len(running_tasks) == this_index + 2
# Prepare place to put this coroutine's exceptions if not won
exceptions.append(None)
assert len(exceptions) == this_index + 1
try:
result = await coro_fn()
except (SystemExit, KeyboardInterrupt):
raise
Reported by Bandit.
Lib/idlelib/calltip_w.py
15 issues
Line: 59
Column: 5
self.anchor_widget.see("insert")
super(CalltipWindow, self).position_window()
def showtip(self, text, parenleft, parenright):
"""Show the call-tip, bind events which will close it and reposition it.
text: the text to display in the call-tip
parenleft: index of the opening parenthesis in the text widget
parenright: index of the closing parenthesis in the text widget,
Reported by Pylint.
Line: 88
Column: 31
font=self.anchor_widget['font'])
self.label.pack()
def checkhide_event(self, event=None):
"""Handle CHECK_HIDE_EVENT: call hidetip or reschedule."""
if not self.tipwindow:
# If the event was triggered by the same event that unbound
# this function, the function will be called nevertheless,
# so do nothing in this case.
Reported by Pylint.
Line: 115
Column: 26
self.anchor_widget.after(CHECKHIDE_TIME, self.checkhide_event)
return None
def hide_event(self, event):
"""Handle HIDE_EVENT by calling hidetip."""
if not self.tipwindow:
# See the explanation in checkhide_event.
return None
self.hidetip()
Reported by Pylint.
Line: 173
Column: 5
def _calltip_window(parent): # htest #
from tkinter import Toplevel, Text, LEFT, BOTH
top = Toplevel(parent)
top.title("Test call-tips")
x, y = map(int, parent.geometry().split('+')[1:])
top.geometry("250x100+%d+%d" % (x + 175, y + 150))
Reported by Pylint.
Line: 173
Column: 5
def _calltip_window(parent): # htest #
from tkinter import Toplevel, Text, LEFT, BOTH
top = Toplevel(parent)
top.title("Test call-tips")
x, y = map(int, parent.geometry().split('+')[1:])
top.geometry("250x100+%d+%d" % (x + 175, y + 150))
Reported by Pylint.
Line: 185
Column: 22
top.update()
calltip = CalltipWindow(text)
def calltip_show(event):
calltip.showtip("(s='Hello world')", "insert", "end")
def calltip_hide(event):
calltip.hidetip()
text.event_add("<<calltip-show>>", "(")
text.event_add("<<calltip-hide>>", ")")
Reported by Pylint.
Line: 187
Column: 22
calltip = CalltipWindow(text)
def calltip_show(event):
calltip.showtip("(s='Hello world')", "insert", "end")
def calltip_hide(event):
calltip.hidetip()
text.event_add("<<calltip-show>>", "(")
text.event_add("<<calltip-hide>>", ")")
text.bind("<<calltip-show>>", calltip_show)
text.bind("<<calltip-hide>>", calltip_hide)
Reported by Pylint.
Line: 19
Column: 1
MARK_RIGHT = "calltipwindowregion_right"
class CalltipWindow(TooltipBase):
"""A call-tip widget for tkinter text widgets."""
def __init__(self, text_widget):
"""Create a call-tip; shown by showtip().
Reported by Pylint.
Line: 28
Column: 9
text_widget: a Text widget with code for which call-tips are desired
"""
# Note: The Text widget will be accessible as self.anchor_widget
super(CalltipWindow, self).__init__(text_widget)
self.label = self.text = None
self.parenline = self.parencol = self.lastline = None
self.hideid = self.checkhideid = None
self.checkhide_after_id = None
Reported by Pylint.
Line: 57
Column: 9
return
self.lastline = curline
self.anchor_widget.see("insert")
super(CalltipWindow, self).position_window()
def showtip(self, text, parenleft, parenright):
"""Show the call-tip, bind events which will close it and reposition it.
text: the text to display in the call-tip
Reported by Pylint.