The following issues were found
Lib/test/make_ssl_certs.py
81 issues
Line: 8
Column: 1
import pprint
import shutil
import tempfile
from subprocess import *
startdate = "20180829142316Z"
enddate = "20371028142316Z"
req_template = """
Reported by Pylint.
Line: 8
Column: 1
import pprint
import shutil
import tempfile
from subprocess import *
startdate = "20180829142316Z"
enddate = "20371028142316Z"
req_template = """
Reported by Pylint.
Line: 8
Column: 1
import pprint
import shutil
import tempfile
from subprocess import *
startdate = "20180829142316Z"
enddate = "20371028142316Z"
req_template = """
Reported by Pylint.
Line: 8
Column: 1
import pprint
import shutil
import tempfile
from subprocess import *
startdate = "20180829142316Z"
enddate = "20371028142316Z"
req_template = """
Reported by Pylint.
Line: 8
Column: 1
import pprint
import shutil
import tempfile
from subprocess import *
startdate = "20180829142316Z"
enddate = "20371028142316Z"
req_template = """
Reported by Pylint.
Line: 8
Column: 1
import pprint
import shutil
import tempfile
from subprocess import *
startdate = "20180829142316Z"
enddate = "20371028142316Z"
req_template = """
Reported by Pylint.
Line: 8
Column: 1
import pprint
import shutil
import tempfile
from subprocess import *
startdate = "20180829142316Z"
enddate = "20371028142316Z"
req_template = """
Reported by Pylint.
Line: 8
Column: 1
import pprint
import shutil
import tempfile
from subprocess import *
startdate = "20180829142316Z"
enddate = "20371028142316Z"
req_template = """
Reported by Pylint.
Line: 8
Column: 1
import pprint
import shutil
import tempfile
from subprocess import *
startdate = "20180829142316Z"
enddate = "20371028142316Z"
req_template = """
Reported by Pylint.
Line: 8
Column: 1
import pprint
import shutil
import tempfile
from subprocess import *
startdate = "20180829142316Z"
enddate = "20371028142316Z"
req_template = """
Reported by Pylint.
Lib/ntpath.py
81 issues
Line: 584
Column: 20
break
path = normpath(join(dirname(old_path), path))
except OSError as ex:
if ex.winerror in allowed_winerror:
break
raise
except ValueError:
# Stop on reparse points that are not symlinks
break
Reported by Pylint.
Line: 617
Column: 20
path = _getfinalpathname(path)
return join(path, tail) if tail else path
except OSError as ex:
if ex.winerror not in allowed_winerror:
raise
try:
# The OS could not resolve this path fully, so we attempt
# to follow the link ourselves. If we succeed, join the tail
# and return.
Reported by Pylint.
Line: 665
Column: 32
except OSError as ex:
if strict:
raise
initial_winerror = ex.winerror
path = _getfinalpathname_nonstrict(path)
# The path returned by _getfinalpathname will always start with \\?\ -
# strip off that prefix unless it was already provided on the original
# path.
if not had_prefix and path.startswith(prefix):
Reported by Pylint.
Line: 684
Column: 20
except OSError as ex:
# If the path does not exist and originally did not exist, then
# strip the prefix anyway.
if ex.winerror == initial_winerror:
path = spath
return path
# Win9x family and earlier have no Unicode filename support.
Reported by Pylint.
Line: 691
Column: 31
# Win9x family and earlier have no Unicode filename support.
supports_unicode_filenames = (hasattr(sys, "getwindowsversion") and
sys.getwindowsversion()[3] >= 2)
def relpath(path, start=None):
"""Return a relative version of a path"""
path = os.fspath(path)
if isinstance(path, bytes):
Reported by Pylint.
Line: 24
Column: 1
import sys
import stat
import genericpath
from genericpath import *
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
"basename","dirname","commonprefix","getsize","getmtime",
"getatime","getctime", "islink","exists","lexists","isdir","isfile",
"ismount", "expanduser","expandvars","normpath","abspath",
Reported by Pylint.
Line: 80
Column: 9
def join(path, *paths):
path = os.fspath(path)
if isinstance(path, bytes):
sep = b'\\'
seps = b'\\/'
colon = b':'
else:
sep = '\\'
seps = '\\/'
Reported by Pylint.
Line: 89
Column: 13
colon = ':'
try:
if not paths:
path[:0] + sep #23780: Ensure compatible data type even if p is null.
result_drive, result_path = splitdrive(path)
for p in map(os.fspath, paths):
p_drive, p_path = splitdrive(p)
if p_path and p_path[0] in seps:
# Second path is absolute
Reported by Pylint.
Line: 117
Column: 9
return result_drive + sep + result_path
return result_drive + result_path
except (TypeError, AttributeError, BytesWarning):
genericpath._check_arg_types('join', path, *paths)
raise
# Split a path in a drive specification (a drive letter followed by a
# colon) and the path specification.
Reported by Pylint.
Line: 146
Column: 13
p = os.fspath(p)
if len(p) >= 2:
if isinstance(p, bytes):
sep = b'\\'
altsep = b'/'
colon = b':'
else:
sep = '\\'
altsep = '/'
Reported by Pylint.
Lib/test/test_telnetlib.py
81 issues
Line: 3
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b401-import-telnetlib
import socket
import selectors
import telnetlib
import threading
import contextlib
from test import support
from test.support import socket_helper
import unittest
Reported by Bandit.
Line: 42
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b312-telnetlib
def testBasic(self):
# connects
telnet = telnetlib.Telnet(HOST, self.port)
telnet.sock.close()
def testContextManager(self):
with telnetlib.Telnet(HOST, self.port) as tn:
self.assertIsNotNone(tn.get_socket())
Reported by Bandit.
Line: 46
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b312-telnetlib
telnet.sock.close()
def testContextManager(self):
with telnetlib.Telnet(HOST, self.port) as tn:
self.assertIsNotNone(tn.get_socket())
self.assertIsNone(tn.get_socket())
def testTimeoutDefault(self):
self.assertTrue(socket.getdefaulttimeout() is None)
Reported by Bandit.
Line: 54
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b312-telnetlib
self.assertTrue(socket.getdefaulttimeout() is None)
socket.setdefaulttimeout(30)
try:
telnet = telnetlib.Telnet(HOST, self.port)
finally:
socket.setdefaulttimeout(None)
self.assertEqual(telnet.sock.gettimeout(), 30)
telnet.sock.close()
Reported by Bandit.
Line: 65
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b312-telnetlib
self.assertTrue(socket.getdefaulttimeout() is None)
socket.setdefaulttimeout(30)
try:
telnet = telnetlib.Telnet(HOST, self.port, timeout=None)
finally:
socket.setdefaulttimeout(None)
self.assertTrue(telnet.sock.gettimeout() is None)
telnet.sock.close()
Reported by Bandit.
Line: 72
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b312-telnetlib
telnet.sock.close()
def testTimeoutValue(self):
telnet = telnetlib.Telnet(HOST, self.port, timeout=30)
self.assertEqual(telnet.sock.gettimeout(), 30)
telnet.sock.close()
def testTimeoutOpen(self):
telnet = telnetlib.Telnet()
Reported by Bandit.
Line: 77
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b312-telnetlib
telnet.sock.close()
def testTimeoutOpen(self):
telnet = telnetlib.Telnet()
telnet.open(HOST, self.port, timeout=30)
self.assertEqual(telnet.sock.gettimeout(), 30)
telnet.sock.close()
def testGetters(self):
Reported by Bandit.
Line: 84
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b312-telnetlib
def testGetters(self):
# Test telnet getter methods
telnet = telnetlib.Telnet(HOST, self.port, timeout=30)
t_sock = telnet.sock
self.assertEqual(telnet.get_socket(), t_sock)
self.assertEqual(telnet.fileno(), t_sock.fileno())
telnet.sock.close()
Reported by Bandit.
Line: 115
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b312-telnetlib
return (not self.sock.block)
def msg(self, msg, *args):
with support.captured_stdout() as out:
telnetlib.Telnet.msg(self, msg, *args)
self._messages += out.getvalue()
return
class MockSelector(selectors.BaseSelector):
Reported by Bandit.
Line: 17
Column: 15
serv.listen()
evt.set()
try:
conn, addr = serv.accept()
conn.close()
except TimeoutError:
pass
finally:
serv.close()
Reported by Pylint.
Tools/msi/purge.py
80 issues
Line: 13
Column: 1
import re
import sys
from urllib.request import *
VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)([A-Za-z_]+\d+)?$')
try:
m = VERSION_RE.match(sys.argv[1])
Reported by Pylint.
Line: 13
Column: 1
import re
import sys
from urllib.request import *
VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)([A-Za-z_]+\d+)?$')
try:
m = VERSION_RE.match(sys.argv[1])
Reported by Pylint.
Line: 13
Column: 1
import re
import sys
from urllib.request import *
VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)([A-Za-z_]+\d+)?$')
try:
m = VERSION_RE.match(sys.argv[1])
Reported by Pylint.
Line: 13
Column: 1
import re
import sys
from urllib.request import *
VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)([A-Za-z_]+\d+)?$')
try:
m = VERSION_RE.match(sys.argv[1])
Reported by Pylint.
Line: 13
Column: 1
import re
import sys
from urllib.request import *
VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)([A-Za-z_]+\d+)?$')
try:
m = VERSION_RE.match(sys.argv[1])
Reported by Pylint.
Line: 13
Column: 1
import re
import sys
from urllib.request import *
VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)([A-Za-z_]+\d+)?$')
try:
m = VERSION_RE.match(sys.argv[1])
Reported by Pylint.
Line: 13
Column: 1
import re
import sys
from urllib.request import *
VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)([A-Za-z_]+\d+)?$')
try:
m = VERSION_RE.match(sys.argv[1])
Reported by Pylint.
Line: 13
Column: 1
import re
import sys
from urllib.request import *
VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)([A-Za-z_]+\d+)?$')
try:
m = VERSION_RE.match(sys.argv[1])
Reported by Pylint.
Line: 13
Column: 1
import re
import sys
from urllib.request import *
VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)([A-Za-z_]+\d+)?$')
try:
m = VERSION_RE.match(sys.argv[1])
Reported by Pylint.
Line: 13
Column: 1
import re
import sys
from urllib.request import *
VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)([A-Za-z_]+\d+)?$')
try:
m = VERSION_RE.match(sys.argv[1])
Reported by Pylint.
Lib/tempfile.py
80 issues
Line: 58
Column: 23
_bin_openflags = _text_openflags
if hasattr(_os, 'O_BINARY'):
_bin_openflags |= _os.O_BINARY
if hasattr(_os, 'TMP_MAX'):
TMP_MAX = _os.TMP_MAX
else:
TMP_MAX = 10000
Reported by Pylint.
Line: 548
Column: 18
# Setting O_TEMPORARY in the flags causes the OS to delete
# the file when it is closed. This is only supported by Windows.
if _os.name == 'nt' and delete:
flags |= _os.O_TEMPORARY
if "b" not in mode:
encoding = _io.text_encoding(encoding)
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
Reported by Pylint.
Line: 830
Column: 21
pass
else:
if not ignore_errors:
raise
_shutil.rmtree(name, onerror=onerror)
@classmethod
def _cleanup(cls, name, warn_message, ignore_errors=False):
Reported by Pylint.
Line: 110
Column: 38
return return_type
def _sanitize_params(prefix, suffix, dir):
"""Common parameter processing for most APIs in this module."""
output_type = _infer_return_type(prefix, suffix, dir)
if suffix is None:
suffix = output_type()
if prefix is None:
Reported by Pylint.
Line: 142
Column: 13
def rng(self):
cur_pid = _os.getpid()
if cur_pid != getattr(self, '_rng_pid', None):
self._rng = _Random()
self._rng_pid = cur_pid
return self._rng
def __iter__(self):
return self
Reported by Pylint.
Line: 143
Column: 13
cur_pid = _os.getpid()
if cur_pid != getattr(self, '_rng_pid', None):
self._rng = _Random()
self._rng_pid = cur_pid
return self._rng
def __iter__(self):
return self
Reported by Pylint.
Line: 169
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b108_hardcoded_tmp_directory.html
_os.path.expandvars(r'%SYSTEMROOT%\Temp'),
r'c:\temp', r'c:\tmp', r'\temp', r'\tmp' ])
else:
dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp' ])
# As a last resort, the current directory.
try:
dirlist.append(_os.getcwd())
except (AttributeError, OSError):
Reported by Bandit.
Line: 169
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b108_hardcoded_tmp_directory.html
_os.path.expandvars(r'%SYSTEMROOT%\Temp'),
r'c:\temp', r'c:\tmp', r'\temp', r'\tmp' ])
else:
dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp' ])
# As a last resort, the current directory.
try:
dirlist.append(_os.getcwd())
except (AttributeError, OSError):
Reported by Bandit.
Line: 191
Column: 9
namer = _RandomNameSequence()
dirlist = _candidate_tempdir_list()
for dir in dirlist:
if dir != _os.curdir:
dir = _os.path.abspath(dir)
# Try only a few names per directory.
for seq in range(100):
name = next(namer)
Reported by Pylint.
Line: 195
Column: 13
if dir != _os.curdir:
dir = _os.path.abspath(dir)
# Try only a few names per directory.
for seq in range(100):
name = next(namer)
filename = _os.path.join(dir, name)
try:
fd = _os.open(filename, _bin_openflags, 0o600)
try:
Reported by Pylint.
Lib/ctypes/test/test_repr.py
80 issues
Line: 12
Column: 1
pass
subclasses.append(X)
class X(c_char):
pass
# This test checks if the __repr__ is correct for subclasses of simple types
class ReprTest(unittest.TestCase):
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
subclasses = []
for base in [c_byte, c_short, c_int, c_long, c_longlong,
c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong,
c_float, c_double, c_longdouble, c_bool]:
class X(base):
pass
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
subclasses = []
for base in [c_byte, c_short, c_int, c_long, c_longlong,
c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong,
c_float, c_double, c_longdouble, c_bool]:
class X(base):
pass
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
subclasses = []
for base in [c_byte, c_short, c_int, c_long, c_longlong,
c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong,
c_float, c_double, c_longdouble, c_bool]:
class X(base):
pass
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
subclasses = []
for base in [c_byte, c_short, c_int, c_long, c_longlong,
c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong,
c_float, c_double, c_longdouble, c_bool]:
class X(base):
pass
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
subclasses = []
for base in [c_byte, c_short, c_int, c_long, c_longlong,
c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong,
c_float, c_double, c_longdouble, c_bool]:
class X(base):
pass
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
subclasses = []
for base in [c_byte, c_short, c_int, c_long, c_longlong,
c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong,
c_float, c_double, c_longdouble, c_bool]:
class X(base):
pass
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
subclasses = []
for base in [c_byte, c_short, c_int, c_long, c_longlong,
c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong,
c_float, c_double, c_longdouble, c_bool]:
class X(base):
pass
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
subclasses = []
for base in [c_byte, c_short, c_int, c_long, c_longlong,
c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong,
c_float, c_double, c_longdouble, c_bool]:
class X(base):
pass
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
subclasses = []
for base in [c_byte, c_short, c_int, c_long, c_longlong,
c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong,
c_float, c_double, c_longdouble, c_bool]:
class X(base):
pass
Reported by Pylint.
Lib/sqlite3/dbapi2.py
80 issues
Line: 89
Column: 1
# bpo-24464: enable_shared_cache was deprecated in Python 3.10. It's
# scheduled for removal in Python 3.12.
def enable_shared_cache(enable):
from _sqlite3 import enable_shared_cache as _old_enable_shared_cache
import warnings
msg = (
"enable_shared_cache is deprecated and will be removed in Python 3.12. "
"Shared cache is strongly discouraged by the SQLite 3 documentation. "
Reported by Pylint.
Line: 27
Column: 1
import time
import collections.abc
from _sqlite3 import *
paramstyle = "qmark"
threadsafety = 1
Reported by Pylint.
Line: 27
Column: 1
import time
import collections.abc
from _sqlite3 import *
paramstyle = "qmark"
threadsafety = 1
Reported by Pylint.
Line: 27
Column: 1
import time
import collections.abc
from _sqlite3 import *
paramstyle = "qmark"
threadsafety = 1
Reported by Pylint.
Line: 27
Column: 1
import time
import collections.abc
from _sqlite3 import *
paramstyle = "qmark"
threadsafety = 1
Reported by Pylint.
Line: 27
Column: 1
import time
import collections.abc
from _sqlite3 import *
paramstyle = "qmark"
threadsafety = 1
Reported by Pylint.
Line: 27
Column: 1
import time
import collections.abc
from _sqlite3 import *
paramstyle = "qmark"
threadsafety = 1
Reported by Pylint.
Line: 27
Column: 1
import time
import collections.abc
from _sqlite3 import *
paramstyle = "qmark"
threadsafety = 1
Reported by Pylint.
Line: 27
Column: 1
import time
import collections.abc
from _sqlite3 import *
paramstyle = "qmark"
threadsafety = 1
Reported by Pylint.
Line: 27
Column: 1
import time
import collections.abc
from _sqlite3 import *
paramstyle = "qmark"
threadsafety = 1
Reported by Pylint.
Lib/test/test_unparse.py
80 issues
Line: 18
Column: 1
return stream.read()
for_else = """\
def f():
for x in range(10):
break
else:
y = 2
Reported by Pylint.
Line: 27
Column: 1
z = 3
"""
while_else = """\
def g():
while True:
break
else:
y = 2
Reported by Pylint.
Line: 36
Column: 1
z = 3
"""
relative_import = """\
from . import fred
from .. import barney
from .australia import shrimp as prawns
"""
Reported by Pylint.
Line: 42
Column: 1
from .australia import shrimp as prawns
"""
nonlocal_ex = """\
def f():
x = 1
def g():
nonlocal x
x = 2
Reported by Pylint.
Line: 54
Column: 1
"""
# also acts as test for 'except ... as ...'
raise_from = """\
try:
1 / 0
except ZeroDivisionError as e:
raise ArithmeticError from e
"""
Reported by Pylint.
Line: 61
Column: 1
raise ArithmeticError from e
"""
class_decorator = """\
@f1(arg)
@f2
class Foo: pass
"""
Reported by Pylint.
Line: 67
Column: 1
class Foo: pass
"""
elif1 = """\
if cond1:
suite1
elif cond2:
suite2
else:
Reported by Pylint.
Line: 76
Column: 1
suite3
"""
elif2 = """\
if cond1:
suite1
elif cond2:
suite2
"""
Reported by Pylint.
Line: 83
Column: 1
suite2
"""
try_except_finally = """\
try:
suite1
except ex1:
suite2
except ex2:
Reported by Pylint.
Line: 96
Column: 1
suite5
"""
with_simple = """\
with f():
suite1
"""
with_as = """\
Reported by Pylint.
Lib/idlelib/idle_test/test_run.py
80 issues
Line: 74
Column: 24
with self.subTest(codes=(code1,code2)):
try:
eval(compile(code1, '', 'eval'))
except exc1:
try:
eval(compile(code2, '', 'eval'))
except exc2:
with captured_stderr() as output:
run.print_exception()
Reported by Pylint.
Line: 74
Column: 24
with self.subTest(codes=(code1,code2)):
try:
eval(compile(code1, '', 'eval'))
except exc1:
try:
eval(compile(code2, '', 'eval'))
except exc2:
with captured_stderr() as output:
run.print_exception()
Reported by Pylint.
Line: 77
Column: 28
except exc1:
try:
eval(compile(code2, '', 'eval'))
except exc2:
with captured_stderr() as output:
run.print_exception()
actual = output.getvalue()
self.assertIn(msg1, actual)
self.assertIn(msg2, actual)
Reported by Pylint.
Line: 77
Column: 28
except exc1:
try:
eval(compile(code2, '', 'eval'))
except exc2:
with captured_stderr() as output:
run.print_exception()
actual = output.getvalue()
self.assertIn(msg1, actual)
self.assertIn(msg2, actual)
Reported by Pylint.
Line: 28
Column: 17
raise ex2 from ex1
except UnhashableException:
try:
raise ex1
except UnhashableException:
with captured_stderr() as output:
with mock.patch.object(run, 'cleanup_traceback') as ct:
ct.side_effect = lambda t, e: t
run.print_exception()
Reported by Pylint.
Line: 57
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b307-eval
for code, exc, msg in self.data:
with self.subTest(code=code):
try:
eval(compile(code, '', 'eval'))
except exc:
typ, val, tb = sys.exc_info()
actual = run.get_message_lines(typ, val, tb)[0]
expect = f'{exc.__name__}: {msg}'
self.assertEqual(actual, expect)
Reported by Bandit.
Line: 57
Column: 21
for code, exc, msg in self.data:
with self.subTest(code=code):
try:
eval(compile(code, '', 'eval'))
except exc:
typ, val, tb = sys.exc_info()
actual = run.get_message_lines(typ, val, tb)[0]
expect = f'{exc.__name__}: {msg}'
self.assertEqual(actual, expect)
Reported by Pylint.
Line: 66
Column: 41
@mock.patch.object(run, 'cleanup_traceback',
new_callable=lambda: (lambda t, e: None))
def test_get_multiple_message(self, mock):
d = self.data
data2 = ((d[0], d[1]), (d[1], d[2]), (d[2], d[0]))
subtests = 0
for (code1, exc1, msg1), (code2, exc2, msg2) in data2:
with self.subTest(codes=(code1,code2)):
Reported by Pylint.
Line: 66
Column: 41
@mock.patch.object(run, 'cleanup_traceback',
new_callable=lambda: (lambda t, e: None))
def test_get_multiple_message(self, mock):
d = self.data
data2 = ((d[0], d[1]), (d[1], d[2]), (d[2], d[0]))
subtests = 0
for (code1, exc1, msg1), (code2, exc2, msg2) in data2:
with self.subTest(codes=(code1,code2)):
Reported by Pylint.
Line: 73
Column: 21
for (code1, exc1, msg1), (code2, exc2, msg2) in data2:
with self.subTest(codes=(code1,code2)):
try:
eval(compile(code1, '', 'eval'))
except exc1:
try:
eval(compile(code2, '', 'eval'))
except exc2:
with captured_stderr() as output:
Reported by Pylint.
Lib/importlib/_bootstrap.py
80 issues
Line: 398
Column: 32
if self.origin is not None and self._set_fileattr:
if _bootstrap_external is None:
raise NotImplementedError
self._cached = _bootstrap_external._get_cached(self.origin)
return self._cached
@cached.setter
def cached(self, cached):
self._cached = cached
Reported by Pylint.
Line: 427
Column: 35
if hasattr(loader, 'get_filename'):
if _bootstrap_external is None:
raise NotImplementedError
spec_from_file_location = _bootstrap_external.spec_from_file_location
if is_package is None:
return spec_from_file_location(name, loader=loader)
search = [] if is_package else None
return spec_from_file_location(name, loader=loader,
Reported by Pylint.
Line: 510
Column: 36
if spec.submodule_search_locations is not None:
if _bootstrap_external is None:
raise NotImplementedError
_NamespaceLoader = _bootstrap_external._NamespaceLoader
loader = _NamespaceLoader.__new__(_NamespaceLoader)
loader._path = spec.submodule_search_locations
spec.loader = loader
# While the docs say that module.__file__ is not set for
Reported by Pylint.
Line: 1231
Column: 5
global _bootstrap_external
import _frozen_importlib_external
_bootstrap_external = _frozen_importlib_external
_frozen_importlib_external._install(sys.modules[__name__])
Reported by Pylint.
Line: 302
Column: 16
elif hasattr(loader, 'module_repr'):
try:
return loader.module_repr(module)
except Exception:
pass
# Fall through to a catch-all which always succeeds.
try:
name = module.__name__
except AttributeError:
Reported by Pylint.
Line: 398
Column: 32
if self.origin is not None and self._set_fileattr:
if _bootstrap_external is None:
raise NotImplementedError
self._cached = _bootstrap_external._get_cached(self.origin)
return self._cached
@cached.setter
def cached(self, cached):
self._cached = cached
Reported by Pylint.
Line: 472
Column: 26
if origin is None:
if location is None:
try:
origin = loader._ORIGIN
except AttributeError:
origin = None
else:
origin = location
try:
Reported by Pylint.
Line: 487
Column: 5
submodule_search_locations = None
spec = ModuleSpec(name, loader, origin=origin)
spec._set_fileattr = False if location is None else True
spec.cached = cached
spec.submodule_search_locations = submodule_search_locations
return spec
Reported by Pylint.
Line: 510
Column: 36
if spec.submodule_search_locations is not None:
if _bootstrap_external is None:
raise NotImplementedError
_NamespaceLoader = _bootstrap_external._NamespaceLoader
loader = _NamespaceLoader.__new__(_NamespaceLoader)
loader._path = spec.submodule_search_locations
spec.loader = loader
# While the docs say that module.__file__ is not set for
Reported by Pylint.
Line: 513
Column: 17
_NamespaceLoader = _bootstrap_external._NamespaceLoader
loader = _NamespaceLoader.__new__(_NamespaceLoader)
loader._path = spec.submodule_search_locations
spec.loader = loader
# While the docs say that module.__file__ is not set for
# built-in modules, and the code below will avoid setting it if
# spec.has_location is false, this is incorrect for namespace
# packages. Namespace packages have no location, but their
Reported by Pylint.