The following issues were found
Lib/distutils/tests/test_build_clib.py
19 issues
Line: 83
Column: 13
pkg_dir, dist = self.create_dist()
cmd = build_clib(dist)
class FakeCompiler:
def compile(*args, **kw):
pass
create_static_lib = compile
cmd.compiler = FakeCompiler()
Reported by Pylint.
Line: 19
Column: 41
def setUp(self):
super().setUp()
self._backup_CONFIG_VARS = dict(sysconfig._CONFIG_VARS)
def tearDown(self):
super().tearDown()
sysconfig._CONFIG_VARS.clear()
sysconfig._CONFIG_VARS.update(self._backup_CONFIG_VARS)
Reported by Pylint.
Line: 23
Column: 9
def tearDown(self):
super().tearDown()
sysconfig._CONFIG_VARS.clear()
sysconfig._CONFIG_VARS.update(self._backup_CONFIG_VARS)
def test_check_library_dist(self):
pkg_dir, dist = self.create_dist()
cmd = build_clib(dist)
Reported by Pylint.
Line: 24
Column: 9
def tearDown(self):
super().tearDown()
sysconfig._CONFIG_VARS.clear()
sysconfig._CONFIG_VARS.update(self._backup_CONFIG_VARS)
def test_check_library_dist(self):
pkg_dir, dist = self.create_dist()
cmd = build_clib(dist)
Reported by Pylint.
Line: 27
Column: 9
sysconfig._CONFIG_VARS.update(self._backup_CONFIG_VARS)
def test_check_library_dist(self):
pkg_dir, dist = self.create_dist()
cmd = build_clib(dist)
# 'libraries' option must be a list
self.assertRaises(DistutilsSetupError, cmd.check_library_list, 'foo')
Reported by Pylint.
Line: 57
Column: 9
cmd.check_library_list(libs)
def test_get_source_files(self):
pkg_dir, dist = self.create_dist()
cmd = build_clib(dist)
# "in 'libraries' option 'sources' must be present and must be
# a list of source filenames
cmd.libraries = [('name', {})]
Reported by Pylint.
Line: 80
Column: 9
def test_build_libraries(self):
pkg_dir, dist = self.create_dist()
cmd = build_clib(dist)
class FakeCompiler:
def compile(*args, **kw):
pass
create_static_lib = compile
Reported by Pylint.
Line: 100
Column: 9
cmd.build_libraries(lib)
def test_finalize_options(self):
pkg_dir, dist = self.create_dist()
cmd = build_clib(dist)
cmd.include_dirs = 'one-dir'
cmd.finalize_options()
self.assertEqual(cmd.include_dirs, ['one-dir'])
Reported by Pylint.
Line: 13
Column: 1
from distutils.errors import DistutilsSetupError
from distutils.tests import support
class BuildCLibTestCase(support.TempdirManager,
support.LoggingSilencer,
unittest.TestCase):
def setUp(self):
super().setUp()
Reported by Pylint.
Line: 19
Column: 9
def setUp(self):
super().setUp()
self._backup_CONFIG_VARS = dict(sysconfig._CONFIG_VARS)
def tearDown(self):
super().tearDown()
sysconfig._CONFIG_VARS.clear()
sysconfig._CONFIG_VARS.update(self._backup_CONFIG_VARS)
Reported by Pylint.
Doc/includes/tzinfo_examples.py
19 issues
Line: 1
Column: 1
from datetime import tzinfo, timedelta, datetime
ZERO = timedelta(0)
HOUR = timedelta(hours=1)
SECOND = timedelta(seconds=1)
# A class capturing the platform's idea of local time.
# (May result in wrong values on historical times in
# timezones where UTC offset and/or the DST rules had
Reported by Pylint.
Line: 11
Column: 1
# (May result in wrong values on historical times in
# timezones where UTC offset and/or the DST rules had
# changed in the past.)
import time as _time
STDOFFSET = timedelta(seconds = -_time.timezone)
if _time.daylight:
DSTOFFSET = timedelta(seconds = -_time.altzone)
else:
Reported by Pylint.
Line: 21
Column: 1
DSTDIFF = DSTOFFSET - STDOFFSET
class LocalTimezone(tzinfo):
def fromutc(self, dt):
assert dt.tzinfo is self
stamp = (dt - datetime(1970, 1, 1, tzinfo=self)) // SECOND
args = _time.localtime(stamp)[:6]
Reported by Pylint.
Line: 24
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
class LocalTimezone(tzinfo):
def fromutc(self, dt):
assert dt.tzinfo is self
stamp = (dt - datetime(1970, 1, 1, tzinfo=self)) // SECOND
args = _time.localtime(stamp)[:6]
dst_diff = DSTDIFF // SECOND
# Detect fold
fold = (args == _time.localtime(stamp - dst_diff))
Reported by Bandit.
Line: 34
Column: 9
tzinfo=self, fold=fold)
def utcoffset(self, dt):
if self._isdst(dt):
return DSTOFFSET
else:
return STDOFFSET
def dst(self, dt):
Reported by Pylint.
Line: 40
Column: 9
return STDOFFSET
def dst(self, dt):
if self._isdst(dt):
return DSTDIFF
else:
return ZERO
def tzname(self, dt):
Reported by Pylint.
Line: 48
Column: 5
def tzname(self, dt):
return _time.tzname[self._isdst(dt)]
def _isdst(self, dt):
tt = (dt.year, dt.month, dt.day,
dt.hour, dt.minute, dt.second,
dt.weekday(), 0, 0)
stamp = _time.mktime(tt)
tt = _time.localtime(stamp)
Reported by Pylint.
Line: 48
Column: 5
def tzname(self, dt):
return _time.tzname[self._isdst(dt)]
def _isdst(self, dt):
tt = (dt.year, dt.month, dt.day,
dt.hour, dt.minute, dt.second,
dt.weekday(), 0, 0)
stamp = _time.mktime(tt)
tt = _time.localtime(stamp)
Reported by Pylint.
Line: 49
Column: 9
return _time.tzname[self._isdst(dt)]
def _isdst(self, dt):
tt = (dt.year, dt.month, dt.day,
dt.hour, dt.minute, dt.second,
dt.weekday(), 0, 0)
stamp = _time.mktime(tt)
tt = _time.localtime(stamp)
return tt.tm_isdst > 0
Reported by Pylint.
Line: 53
Column: 9
dt.hour, dt.minute, dt.second,
dt.weekday(), 0, 0)
stamp = _time.mktime(tt)
tt = _time.localtime(stamp)
return tt.tm_isdst > 0
Local = LocalTimezone()
Reported by Pylint.
Lib/distutils/tests/test_msvccompiler.py
19 issues
Line: 23
Column: 29
# makes sure query_vcvarsall raises
# a DistutilsPlatformError if the compiler
# is not found
def _find_vcvarsall(plat_spec):
return None, None
old_find_vcvarsall = _msvccompiler._find_vcvarsall
_msvccompiler._find_vcvarsall = _find_vcvarsall
try:
Reported by Pylint.
Line: 26
Column: 30
def _find_vcvarsall(plat_spec):
return None, None
old_find_vcvarsall = _msvccompiler._find_vcvarsall
_msvccompiler._find_vcvarsall = _find_vcvarsall
try:
self.assertRaises(DistutilsPlatformError,
_msvccompiler._get_vc_env,
'wont find this version')
Reported by Pylint.
Line: 27
Column: 9
return None, None
old_find_vcvarsall = _msvccompiler._find_vcvarsall
_msvccompiler._find_vcvarsall = _find_vcvarsall
try:
self.assertRaises(DistutilsPlatformError,
_msvccompiler._get_vc_env,
'wont find this version')
finally:
Reported by Pylint.
Line: 30
Column: 31
_msvccompiler._find_vcvarsall = _find_vcvarsall
try:
self.assertRaises(DistutilsPlatformError,
_msvccompiler._get_vc_env,
'wont find this version')
finally:
_msvccompiler._find_vcvarsall = old_find_vcvarsall
def test_get_vc_env_unicode(self):
Reported by Pylint.
Line: 33
Column: 13
_msvccompiler._get_vc_env,
'wont find this version')
finally:
_msvccompiler._find_vcvarsall = old_find_vcvarsall
def test_get_vc_env_unicode(self):
import distutils._msvccompiler as _msvccompiler
test_var = 'ṰḖṤṪ┅ṼẨṜ'
Reported by Pylint.
Line: 45
Column: 19
old_distutils_use_sdk = os.environ.pop('DISTUTILS_USE_SDK', None)
os.environ[test_var] = test_value
try:
env = _msvccompiler._get_vc_env('x86')
self.assertIn(test_var.lower(), env)
self.assertEqual(test_value, env[test_var.lower()])
finally:
os.environ.pop(test_var)
if old_distutils_use_sdk:
Reported by Pylint.
Line: 58
Column: 25
# This function cannot be mocked, so pass it if we find VS 2017
# and mark it skipped if we do not.
version, path = _msvccompiler._find_vc2017()
if version:
self.assertGreaterEqual(version, 15)
self.assertTrue(os.path.isdir(path))
else:
raise unittest.SkipTest("VS 2017 is not installed")
Reported by Pylint.
Line: 70
Column: 25
# This function cannot be mocked, so pass it if we find VS 2015
# and mark it skipped if we do not.
version, path = _msvccompiler._find_vc2015()
if version:
self.assertGreaterEqual(version, 14)
self.assertTrue(os.path.isdir(path))
else:
raise unittest.SkipTest("VS 2015 is not installed")
Reported by Pylint.
Line: 15
Column: 1
"These tests are only for win32")
@unittest.skipUnless(SKIP_MESSAGE is None, SKIP_MESSAGE)
class msvccompilerTestCase(support.TempdirManager,
unittest.TestCase):
def test_no_compiler(self):
import distutils._msvccompiler as _msvccompiler
# makes sure query_vcvarsall raises
Reported by Pylint.
Line: 15
Column: 1
"These tests are only for win32")
@unittest.skipUnless(SKIP_MESSAGE is None, SKIP_MESSAGE)
class msvccompilerTestCase(support.TempdirManager,
unittest.TestCase):
def test_no_compiler(self):
import distutils._msvccompiler as _msvccompiler
# makes sure query_vcvarsall raises
Reported by Pylint.
Lib/importlib/simple.py
19 issues
Line: 10
Column: 1
import itertools
from typing import BinaryIO, List
from .abc import Traversable, TraversableResources
class SimpleReader(abc.ABC):
"""
The minimum, low-level interface required from a resource
Reported by Pylint.
Line: 69
Column: 5
def is_dir(self):
return False
def open(self, mode='r', *args, **kwargs):
stream = self.parent.reader.open_binary(self.name)
if 'b' not in mode:
stream = io.TextIOWrapper(*args, **kwargs)
return stream
Reported by Pylint.
Line: 49
Column: 5
"""
@property
def name(self):
return self.package.split('.')[-1]
class ResourceHandle(Traversable):
"""
Reported by Pylint.
Line: 63
Column: 5
self.parent = parent
self.name = name # type: ignore
def is_file(self):
return True
def is_dir(self):
return False
Reported by Pylint.
Line: 63
Column: 5
self.parent = parent
self.name = name # type: ignore
def is_file(self):
return True
def is_dir(self):
return False
Reported by Pylint.
Line: 66
Column: 5
def is_file(self):
return True
def is_dir(self):
return False
def open(self, mode='r', *args, **kwargs):
stream = self.parent.reader.open_binary(self.name)
if 'b' not in mode:
Reported by Pylint.
Line: 66
Column: 5
def is_file(self):
return True
def is_dir(self):
return False
def open(self, mode='r', *args, **kwargs):
stream = self.parent.reader.open_binary(self.name)
if 'b' not in mode:
Reported by Pylint.
Line: 69
Column: 5
def is_dir(self):
return False
def open(self, mode='r', *args, **kwargs):
stream = self.parent.reader.open_binary(self.name)
if 'b' not in mode:
stream = io.TextIOWrapper(*args, **kwargs)
return stream
Reported by Pylint.
Line: 75
Column: 5
stream = io.TextIOWrapper(*args, **kwargs)
return stream
def joinpath(self, name):
raise RuntimeError("Cannot traverse into a resource")
class ResourceContainer(Traversable):
"""
Reported by Pylint.
Line: 75
Column: 5
stream = io.TextIOWrapper(*args, **kwargs)
return stream
def joinpath(self, name):
raise RuntimeError("Cannot traverse into a resource")
class ResourceContainer(Traversable):
"""
Reported by Pylint.
Lib/lib2to3/fixes/fix_next.py
19 issues
Line: 9
Column: 1
# - "with" statement targets aren't checked
# Local imports
from ..pgen2 import token
from ..pygram import python_symbols as syms
from .. import fixer_base
from ..fixer_util import Name, Call, find_binding
bind_warning = "Calls to builtin next() possibly shadowed by global binding"
Reported by Pylint.
Line: 10
Column: 1
# Local imports
from ..pgen2 import token
from ..pygram import python_symbols as syms
from .. import fixer_base
from ..fixer_util import Name, Call, find_binding
bind_warning = "Calls to builtin next() possibly shadowed by global binding"
Reported by Pylint.
Line: 11
Column: 1
# Local imports
from ..pgen2 import token
from ..pygram import python_symbols as syms
from .. import fixer_base
from ..fixer_util import Name, Call, find_binding
bind_warning = "Calls to builtin next() possibly shadowed by global binding"
Reported by Pylint.
Line: 12
Column: 1
from ..pgen2 import token
from ..pygram import python_symbols as syms
from .. import fixer_base
from ..fixer_util import Name, Call, find_binding
bind_warning = "Calls to builtin next() possibly shadowed by global binding"
class FixNext(fixer_base.BaseFix):
Reported by Pylint.
Line: 42
Column: 13
n = find_binding('next', tree)
if n:
self.warning(n, bind_warning)
self.shadowed_next = True
else:
self.shadowed_next = False
def transform(self, node, results):
assert results
Reported by Pylint.
Line: 44
Column: 13
self.warning(n, bind_warning)
self.shadowed_next = True
else:
self.shadowed_next = False
def transform(self, node, results):
assert results
base = results.get("base")
Reported by Pylint.
Line: 75
Column: 13
attr.replace(Name("__next__"))
elif "global" in results:
self.warning(node, bind_warning)
self.shadowed_next = True
### The following functions help test if node is part of an assignment
### target.
Reported by Pylint.
Line: 14
Column: 1
from .. import fixer_base
from ..fixer_util import Name, Call, find_binding
bind_warning = "Calls to builtin next() possibly shadowed by global binding"
class FixNext(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
Reported by Pylint.
Line: 17
Column: 1
bind_warning = "Calls to builtin next() possibly shadowed by global binding"
class FixNext(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > >
|
power< head=any+ trailer< '.' attr='next' > not trailer< '(' ')' > >
Reported by Pylint.
Line: 36
Column: 5
order = "pre" # Pre-order tree traversal
def start_tree(self, tree, filename):
super(FixNext, self).start_tree(tree, filename)
n = find_binding('next', tree)
if n:
self.warning(n, bind_warning)
Reported by Pylint.
Lib/curses/textpad.py
19 issues
Line: 200
Column: 5
stdscr.refresh()
return Textbox(win).edit()
str = curses.wrapper(test_editbox)
print('Contents of text box:', repr(str))
Reported by Pylint.
Line: 56
Column: 5
self.maxy = maxy - 1
self.maxx = maxx - 1
def _end_of_line(self, y):
"""Go to the location of the first blank on the given line,
returning the index of the last non-blank character."""
self._update_max_yx()
last = self.maxx
while True:
Reported by Pylint.
Line: 62
Column: 13
self._update_max_yx()
last = self.maxx
while True:
if curses.ascii.ascii(self.win.inch(y, last)) != curses.ascii.SP:
last = min(self.maxx, last+1)
break
elif last == 0:
break
last = last - 1
Reported by Pylint.
Line: 70
Column: 5
last = last - 1
return last
def _insert_printable_char(self, ch):
self._update_max_yx()
(y, x) = self.win.getyx()
backyx = None
while y < self.maxy or x < self.maxx:
if self.insert_mode:
Reported by Pylint.
Line: 72
Column: 13
def _insert_printable_char(self, ch):
self._update_max_yx()
(y, x) = self.win.getyx()
backyx = None
while y < self.maxy or x < self.maxx:
if self.insert_mode:
oldch = self.win.inch()
# The try-catch ignores the error we trigger from some curses
Reported by Pylint.
Line: 72
Column: 10
def _insert_printable_char(self, ch):
self._update_max_yx()
(y, x) = self.win.getyx()
backyx = None
while y < self.maxy or x < self.maxx:
if self.insert_mode:
oldch = self.win.inch()
# The try-catch ignores the error we trigger from some curses
Reported by Pylint.
Line: 87
Column: 17
if not self.insert_mode or not curses.ascii.isprint(oldch):
break
ch = oldch
(y, x) = self.win.getyx()
# Remember where to put the cursor back since we are in insert_mode
if backyx is None:
backyx = y, x
if backyx is not None:
Reported by Pylint.
Line: 87
Column: 14
if not self.insert_mode or not curses.ascii.isprint(oldch):
break
ch = oldch
(y, x) = self.win.getyx()
# Remember where to put the cursor back since we are in insert_mode
if backyx is None:
backyx = y, x
if backyx is not None:
Reported by Pylint.
Line: 95
Column: 5
if backyx is not None:
self.win.move(*backyx)
def do_command(self, ch):
"Process a single editing command."
self._update_max_yx()
(y, x) = self.win.getyx()
self.lastcmd = ch
if curses.ascii.isprint(ch):
Reported by Pylint.
Line: 95
Column: 5
if backyx is not None:
self.win.move(*backyx)
def do_command(self, ch):
"Process a single editing command."
self._update_max_yx()
(y, x) = self.win.getyx()
self.lastcmd = ch
if curses.ascii.isprint(ch):
Reported by Pylint.
Lib/idlelib/help.py
19 issues
Line: 42
Column: 1
## IDLE Help ##
class HelpParser(HTMLParser):
"""Render help.html into a text widget.
The overridden handle_xyz methods handle a subset of html tags.
The supplied text should have the needed tag configurations.
The behavior for unsupported tags, such as table, is undefined.
Reported by Pylint.
Line: 72
Column: 5
self.level += amt
self.tags = '' if self.level == 0 else 'l'+str(self.level)
def handle_starttag(self, tag, attrs):
"Handle starttags in help.html."
class_ = ''
for a, v in attrs:
if a == 'class':
class_ = v
Reported by Pylint.
Line: 72
Column: 5
self.level += amt
self.tags = '' if self.level == 0 else 'l'+str(self.level)
def handle_starttag(self, tag, attrs):
"Handle starttags in help.html."
class_ = ''
for a, v in attrs:
if a == 'class':
class_ = v
Reported by Pylint.
Line: 75
Column: 16
def handle_starttag(self, tag, attrs):
"Handle starttags in help.html."
class_ = ''
for a, v in attrs:
if a == 'class':
class_ = v
s = ''
if tag == 'div' and class_ == 'section':
self.show = True # Start main content.
Reported by Pylint.
Line: 75
Column: 13
def handle_starttag(self, tag, attrs):
"Handle starttags in help.html."
class_ = ''
for a, v in attrs:
if a == 'class':
class_ = v
s = ''
if tag == 'div' and class_ == 'section':
self.show = True # Start main content.
Reported by Pylint.
Line: 78
Column: 9
for a, v in attrs:
if a == 'class':
class_ = v
s = ''
if tag == 'div' and class_ == 'section':
self.show = True # Start main content.
elif tag == 'div' and class_ == 'sphinxsidebar':
self.show = False # End main content.
elif tag == 'p' and self.prevtag and not self.prevtag[0]:
Reported by Pylint.
Line: 87
Column: 13
# Begin a new block for <p> tags after a closed tag.
# Avoid extra lines, e.g. after <pre> tags.
lastline = self.text.get('end-1c linestart', 'end-1c')
s = '\n\n' if lastline and not lastline.isspace() else '\n'
elif tag == 'span' and class_ == 'pre':
self.chartags = 'pre'
elif tag == 'span' and class_ == 'versionmodified':
self.chartags = 'em'
elif tag == 'em':
Reported by Pylint.
Line: 96
Column: 17
self.chartags = 'em'
elif tag in ['ul', 'ol']:
if class_.find('simple') != -1:
s = '\n'
self.simplelist = True
else:
self.simplelist = False
self.indent()
elif tag == 'dl':
Reported by Pylint.
Line: 105
Column: 13
if self.level > 0:
self.nested_dl = True
elif tag == 'li':
s = '\n* ' if self.simplelist else '\n\n* '
elif tag == 'dt':
s = '\n\n' if not self.nested_dl else '\n' # Avoid extra line.
self.nested_dl = False
elif tag == 'dd':
self.indent()
Reported by Pylint.
Line: 107
Column: 13
elif tag == 'li':
s = '\n* ' if self.simplelist else '\n\n* '
elif tag == 'dt':
s = '\n\n' if not self.nested_dl else '\n' # Avoid extra line.
self.nested_dl = False
elif tag == 'dd':
self.indent()
s = '\n'
elif tag == 'pre':
Reported by Pylint.
Lib/asyncio/transports.py
19 issues
Line: 142
Column: 1
raise NotImplementedError
class Transport(ReadTransport, WriteTransport):
"""Interface representing a bidirectional transport.
There may be several implementations, but typically, the user does
not implement new transports; rather, the platform provides some
useful transports that are implemented using the platform's best
Reported by Pylint.
Line: 142
Column: 1
raise NotImplementedError
class Transport(ReadTransport, WriteTransport):
"""Interface representing a bidirectional transport.
There may be several implementations, but typically, the user does
not implement new transports; rather, the platform provides some
useful transports that are implemented using the platform's best
Reported by Pylint.
Line: 142
Column: 1
raise NotImplementedError
class Transport(ReadTransport, WriteTransport):
"""Interface representing a bidirectional transport.
There may be several implementations, but typically, the user does
not implement new transports; rather, the platform provides some
useful transports that are implemented using the platform's best
Reported by Pylint.
Line: 142
Column: 1
raise NotImplementedError
class Transport(ReadTransport, WriteTransport):
"""Interface representing a bidirectional transport.
There may be several implementations, but typically, the user does
not implement new transports; rather, the platform provides some
useful transports that are implemented using the platform's best
Reported by Pylint.
Line: 142
Column: 1
raise NotImplementedError
class Transport(ReadTransport, WriteTransport):
"""Interface representing a bidirectional transport.
There may be several implementations, but typically, the user does
not implement new transports; rather, the platform provides some
useful transports that are implemented using the platform's best
Reported by Pylint.
Line: 142
Column: 1
raise NotImplementedError
class Transport(ReadTransport, WriteTransport):
"""Interface representing a bidirectional transport.
There may be several implementations, but typically, the user does
not implement new transports; rather, the platform provides some
useful transports that are implemented using the platform's best
Reported by Pylint.
Line: 142
Column: 1
raise NotImplementedError
class Transport(ReadTransport, WriteTransport):
"""Interface representing a bidirectional transport.
There may be several implementations, but typically, the user does
not implement new transports; rather, the platform provides some
useful transports that are implemented using the platform's best
Reported by Pylint.
Line: 142
Column: 1
raise NotImplementedError
class Transport(ReadTransport, WriteTransport):
"""Interface representing a bidirectional transport.
There may be several implementations, but typically, the user does
not implement new transports; rather, the platform provides some
useful transports that are implemented using the platform's best
Reported by Pylint.
Line: 142
Column: 1
raise NotImplementedError
class Transport(ReadTransport, WriteTransport):
"""Interface representing a bidirectional transport.
There may be several implementations, but typically, the user does
not implement new transports; rather, the platform provides some
useful transports that are implemented using the platform's best
Reported by Pylint.
Line: 142
Column: 1
raise NotImplementedError
class Transport(ReadTransport, WriteTransport):
"""Interface representing a bidirectional transport.
There may be several implementations, but typically, the user does
not implement new transports; rather, the platform provides some
useful transports that are implemented using the platform's best
Reported by Pylint.
Lib/hmac.py
19 issues
Line: 14
Column: 22
_functype = None
from _operator import _compare_digest as compare_digest
else:
compare_digest = _hashopenssl.compare_digest
_functype = type(_hashopenssl.openssl_sha256) # builtin type
import hashlib as _hashlib
trans_5C = bytes((x ^ 0x5C) for x in range(256))
Reported by Pylint.
Line: 61
Column: 20
if _hashopenssl and isinstance(digestmod, (str, _functype)):
try:
self._init_hmac(key, msg, digestmod)
except _hashopenssl.UnsupportedDigestmodError:
self._init_old(key, msg, digestmod)
else:
self._init_old(key, msg, digestmod)
def _init_hmac(self, key, msg, digestmod):
Reported by Pylint.
Line: 67
Column: 22
self._init_old(key, msg, digestmod)
def _init_hmac(self, key, msg, digestmod):
self._hmac = _hashopenssl.hmac_new(key, msg, digestmod=digestmod)
self.digest_size = self._hmac.digest_size
self.block_size = self._hmac.block_size
def _init_old(self, key, msg, digestmod):
if callable(digestmod):
Reported by Pylint.
Line: 199
Column: 16
if _hashopenssl is not None and isinstance(digest, (str, _functype)):
try:
return _hashopenssl.hmac_digest(key, msg, digest)
except _hashopenssl.UnsupportedDigestmodError:
pass
if callable(digest):
digest_cons = digest
elif isinstance(digest, str):
Reported by Pylint.
Line: 12
Column: 5
except ImportError:
_hashopenssl = None
_functype = None
from _operator import _compare_digest as compare_digest
else:
compare_digest = _hashopenssl.compare_digest
_functype = type(_hashopenssl.openssl_sha256) # builtin type
import hashlib as _hashlib
Reported by Pylint.
Line: 131
Column: 13
other = self.__class__.__new__(self.__class__)
other.digest_size = self.digest_size
if self._hmac:
other._hmac = self._hmac.copy()
other._inner = other._outer = None
else:
other._hmac = None
other._inner = self._inner.copy()
other._outer = self._outer.copy()
Reported by Pylint.
Line: 132
Column: 13
other.digest_size = self.digest_size
if self._hmac:
other._hmac = self._hmac.copy()
other._inner = other._outer = None
else:
other._hmac = None
other._inner = self._inner.copy()
other._outer = self._outer.copy()
return other
Reported by Pylint.
Line: 134
Column: 13
other._hmac = self._hmac.copy()
other._inner = other._outer = None
else:
other._hmac = None
other._inner = self._inner.copy()
other._outer = self._outer.copy()
return other
def _current(self):
Reported by Pylint.
Line: 135
Column: 13
other._inner = other._outer = None
else:
other._hmac = None
other._inner = self._inner.copy()
other._outer = self._outer.copy()
return other
def _current(self):
"""Return a hash object for the current state.
Reported by Pylint.
Line: 136
Column: 13
else:
other._hmac = None
other._inner = self._inner.copy()
other._outer = self._outer.copy()
return other
def _current(self):
"""Return a hash object for the current state.
Reported by Pylint.
Lib/ctypes/_aix.py
19 issues
Line: 261
Column: 13
for (_, lines) in objects:
for line in lines:
# the second (optional) argument is PATH if it includes a /
path = line.split()[1]
if "/" in path:
libpaths.extend(path.split(":"))
return libpaths
def find_shared(paths, name):
Reported by Pylint.
Line: 274
Column: 9
return the result of get_member().
If an archive is not found then return None
"""
for dir in paths:
# /lib is a symbolic link to /usr/lib, skip it
if dir == "/lib":
continue
# "lib" is prefixed to emulate compiler name resolution,
# e.g., -lc to libc
Reported by Pylint.
Line: 323
Column: 9
# to a versioned file
# This is common practice by GNU libtool on other platforms
soname = f"lib{name}.so"
for dir in libpaths:
# /lib is a symbolic link to /usr/lib, skip it
if dir == "/lib":
continue
shlib = path.join(dir, soname)
if path.exists(shlib):
Reported by Pylint.
Line: 53
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
from os import environ, path
from sys import executable
from ctypes import c_void_p, sizeof
from subprocess import Popen, PIPE, DEVNULL
# Executable bit size - 32 or 64
# Used to filter the search in an archive by size, e.g., -X64
AIX_ABI = sizeof(c_void_p) * 8
Reported by Bandit.
Line: 60
Column: 1
AIX_ABI = sizeof(c_void_p) * 8
from sys import maxsize
def _last_version(libnames, sep):
def _num_version(libname):
# "libxyz.so.MAJOR.MINOR" => [MAJOR, MINOR]
parts = libname.split(sep)
nums = []
Reported by Pylint.
Line: 60
Column: 1
AIX_ABI = sizeof(c_void_p) * 8
from sys import maxsize
def _last_version(libnames, sep):
def _num_version(libname):
# "libxyz.so.MAJOR.MINOR" => [MAJOR, MINOR]
parts = libname.split(sep)
nums = []
Reported by Pylint.
Line: 74
Column: 1
return nums or [maxsize]
return max(reversed(libnames), key=_num_version)
def get_ld_header(p):
# "nested-function, but placed at module level
ld_header = None
for line in p.stdout:
if line.startswith(('/', './', '../')):
ld_header = line
Reported by Pylint.
Line: 74
Column: 1
return nums or [maxsize]
return max(reversed(libnames), key=_num_version)
def get_ld_header(p):
# "nested-function, but placed at module level
ld_header = None
for line in p.stdout:
if line.startswith(('/', './', '../')):
ld_header = line
Reported by Pylint.
Line: 84
Column: 1
return ld_header.rstrip('\n')
return None
def get_ld_header_info(p):
# "nested-function, but placed at module level
# as an ld_header was found, return known paths, archives and members
# these lines start with a digit
info = []
for line in p.stdout:
Reported by Pylint.
Line: 84
Column: 1
return ld_header.rstrip('\n')
return None
def get_ld_header_info(p):
# "nested-function, but placed at module level
# as an ld_header was found, return known paths, archives and members
# these lines start with a digit
info = []
for line in p.stdout:
Reported by Pylint.