The following issues were found
Lib/unittest/suite.py
77 issues
Line: 5
Column: 1
import sys
from . import case
from . import util
__unittest = True
Reported by Pylint.
Line: 6
Column: 1
import sys
from . import case
from . import util
__unittest = True
def _call_if_exists(parent, attr):
Reported by Pylint.
Line: 102
Column: 5
subclassing, do not forget to call the base class constructor.
"""
def run(self, result, debug=False):
topLevel = False
if getattr(result, '_testRunEntered', False) is False:
result._testRunEntered = topLevel = True
for index, test in enumerate(self):
Reported by Pylint.
Line: 105
Column: 13
def run(self, result, debug=False):
topLevel = False
if getattr(result, '_testRunEntered', False) is False:
result._testRunEntered = topLevel = True
for index, test in enumerate(self):
if result.shouldStop:
break
Reported by Pylint.
Line: 115
Column: 17
self._tearDownPreviousClass(test, result)
self._handleModuleFixture(test, result)
self._handleClassSetUp(test, result)
result._previousTestClass = test.__class__
if (getattr(test.__class__, '_classSetupFailed', False) or
getattr(result, '_moduleSetUpFailed', False)):
continue
Reported by Pylint.
Line: 132
Column: 13
if topLevel:
self._tearDownPreviousClass(None, result)
self._handleModuleTearDown(result)
result._testRunEntered = False
return result
def debug(self):
"""Run the tests without collecting errors in a TestResult"""
debug = _DebugResult()
Reported by Pylint.
Line: 147
Column: 12
currentClass = test.__class__
if currentClass == previousClass:
return
if result._moduleSetUpFailed:
return
if getattr(currentClass, "__unittest_skip__", False):
return
try:
Reported by Pylint.
Line: 153
Column: 13
return
try:
currentClass._classSetupFailed = False
except TypeError:
# test may actually be a function
# so its class will be a builtin-type
pass
Reported by Pylint.
Line: 164
Column: 20
_call_if_exists(result, '_setupStdout')
try:
setUpClass()
except Exception as e:
if isinstance(result, _DebugResult):
raise
currentClass._classSetupFailed = True
className = util.strclass(currentClass)
self._createClassOrModuleLevelException(result, e,
Reported by Pylint.
Line: 167
Column: 17
except Exception as e:
if isinstance(result, _DebugResult):
raise
currentClass._classSetupFailed = True
className = util.strclass(currentClass)
self._createClassOrModuleLevelException(result, e,
'setUpClass',
className)
finally:
Reported by Pylint.
Lib/turtledemo/round_dance.py
77 issues
Line: 33
Column: 5
def main():
global running
clearscreen()
bgcolor("gray10")
tracer(False)
shape("triangle")
f = 0.793402
phi = 9.064678
Reported by Pylint.
Line: 34
Column: 5
def main():
global running
clearscreen()
bgcolor("gray10")
tracer(False)
shape("triangle")
f = 0.793402
phi = 9.064678
s = 5
Reported by Pylint.
Line: 35
Column: 5
global running
clearscreen()
bgcolor("gray10")
tracer(False)
shape("triangle")
f = 0.793402
phi = 9.064678
s = 5
c = 1
Reported by Pylint.
Line: 36
Column: 5
clearscreen()
bgcolor("gray10")
tracer(False)
shape("triangle")
f = 0.793402
phi = 9.064678
s = 5
c = 1
# create compound shape
Reported by Pylint.
Line: 44
Column: 9
# create compound shape
sh = Shape("compound")
for i in range(10):
shapesize(s)
p =get_shapepoly()
s *= f
c *= f
tilt(-phi)
sh.addcomponent(p, (c, 0.25, 1-c), "black")
Reported by Pylint.
Line: 45
Column: 12
sh = Shape("compound")
for i in range(10):
shapesize(s)
p =get_shapepoly()
s *= f
c *= f
tilt(-phi)
sh.addcomponent(p, (c, 0.25, 1-c), "black")
register_shape("multitri", sh)
Reported by Pylint.
Line: 48
Column: 9
p =get_shapepoly()
s *= f
c *= f
tilt(-phi)
sh.addcomponent(p, (c, 0.25, 1-c), "black")
register_shape("multitri", sh)
# create dancers
shapesize(1)
shape("multitri")
Reported by Pylint.
Line: 50
Column: 5
c *= f
tilt(-phi)
sh.addcomponent(p, (c, 0.25, 1-c), "black")
register_shape("multitri", sh)
# create dancers
shapesize(1)
shape("multitri")
pu()
setpos(0, -200)
Reported by Pylint.
Line: 52
Column: 5
sh.addcomponent(p, (c, 0.25, 1-c), "black")
register_shape("multitri", sh)
# create dancers
shapesize(1)
shape("multitri")
pu()
setpos(0, -200)
dancers = []
for i in range(180):
Reported by Pylint.
Line: 53
Column: 5
register_shape("multitri", sh)
# create dancers
shapesize(1)
shape("multitri")
pu()
setpos(0, -200)
dancers = []
for i in range(180):
fd(7)
Reported by Pylint.
Lib/distutils/tests/test_dist.py
77 issues
Line: 290
Column: 26
dist = Distribution(attrs)
self.assertEqual(dist.metadata.get_provides(),
["package", "package.sub"])
self.assertEqual(dist.get_provides(),
["package", "package.sub"])
meta = self.format_metadata(dist)
self.assertIn("Metadata-Version: 1.1", meta)
self.assertNotIn("requires:", meta.lower())
self.assertNotIn("obsoletes:", meta.lower())
Reported by Pylint.
Line: 310
Column: 26
dist = Distribution(attrs)
self.assertEqual(dist.metadata.get_requires(),
["other", "another (==1.0)"])
self.assertEqual(dist.get_requires(),
["other", "another (==1.0)"])
meta = self.format_metadata(dist)
self.assertIn("Metadata-Version: 1.1", meta)
self.assertNotIn("provides:", meta.lower())
self.assertIn("Requires: other", meta)
Reported by Pylint.
Line: 339
Column: 26
dist = Distribution(attrs)
self.assertEqual(dist.metadata.get_obsoletes(),
["other", "another (<1.0)"])
self.assertEqual(dist.get_obsoletes(),
["other", "another (<1.0)"])
meta = self.format_metadata(dist)
self.assertIn("Metadata-Version: 1.1", meta)
self.assertNotIn("provides:", meta.lower())
self.assertNotIn("requires:", meta.lower())
Reported by Pylint.
Line: 364
Column: 26
attrs = {'name': 'Boa', 'version': '3.0',
'classifiers': ['Programming Language :: Python :: 3']}
dist = Distribution(attrs)
self.assertEqual(dist.get_classifiers(),
['Programming Language :: Python :: 3'])
meta = self.format_metadata(dist)
self.assertIn('Metadata-Version: 1.1', meta)
def test_classifier_invalid_type(self):
Reported by Pylint.
Line: 385
Column: 26
attrs = {'name': 'Monty', 'version': '1.0',
'keywords': ['spam', 'eggs', 'life of brian']}
dist = Distribution(attrs)
self.assertEqual(dist.get_keywords(),
['spam', 'eggs', 'life of brian'])
def test_keywords_invalid_type(self):
attrs = {'name': 'Monty', 'version': '1.0',
'keywords': ('spam', 'eggs', 'life of brian')}
Reported by Pylint.
Line: 403
Column: 26
attrs = {'name': 'Monty', 'version': '1.0',
'platforms': ['GNU/Linux', 'Some Evil Platform']}
dist = Distribution(attrs)
self.assertEqual(dist.get_platforms(),
['GNU/Linux', 'Some Evil Platform'])
def test_platforms_invalid_types(self):
attrs = {'name': 'Monty', 'version': '1.0',
'platforms': ('GNU/Linux', 'Some Evil Platform')}
Reported by Pylint.
Line: 62
Column: 9
def create_distribution(self, configfiles=()):
d = TestDistribution()
d._config_files = configfiles
d.parse_config_files()
d.parse_command_line()
return d
def test_command_packages_unspecified(self):
Reported by Pylint.
Line: 62
Column: 9
def create_distribution(self, configfiles=()):
d = TestDistribution()
d._config_files = configfiles
d.parse_config_files()
d.parse_command_line()
return d
def test_command_packages_unspecified(self):
Reported by Pylint.
Line: 73
Column: 9
self.assertEqual(d.get_command_packages(), ["distutils.command"])
def test_command_packages_cmdline(self):
from distutils.tests.test_dist import test_dist
sys.argv.extend(["--command-packages",
"foo.bar,distutils.tests",
"test_dist",
"-Ssometext",
])
Reported by Pylint.
Line: 110
Column: 73
"root = {0}").format(fakepath), file=f)
# Base case: Not in a Virtual Environment
with mock.patch.multiple(sys, prefix='/a', base_prefix='/a') as values:
d = self.create_distribution([TESTFN])
option_tuple = (TESTFN, fakepath)
result_dict = {
Reported by Pylint.
Lib/distutils/sysconfig.py
77 issues
Line: 20
Column: 1
from functools import partial
from .errors import DistutilsPlatformError
from sysconfig import (
_PREFIX as PREFIX,
_BASE_PREFIX as BASE_PREFIX,
_EXEC_PREFIX as EXEC_PREFIX,
Reported by Pylint.
Line: 22
Column: 1
from .errors import DistutilsPlatformError
from sysconfig import (
_PREFIX as PREFIX,
_BASE_PREFIX as BASE_PREFIX,
_EXEC_PREFIX as EXEC_PREFIX,
_BASE_EXEC_PREFIX as BASE_EXEC_PREFIX,
_PROJECT_BASE as project_base,
Reported by Pylint.
Line: 22
Column: 1
from .errors import DistutilsPlatformError
from sysconfig import (
_PREFIX as PREFIX,
_BASE_PREFIX as BASE_PREFIX,
_EXEC_PREFIX as EXEC_PREFIX,
_BASE_EXEC_PREFIX as BASE_EXEC_PREFIX,
_PROJECT_BASE as project_base,
Reported by Pylint.
Line: 22
Column: 1
from .errors import DistutilsPlatformError
from sysconfig import (
_PREFIX as PREFIX,
_BASE_PREFIX as BASE_PREFIX,
_EXEC_PREFIX as EXEC_PREFIX,
_BASE_EXEC_PREFIX as BASE_EXEC_PREFIX,
_PROJECT_BASE as project_base,
Reported by Pylint.
Line: 22
Column: 1
from .errors import DistutilsPlatformError
from sysconfig import (
_PREFIX as PREFIX,
_BASE_PREFIX as BASE_PREFIX,
_EXEC_PREFIX as EXEC_PREFIX,
_BASE_EXEC_PREFIX as BASE_EXEC_PREFIX,
_PROJECT_BASE as project_base,
Reported by Pylint.
Line: 22
Column: 1
from .errors import DistutilsPlatformError
from sysconfig import (
_PREFIX as PREFIX,
_BASE_PREFIX as BASE_PREFIX,
_EXEC_PREFIX as EXEC_PREFIX,
_BASE_EXEC_PREFIX as BASE_EXEC_PREFIX,
_PROJECT_BASE as project_base,
Reported by Pylint.
Line: 22
Column: 1
from .errors import DistutilsPlatformError
from sysconfig import (
_PREFIX as PREFIX,
_BASE_PREFIX as BASE_PREFIX,
_EXEC_PREFIX as EXEC_PREFIX,
_BASE_EXEC_PREFIX as BASE_EXEC_PREFIX,
_PROJECT_BASE as project_base,
Reported by Pylint.
Line: 333
Column: 22
if plat_specific or standard_lib:
# Platform-specific modules (any module from a non-pure-Python
# module distribution) or standard Python library modules.
libdir = sys.platlibdir
else:
# Pure Python
libdir = "lib"
libpython = os.path.join(prefix, libdir,
"python" + get_python_version())
Reported by Pylint.
Line: 12
Column: 1
Email: <fdrake@acm.org>
"""
import _imp
import os
import re
import sys
import warnings
Reported by Pylint.
Line: 22
Column: 1
from .errors import DistutilsPlatformError
from sysconfig import (
_PREFIX as PREFIX,
_BASE_PREFIX as BASE_PREFIX,
_EXEC_PREFIX as EXEC_PREFIX,
_BASE_EXEC_PREFIX as BASE_EXEC_PREFIX,
_PROJECT_BASE as project_base,
Reported by Pylint.
Lib/test/test_dbm_dumb.py
76 issues
Line: 59
Column: 9
# This shouldn't fail, but doesn't work like Unix either.
expected_mode = 0o666
import stat
st = os.stat(_fname + '.dat')
self.assertEqual(stat.S_IMODE(st.st_mode), expected_mode)
st = os.stat(_fname + '.dir')
self.assertEqual(stat.S_IMODE(st.st_mode), expected_mode)
Reported by Pylint.
Line: 59
Column: 9
# This shouldn't fail, but doesn't work like Unix either.
expected_mode = 0o666
import stat
st = os.stat(_fname + '.dat')
self.assertEqual(stat.S_IMODE(st.st_mode), expected_mode)
st = os.stat(_fname + '.dir')
self.assertEqual(stat.S_IMODE(st.st_mode), expected_mode)
Reported by Pylint.
Line: 96
Column: 17
self.assertEqual(f.get(b'xxx', b'foo'), b'foo')
self.assertIsNone(f.get(b'xxx'))
with self.assertRaises(KeyError):
f[b'xxx']
def test_dumbdbm_keys(self):
self.init_db()
with contextlib.closing(dumbdbm.open(_fname)) as f:
keys = self.keys_helper(f)
Reported by Pylint.
Line: 101
Column: 13
def test_dumbdbm_keys(self):
self.init_db()
with contextlib.closing(dumbdbm.open(_fname)) as f:
keys = self.keys_helper(f)
def test_write_contains(self):
with contextlib.closing(dumbdbm.open(_fname)) as f:
f[b'1'] = b'hello'
self.assertIn(b'1', f)
Reported by Pylint.
Line: 155
Column: 9
def read_helper(self, f):
keys = self.keys_helper(f)
for key in self._dict:
self.assertEqual(self._dict[key], f[key])
def init_db(self):
with contextlib.closing(dumbdbm.open(_fname, 'n')) as f:
Reported by Pylint.
Line: 239
Column: 46
stream.write("str(print('Hacked!')), 0\n")
with support.captured_stdout() as stdout:
with self.assertRaises(ValueError):
with dumbdbm.open(_fname) as f:
pass
self.assertEqual(stdout.getvalue(), '')
def test_missing_data(self):
for value in ('r', 'w'):
Reported by Pylint.
Line: 252
Column: 43
self.assertFalse(os.path.exists(_fname + '.bak'))
def test_missing_index(self):
with dumbdbm.open(_fname, 'n') as f:
pass
os.unlink(_fname + '.dir')
for value in ('r', 'w'):
with self.assertRaises(FileNotFoundError):
dumbdbm.open(_fname, value)
Reported by Pylint.
Line: 269
Column: 38
dumbdbm.open(_fname, flag)
def test_readonly_files(self):
with os_helper.temp_dir() as dir:
fname = os.path.join(dir, 'db')
with dumbdbm.open(fname, 'n') as f:
self.assertEqual(list(f.keys()), [])
for key in self._dict:
f[key] = self._dict[key]
Reported by Pylint.
Line: 26
Column: 1
except OSError:
pass
class DumbDBMTestCase(unittest.TestCase):
_dict = {b'0': b'',
b'a': b'Python:',
b'b': b'Programming',
b'c': b'the',
b'd': b'way',
Reported by Pylint.
Line: 26
Column: 1
except OSError:
pass
class DumbDBMTestCase(unittest.TestCase):
_dict = {b'0': b'',
b'a': b'Python:',
b'b': b'Programming',
b'c': b'the',
b'd': b'way',
Reported by Pylint.
Tools/peg_generator/pegen/grammar_parser.py
76 issues
Line: 4
Column: 1
#!/usr/bin/env python3.8
# @generated by pegen from ./Tools/peg_generator/pegen/metagrammar.gram
import ast
import sys
import tokenize
from typing import Any, Optional
Reported by Pylint.
Line: 5
Column: 1
# @generated by pegen from ./Tools/peg_generator/pegen/metagrammar.gram
import ast
import sys
import tokenize
from typing import Any, Optional
from pegen.parser import memoize, memoize_left_rec, logger, Parser
Reported by Pylint.
Line: 6
Column: 1
import ast
import sys
import tokenize
from typing import Any, Optional
from pegen.parser import memoize, memoize_left_rec, logger, Parser
from ast import literal_eval
Reported by Pylint.
Line: 8
Column: 1
import sys
import tokenize
from typing import Any, Optional
from pegen.parser import memoize, memoize_left_rec, logger, Parser
from ast import literal_eval
from pegen.grammar import (
Reported by Pylint.
Line: 10
Column: 1
from typing import Any, Optional
from pegen.parser import memoize, memoize_left_rec, logger, Parser
from ast import literal_eval
from pegen.grammar import (
Alt,
Cut,
Reported by Pylint.
Line: 10
Column: 1
from typing import Any, Optional
from pegen.parser import memoize, memoize_left_rec, logger, Parser
from ast import literal_eval
from pegen.grammar import (
Alt,
Cut,
Reported by Pylint.
Line: 13
Column: 1
from pegen.parser import memoize, memoize_left_rec, logger, Parser
from ast import literal_eval
from pegen.grammar import (
Alt,
Cut,
Forced,
Gather,
Group,
Reported by Pylint.
Line: 98
Column: 14
# meta: "@" NAME NEWLINE | "@" NAME NAME NEWLINE | "@" NAME STRING NEWLINE
mark = self._mark()
if (
(literal := self.expect("@"))
and
(name := self.name())
and
(_newline := self.expect('NEWLINE'))
):
Reported by Pylint.
Line: 157
Column: 14
and
(opt := self.memoflag(),)
and
(literal := self.expect(":"))
and
(alts := self.alts())
and
(_newline := self.expect('NEWLINE'))
and
Reported by Pylint.
Line: 226
Column: 14
# memoflag: '(' "memo" ')'
mark = self._mark()
if (
(literal := self.expect('('))
and
(literal_1 := self.expect("memo"))
and
(literal_2 := self.expect(')'))
):
Reported by Pylint.
Lib/concurrent/futures/process.py
76 issues
Line: 59
Column: 1
from functools import partial
import itertools
import sys
from traceback import format_exception
_threads_wakeups = weakref.WeakKeyDictionary()
_global_shutdown = False
Reported by Pylint.
Line: 52
Column: 1
from concurrent.futures import _base
import queue
import multiprocessing as mp
import multiprocessing.connection
from multiprocessing.queues import Queue
import threading
import weakref
from functools import partial
import itertools
Reported by Pylint.
Line: 88
Column: 5
def _python_exit():
global _global_shutdown
_global_shutdown = True
items = list(_threads_wakeups.items())
for _, thread_wakeup in items:
# call not protected by ProcessPoolExecutor._shutdown_lock
thread_wakeup.wakeup()
Reported by Pylint.
Line: 101
Column: 1
# non-daemon threads. This is used instead of `atexit.register()` for
# compatibility with subinterpreters, which no longer support daemon threads.
# See bpo-39812 for context.
threading._register_atexit(_python_exit)
# Controls how many more calls than processes will be queued in the call queue.
# A smaller number will mean that processes spend more time idle waiting for
# work while a larger number will make Future.cancel() succeed less frequently
# (Futures in the call queue cannot be cancelled).
Reported by Pylint.
Line: 119
Column: 5
# Hack to embed stringification of remote traceback in local traceback
class _RemoteTraceback(Exception):
def __init__(self, tb):
self.tb = tb
def __str__(self):
return self.tb
class _ExceptionWithTraceback:
Reported by Pylint.
Line: 209
Column: 12
try:
result_queue.put(_ResultItem(work_id, result=result,
exception=exception))
except BaseException as e:
exc = _ExceptionWithTraceback(e, e.__traceback__)
result_queue.put(_ResultItem(work_id, exception=exc))
def _process_worker(call_queue, result_queue, initializer, initargs):
Reported by Pylint.
Line: 230
Column: 16
if initializer is not None:
try:
initializer(*initargs)
except BaseException:
_base.LOGGER.critical('Exception in initializer:', exc_info=True)
# The parent will notice that the process stopped and
# mark the pool broken
return
while True:
Reported by Pylint.
Line: 243
Column: 16
return
try:
r = call_item.fn(*call_item.args, **call_item.kwargs)
except BaseException as e:
exc = _ExceptionWithTraceback(e, e.__traceback__)
_sendback_result(result_queue, call_item.work_id, exception=exc)
else:
_sendback_result(result_queue, call_item.work_id, result=r)
del r
Reported by Pylint.
Line: 330
Column: 21
# attempt to increment idle process count
executor = self.executor_reference()
if executor is not None:
executor._idle_worker_semaphore.release()
del executor
if self.is_shutting_down():
self.flag_executor_shutting_down()
Reported by Pylint.
Line: 371
Column: 25
# signal send. The wake up signals come either from new tasks being
# submitted, from the executor being shutdown/gc-ed, or from the
# shutdown of the python interpreter.
result_reader = self.result_queue._reader
assert not self.thread_wakeup._closed
wakeup_reader = self.thread_wakeup._reader
readers = [result_reader, wakeup_reader]
worker_sentinels = [p.sentinel for p in self.processes.values()]
ready = mp.connection.wait(readers + worker_sentinels)
Reported by Pylint.
Lib/test/test_audioop.py
75 issues
Line: 1
Column: 1
import audioop
import sys
import unittest
def pack(width, data):
return b''.join(v.to_bytes(width, sys.byteorder, signed=True) for v in data)
def unpack(width, data):
return [int.from_bytes(data[i: i + width], sys.byteorder, signed=True)
Reported by Pylint.
Line: 5
Column: 1
import sys
import unittest
def pack(width, data):
return b''.join(v.to_bytes(width, sys.byteorder, signed=True) for v in data)
def unpack(width, data):
return [int.from_bytes(data[i: i + width], sys.byteorder, signed=True)
for i in range(0, len(data), width)]
Reported by Pylint.
Line: 8
Column: 1
def pack(width, data):
return b''.join(v.to_bytes(width, sys.byteorder, signed=True) for v in data)
def unpack(width, data):
return [int.from_bytes(data[i: i + width], sys.byteorder, signed=True)
for i in range(0, len(data), width)]
packs = {w: (lambda *data, width=w: pack(width, data)) for w in (1, 2, 3, 4)}
maxvalues = {w: (1 << (8 * w - 1)) - 1 for w in (1, 2, 3, 4)}
Reported by Pylint.
Line: 32
Column: 1
]
class TestAudioop(unittest.TestCase):
def test_max(self):
for w in 1, 2, 3, 4:
self.assertEqual(audioop.max(b'', w), 0)
self.assertEqual(audioop.max(bytearray(), w), 0)
Reported by Pylint.
Line: 32
Column: 1
]
class TestAudioop(unittest.TestCase):
def test_max(self):
for w in 1, 2, 3, 4:
self.assertEqual(audioop.max(b'', w), 0)
self.assertEqual(audioop.max(bytearray(), w), 0)
Reported by Pylint.
Line: 34
Column: 5
class TestAudioop(unittest.TestCase):
def test_max(self):
for w in 1, 2, 3, 4:
self.assertEqual(audioop.max(b'', w), 0)
self.assertEqual(audioop.max(bytearray(), w), 0)
self.assertEqual(audioop.max(memoryview(b''), w), 0)
p = packs[w]
Reported by Pylint.
Line: 35
Column: 13
class TestAudioop(unittest.TestCase):
def test_max(self):
for w in 1, 2, 3, 4:
self.assertEqual(audioop.max(b'', w), 0)
self.assertEqual(audioop.max(bytearray(), w), 0)
self.assertEqual(audioop.max(memoryview(b''), w), 0)
p = packs[w]
self.assertEqual(audioop.max(p(5), w), 5)
Reported by Pylint.
Line: 39
Column: 13
self.assertEqual(audioop.max(b'', w), 0)
self.assertEqual(audioop.max(bytearray(), w), 0)
self.assertEqual(audioop.max(memoryview(b''), w), 0)
p = packs[w]
self.assertEqual(audioop.max(p(5), w), 5)
self.assertEqual(audioop.max(p(5, -8, -1), w), 8)
self.assertEqual(audioop.max(p(maxvalues[w]), w), maxvalues[w])
self.assertEqual(audioop.max(p(minvalues[w]), w), -minvalues[w])
self.assertEqual(audioop.max(datas[w], w), -minvalues[w])
Reported by Pylint.
Line: 46
Column: 5
self.assertEqual(audioop.max(p(minvalues[w]), w), -minvalues[w])
self.assertEqual(audioop.max(datas[w], w), -minvalues[w])
def test_minmax(self):
for w in 1, 2, 3, 4:
self.assertEqual(audioop.minmax(b'', w),
(0x7fffffff, -0x80000000))
self.assertEqual(audioop.minmax(bytearray(), w),
(0x7fffffff, -0x80000000))
Reported by Pylint.
Line: 47
Column: 13
self.assertEqual(audioop.max(datas[w], w), -minvalues[w])
def test_minmax(self):
for w in 1, 2, 3, 4:
self.assertEqual(audioop.minmax(b'', w),
(0x7fffffff, -0x80000000))
self.assertEqual(audioop.minmax(bytearray(), w),
(0x7fffffff, -0x80000000))
self.assertEqual(audioop.minmax(memoryview(b''), w),
Reported by Pylint.
Lib/test/test_dbm.py
75 issues
Line: 59
Column: 9
def keys_helper(self, f):
keys = sorted(k.decode("ascii") for k in f.keys())
dkeys = sorted(self._dict.keys())
self.assertEqual(keys, dkeys)
return keys
def test_error(self):
self.assertTrue(issubclass(self.module.error, OSError))
Reported by Pylint.
Line: 63
Column: 9
return keys
def test_error(self):
self.assertTrue(issubclass(self.module.error, OSError))
def test_anydbm_not_existing(self):
self.assertRaises(dbm.error, dbm.open, _fname)
def test_anydbm_creation(self):
Reported by Pylint.
Line: 63
Column: 36
return keys
def test_error(self):
self.assertTrue(issubclass(self.module.error, OSError))
def test_anydbm_not_existing(self):
self.assertRaises(dbm.error, dbm.open, _fname)
def test_anydbm_creation(self):
Reported by Pylint.
Line: 66
Column: 9
self.assertTrue(issubclass(self.module.error, OSError))
def test_anydbm_not_existing(self):
self.assertRaises(dbm.error, dbm.open, _fname)
def test_anydbm_creation(self):
f = dbm.open(_fname, 'c')
self.assertEqual(list(f.keys()), [])
for key in self._dict:
Reported by Pylint.
Line: 70
Column: 9
def test_anydbm_creation(self):
f = dbm.open(_fname, 'c')
self.assertEqual(list(f.keys()), [])
for key in self._dict:
f[key.encode("ascii")] = self._dict[key]
self.read_helper(f)
f.close()
Reported by Pylint.
Line: 80
Column: 13
# create an empty file
os_helper.create_empty_file(_fname)
with dbm.open(_fname, 'n') as f:
self.assertEqual(len(f), 0)
def test_anydbm_modification(self):
self.init_db()
f = dbm.open(_fname, 'c')
self._dict['g'] = f[b'g'] = b"indented"
Reported by Pylint.
Line: 88
Column: 9
self._dict['g'] = f[b'g'] = b"indented"
self.read_helper(f)
# setdefault() works as in the dict interface
self.assertEqual(f.setdefault(b'xxx', b'foo'), b'foo')
self.assertEqual(f[b'xxx'], b'foo')
f.close()
def test_anydbm_read(self):
self.init_db()
Reported by Pylint.
Line: 89
Column: 9
self.read_helper(f)
# setdefault() works as in the dict interface
self.assertEqual(f.setdefault(b'xxx', b'foo'), b'foo')
self.assertEqual(f[b'xxx'], b'foo')
f.close()
def test_anydbm_read(self):
self.init_db()
f = dbm.open(_fname, 'r')
Reported by Pylint.
Line: 97
Column: 9
f = dbm.open(_fname, 'r')
self.read_helper(f)
# get() works as in the dict interface
self.assertEqual(f.get(b'a'), self._dict['a'])
self.assertEqual(f.get(b'xxx', b'foo'), b'foo')
self.assertIsNone(f.get(b'xxx'))
with self.assertRaises(KeyError):
f[b'xxx']
f.close()
Reported by Pylint.
Line: 98
Column: 9
self.read_helper(f)
# get() works as in the dict interface
self.assertEqual(f.get(b'a'), self._dict['a'])
self.assertEqual(f.get(b'xxx', b'foo'), b'foo')
self.assertIsNone(f.get(b'xxx'))
with self.assertRaises(KeyError):
f[b'xxx']
f.close()
Reported by Pylint.
Lib/asyncio/events.py
75 issues
Line: 21
Column: 1
import sys
import threading
from . import format_helpers
class Handle:
"""Object returned by callback registration methods."""
Reported by Pylint.
Line: 673
Column: 16
You must call set_event_loop() to make this the current event
loop.
"""
return self._loop_factory()
# Event loop policy. The policy itself is always global, even if the
# policy's rules say that there is an event loop per thread (or other
# notion of context). The default policy is installed by the first
Reported by Pylint.
Line: 732
Column: 13
global _event_loop_policy
with _lock:
if _event_loop_policy is None: # pragma: no branch
from . import DefaultEventLoopPolicy
_event_loop_policy = DefaultEventLoopPolicy()
def get_event_loop_policy():
"""Get the current event loop policy."""
Reported by Pylint.
Line: 51
Column: 25
if self._cancelled:
info.append('cancelled')
if self._callback is not None:
info.append(format_helpers._format_callback_source(
self._callback, self._args))
if self._source_traceback:
frame = self._source_traceback[-1]
info.append(f'created at {frame[0]}:{frame[1]}')
return info
Reported by Pylint.
Line: 83
Column: 16
self._context.run(self._callback, *self._args)
except (SystemExit, KeyboardInterrupt):
raise
except BaseException as exc:
cb = format_helpers._format_callback_source(
self._callback, self._args)
msg = f'Exception in callback {cb}'
context = {
'message': msg,
Reported by Pylint.
Line: 84
Column: 18
except (SystemExit, KeyboardInterrupt):
raise
except BaseException as exc:
cb = format_helpers._format_callback_source(
self._callback, self._args)
msg = f'Exception in callback {cb}'
context = {
'message': msg,
'exception': exc,
Reported by Pylint.
Line: 95
Column: 9
if self._source_traceback:
context['source_traceback'] = self._source_traceback
self._loop.call_exception_handler(context)
self = None # Needed to break cycles when an exception occurs.
class TimerHandle(Handle):
"""Object returned by timed callback registration methods."""
Reported by Pylint.
Line: 150
Column: 13
def cancel(self):
if not self._cancelled:
self._loop._timer_handle_cancelled(self)
super().cancel()
def when(self):
"""Return a scheduled callback time.
Reported by Pylint.
Line: 295
Column: 37
# Network I/O methods returning Futures.
async def getaddrinfo(self, host, port, *,
family=0, type=0, proto=0, flags=0):
raise NotImplementedError
async def getnameinfo(self, sockaddr, flags=0):
raise NotImplementedError
Reported by Pylint.
Line: 623
Column: 1
raise NotImplementedError
class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy):
"""Default policy implementation for accessing the event loop.
In this policy, each thread has its own event loop. However, we
only automatically create an event loop by default for the main
thread; other threads by default have no event loop.
Reported by Pylint.