The following issues were found

Lib/importlib/_bootstrap.py
80 issues
Module '_frozen_importlib_external' has no '_get_cached' member
Error

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.

Module '_frozen_importlib_external' has no 'spec_from_file_location' member
Error

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.

Module '_frozen_importlib_external' has no '_NamespaceLoader' member
Error

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.

Module '_frozen_importlib_external' has no '_install' member
Error

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.

Catching too general exception Exception
Error

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.

Access to a protected member _get_cached of a client class
Error

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.

Access to a protected member _ORIGIN of a client class
Error

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.

Access to a protected member _set_fileattr of a client class
Error

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.

Access to a protected member _NamespaceLoader of a client class
Error

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.

Access to a protected member _path of a client class
Error

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.

Lib/idlelib/debugger_r.py
79 issues
Redefining name 'gui_adap_oid' from outer scope (line 29)
Error

Line: 59 Column: 30

              
class GUIProxy:

    def __init__(self, conn, gui_adap_oid):
        self.conn = conn
        self.oid = gui_adap_oid

    def interaction(self, message, frame, info=None):
        # calls rpc.SocketIO.remotecall() via run.MyHandler instance

            

Reported by Pylint.

Redefining built-in 'dict'
Error

Line: 128 Column: 9

              
    def frame_globals(self, fid):
        frame = frametable[fid]
        dict = frame.f_globals
        did = id(dict)
        dicttable[did] = dict
        return did

    def frame_locals(self, fid):

            

Reported by Pylint.

Redefining built-in 'dict'
Error

Line: 135 Column: 9

              
    def frame_locals(self, fid):
        frame = frametable[fid]
        dict = frame.f_locals
        did = id(dict)
        dicttable[did] = dict
        return did

    def frame_code(self, fid):

            

Reported by Pylint.

Redefining built-in 'dict'
Error

Line: 167 Column: 9

                  ### Needed until dict_keys is type is finished and pickealable.
    ### Will probably need to extend rpc.py:SocketIO._proxify at that time.
    def dict_keys_list(self, did):
        dict = dicttable[did]
        return list(dict.keys())

    def dict_item(self, did, key):
        dict = dicttable[did]
        value = dict[key]

            

Reported by Pylint.

Redefining built-in 'dict'
Error

Line: 171 Column: 9

                      return list(dict.keys())

    def dict_item(self, did, key):
        dict = dicttable[did]
        value = dict[key]
        value = reprlib.repr(value) ### can't pickle module 'builtins'
        return value

#----------end class IdbAdapter----------

            

Reported by Pylint.

Redefining name 'gui_adap_oid' from outer scope (line 29)
Error

Line: 179 Column: 32

              #----------end class IdbAdapter----------


def start_debugger(rpchandler, gui_adap_oid):
    """Start the debugger and its RPC link in the Python subprocess

    Start the subprocess side of the split debugger and set up that side of the
    RPC link by instantiating the GUIProxy, Idb debugger, and IdbAdapter
    objects and linking them together.  Register the IdbAdapter with the

            

Reported by Pylint.

Unused argument 'locals'
Error

Line: 308 Column: 24

                      ##print("*** IdbProxy.call %s returns %r" % (methodname, value))
        return value

    def run(self, cmd, locals):
        # Ignores locals on purpose!
        seq = self.conn.asyncqueue(self.oid, "run", (cmd,), {})
        self.shell.interp.active_seq = seq

    def get_stack(self, frame, tbid):

            

Reported by Pylint.

Redefining built-in 'locals'
Error

Line: 308 Column: 24

                      ##print("*** IdbProxy.call %s returns %r" % (methodname, value))
        return value

    def run(self, cmd, locals):
        # Ignores locals on purpose!
        seq = self.conn.asyncqueue(self.oid, "run", (cmd,), {})
        self.shell.interp.active_seq = seq

    def get_stack(self, frame, tbid):

            

Reported by Pylint.

Access to a protected member _fid of a client class
Error

Line: 315 Column: 43

              
    def get_stack(self, frame, tbid):
        # passing frame and traceback IDs, not the objects themselves
        stack, i = self.call("get_stack", frame._fid, tbid)
        stack = [(FrameProxy(self.conn, fid), k) for fid, k in stack]
        return stack, i

    def set_continue(self):
        self.call("set_continue")

            

Reported by Pylint.

Access to a protected member _fid of a client class
Error

Line: 326 Column: 31

                      self.call("set_step")

    def set_next(self, frame):
        self.call("set_next", frame._fid)

    def set_return(self, frame):
        self.call("set_return", frame._fid)

    def set_quit(self):

            

Reported by Pylint.

Lib/ftplib.py
79 issues
Instance of 'socket' has no 'unwrap' member
Error

Line: 444 Column: 17

                              callback(data)
            # shutdown ssl layer
            if _SSLSocket is not None and isinstance(conn, _SSLSocket):
                conn.unwrap()
        return self.voidresp()

    def retrlines(self, cmd, callback = None):
        """Retrieve data in line mode.  A new port is created for you.


            

Reported by Pylint.

Instance of 'socket' has no 'unwrap' member
Error

Line: 479 Column: 17

                              callback(line)
            # shutdown ssl layer
            if _SSLSocket is not None and isinstance(conn, _SSLSocket):
                conn.unwrap()
        return self.voidresp()

    def storbinary(self, cmd, fp, blocksize=8192, callback=None, rest=None):
        """Store a file in binary mode.  A new port is created for you.


            

Reported by Pylint.

Instance of 'socket' has no 'unwrap' member
Error

Line: 508 Column: 17

                                  callback(buf)
            # shutdown ssl layer
            if _SSLSocket is not None and isinstance(conn, _SSLSocket):
                conn.unwrap()
        return self.voidresp()

    def storlines(self, cmd, fp, callback=None):
        """Store a file in line mode.  A new port is created for you.


            

Reported by Pylint.

Instance of 'socket' has no 'unwrap' member
Error

Line: 539 Column: 17

                                  callback(buf)
            # shutdown ssl layer
            if _SSLSocket is not None and isinstance(conn, _SSLSocket):
                conn.unwrap()
        return self.voidresp()

    def acct(self, password):
        '''Send new account name.'''
        cmd = 'ACCT ' + password

            

Reported by Pylint.

Attribute 'lastresp' defined outside __init__
Error

Line: 247 Column: 9

                      resp = self.getmultiline()
        if self.debugging:
            print('*resp*', self.sanitize(resp))
        self.lastresp = resp[:3]
        c = resp[:1]
        if c in {'1', '2', '3'}:
            return resp
        if c == '4':
            raise error_temp(resp)

            

Reported by Pylint.

Redefining built-in 'bytes'
Error

Line: 294 Column: 9

                      '''
        hbytes = host.split('.')
        pbytes = [repr(port//256), repr(port%256)]
        bytes = hbytes + pbytes
        cmd = 'PORT ' + ','.join(bytes)
        return self.voidcmd(cmd)

    def sendeprt(self, host, port):
        '''Send an EPRT command with the current host and the given port number.'''

            

Reported by Pylint.

Unused variable 'resp'
Error

Line: 317 Column: 13

                      port = sock.getsockname()[1] # Get proper port
        host = self.sock.getsockname()[0] # Get proper host
        if self.af == socket.AF_INET:
            resp = self.sendport(host, port)
        else:
            resp = self.sendeprt(host, port)
        if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT:
            sock.settimeout(self.timeout)
        return sock

            

Reported by Pylint.

Unused variable 'sockaddr'
Error

Line: 383 Column: 23

                                  resp = self.getresp()
                if resp[0] != '1':
                    raise error_reply(resp)
                conn, sockaddr = sock.accept()
                if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT:
                    conn.settimeout(self.timeout)
        if resp[:3] == '150':
            # this is conditional in case we received a 125
            size = parse150(resp)

            

Reported by Pylint.

Unused variable 'resp'
Error

Line: 461 Column: 9

                      """
        if callback is None:
            callback = print_line
        resp = self.sendcmd('TYPE A')
        with self.transfercmd(cmd) as conn, \
                 conn.makefile('r', encoding=self.encoding) as fp:
            while 1:
                line = fp.readline(self.maxline + 1)
                if len(line) > self.maxline:

            

Reported by Pylint.

Dangerous default value [] as argument
Error

Line: 571 Column: 5

                              cmd = cmd + (' ' + arg)
        self.retrlines(cmd, func)

    def mlsd(self, path="", facts=[]):
        '''List a directory in a standardized format by using MLSD
        command (RFC-3659). If path is omitted the current directory
        is assumed. "facts" is a list of strings representing the type
        of information desired (e.g. ["type", "size", "perm"]).


            

Reported by Pylint.

Lib/unittest/loader.py
79 issues
Cannot import 'traceback' due to syntax error 'invalid syntax (<unknown>, line 576)'
Error

Line: 6 Column: 1

              import os
import re
import sys
import traceback
import types
import functools
import warnings

from fnmatch import fnmatch, fnmatchcase

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 13 Column: 1

              
from fnmatch import fnmatch, fnmatchcase

from . import case, suite, util

__unittest = True

# what about .pyc (etc)
# we would need to avoid loading the same tests multiple times

            

Reported by Pylint.

Unused argument 'self'
Error

Line: 54 Column: 21

              
def _make_skipped_test(methodname, exception, suiteClass):
    @case.skip(str(exception))
    def testSkipped(self):
        pass
    attrs = {methodname: testSkipped}
    TestClass = type("ModuleSkipped", (case.TestCase,), attrs)
    return suiteClass((TestClass(methodname),))


            

Reported by Pylint.

XXX After Python 3.5, remove backward compatibility hacks for
Error

Line: 96 Column: 3

                      loaded_suite = self.suiteClass(map(testCaseClass, testCaseNames))
        return loaded_suite

    # XXX After Python 3.5, remove backward compatibility hacks for
    # use_load_tests deprecation via *args and **kws.  See issue 16662.
    def loadTestsFromModule(self, module, *args, pattern=None, **kws):
        """Return a suite of all test cases contained in the given module"""
        # This method used to take an undocumented and unofficial
        # use_load_tests argument.  For backward compatibility, we still

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 131 Column: 20

                      if load_tests is not None:
            try:
                return load_tests(self, tests, pattern)
            except Exception as e:
                error_case, error_message = _make_failed_load_tests(
                    module.__name__, e, self.suiteClass)
                self.errors.append(error_message)
                return error_case
        return tests

            

Reported by Pylint.

Using an f-string that does not have any interpolated variables
Error

Line: 232 Column: 24

                          testFunc = getattr(testCaseClass, attrname)
            if not callable(testFunc):
                return False
            fullName = f'%s.%s.%s' % (
                testCaseClass.__module__, testCaseClass.__qualname__, attrname
            )
            return self.testNamePatterns is None or \
                any(fnmatchcase(fullName, pattern) for pattern in self.testNamePatterns)
        testFnNames = list(filter(shouldIncludeMethod, dir(testCaseClass)))

            

Reported by Pylint.

Unused argument 'full_path'
Error

Line: 380 Column: 33

                      __import__(name)
        return sys.modules[name]

    def _match_path(self, path, full_path, pattern):
        # override this method to use alternative matching strategy
        return fnmatch(path, pattern)

    def _find_tests(self, start_dir, pattern, namespace=False):
        """Used by discovery. Yields test suites it loads."""

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 439 Column: 13

                              module = self._get_module_from_name(name)
            except case.SkipTest as e:
                return _make_skipped_test(name, e, self.suiteClass), False
            except:
                error_case, error_message = \
                    _make_failed_import_test(name, self.suiteClass)
                self.errors.append(error_message)
                return error_case, False
            else:

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 473 Column: 13

                              package = self._get_module_from_name(name)
            except case.SkipTest as e:
                return _make_skipped_test(name, e, self.suiteClass), False
            except:
                error_case, error_message = \
                    _make_failed_import_test(name, self.suiteClass)
                self.errors.append(error_message)
                return error_case, False
            else:

            

Reported by Pylint.

Constant name "__unittest" doesn't conform to UPPER_CASE naming style
Error

Line: 15 Column: 1

              
from . import case, suite, util

__unittest = True

# what about .pyc (etc)
# we would need to avoid loading the same tests multiple times
# from '.py', *and* '.pyc'
VALID_MODULE_NAME = re.compile(r'[_a-z]\w*\.py$', re.IGNORECASE)

            

Reported by Pylint.

Lib/test/test_py_compile.py
78 issues
Instance of 'PyCompileTestsBase' has no 'assertTrue' member
Error

Line: 78 Column: 9

              
    def test_absolute_path(self):
        py_compile.compile(self.source_path, self.pyc_path)
        self.assertTrue(os.path.exists(self.pyc_path))
        self.assertFalse(os.path.exists(self.cache_path))

    def test_do_not_overwrite_symlinks(self):
        # In the face of a cfile argument being a symlink, bail out.
        # Issue #17222

            

Reported by Pylint.

Instance of 'PyCompileTestsBase' has no 'assertFalse' member
Error

Line: 79 Column: 9

                  def test_absolute_path(self):
        py_compile.compile(self.source_path, self.pyc_path)
        self.assertTrue(os.path.exists(self.pyc_path))
        self.assertFalse(os.path.exists(self.cache_path))

    def test_do_not_overwrite_symlinks(self):
        # In the face of a cfile argument being a symlink, bail out.
        # Issue #17222
        try:

            

Reported by Pylint.

Instance of 'PyCompileTestsBase' has no 'skipTest' member
Error

Line: 87 Column: 13

                      try:
            os.symlink(self.pyc_path + '.actual', self.pyc_path)
        except (NotImplementedError, OSError):
            self.skipTest('need to be able to create a symlink for a file')
        else:
            assert os.path.islink(self.pyc_path)
            with self.assertRaises(FileExistsError):
                py_compile.compile(self.source_path, self.pyc_path)


            

Reported by Pylint.

Instance of 'PyCompileTestsBase' has no 'assertRaises' member
Error

Line: 90 Column: 18

                          self.skipTest('need to be able to create a symlink for a file')
        else:
            assert os.path.islink(self.pyc_path)
            with self.assertRaises(FileExistsError):
                py_compile.compile(self.source_path, self.pyc_path)

    @unittest.skipIf(not os.path.exists(os.devnull) or os.path.isfile(os.devnull),
                     'requires os.devnull and for it to be a non-regular file')
    def test_do_not_overwrite_nonregular_files(self):

            

Reported by Pylint.

Instance of 'PyCompileTestsBase' has no 'assertRaises' member
Error

Line: 98 Column: 14

                  def test_do_not_overwrite_nonregular_files(self):
        # In the face of a cfile argument being a non-regular file, bail out.
        # Issue #17222
        with self.assertRaises(FileExistsError):
            py_compile.compile(self.source_path, os.devnull)

    def test_cache_path(self):
        py_compile.compile(self.source_path)
        self.assertTrue(os.path.exists(self.cache_path))

            

Reported by Pylint.

Instance of 'PyCompileTestsBase' has no 'assertTrue' member
Error

Line: 103 Column: 9

              
    def test_cache_path(self):
        py_compile.compile(self.source_path)
        self.assertTrue(os.path.exists(self.cache_path))

    def test_cwd(self):
        with os_helper.change_cwd(self.directory):
            py_compile.compile(os.path.basename(self.source_path),
                               os.path.basename(self.pyc_path))

            

Reported by Pylint.

Instance of 'PyCompileTestsBase' has no 'assertTrue' member
Error

Line: 109 Column: 9

                      with os_helper.change_cwd(self.directory):
            py_compile.compile(os.path.basename(self.source_path),
                               os.path.basename(self.pyc_path))
        self.assertTrue(os.path.exists(self.pyc_path))
        self.assertFalse(os.path.exists(self.cache_path))

    def test_relative_path(self):
        py_compile.compile(os.path.relpath(self.source_path),
                           os.path.relpath(self.pyc_path))

            

Reported by Pylint.

Instance of 'PyCompileTestsBase' has no 'assertFalse' member
Error

Line: 110 Column: 9

                          py_compile.compile(os.path.basename(self.source_path),
                               os.path.basename(self.pyc_path))
        self.assertTrue(os.path.exists(self.pyc_path))
        self.assertFalse(os.path.exists(self.cache_path))

    def test_relative_path(self):
        py_compile.compile(os.path.relpath(self.source_path),
                           os.path.relpath(self.pyc_path))
        self.assertTrue(os.path.exists(self.pyc_path))

            

Reported by Pylint.

Instance of 'PyCompileTestsBase' has no 'assertTrue' member
Error

Line: 115 Column: 9

                  def test_relative_path(self):
        py_compile.compile(os.path.relpath(self.source_path),
                           os.path.relpath(self.pyc_path))
        self.assertTrue(os.path.exists(self.pyc_path))
        self.assertFalse(os.path.exists(self.cache_path))

    @unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0,
                     'non-root user required')
    @unittest.skipIf(os.name == 'nt',

            

Reported by Pylint.

Instance of 'PyCompileTestsBase' has no 'assertFalse' member
Error

Line: 116 Column: 9

                      py_compile.compile(os.path.relpath(self.source_path),
                           os.path.relpath(self.pyc_path))
        self.assertTrue(os.path.exists(self.pyc_path))
        self.assertFalse(os.path.exists(self.cache_path))

    @unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0,
                     'non-root user required')
    @unittest.skipIf(os.name == 'nt',
                     'cannot control directory permissions on Windows')

            

Reported by Pylint.

Tools/c-analyzer/c_common/scriptutil.py
78 issues
Attempted relative import beyond top-level package
Error

Line: 10 Column: 1

              import shutil
import sys

from . import fsutil, strutil, iterutil, logging as loggingutil


_NOT_SET = object()



            

Reported by Pylint.

Module 'posixpath' has no 'normalize' member
Error

Line: 66 Column: 32

              def is_installed(filename, *, allowsuffix=True):
    if not allowsuffix and filename.endswith('.py'):
        return False
    filename = os.path.abspath(os.path.normalize(filename))
    found = shutil.which(os.path.basename(filename))
    if not found:
        return False
    if found != filename:
        return False

            

Reported by Pylint.

Module 'ntpath' has no 'normalize' member
Error

Line: 66 Column: 32

              def is_installed(filename, *, allowsuffix=True):
    if not allowsuffix and filename.endswith('.py'):
        return False
    filename = os.path.abspath(os.path.normalize(filename))
    found = shutil.which(os.path.basename(filename))
    if not found:
        return False
    if found != filename:
        return False

            

Reported by Pylint.

Module 'ntpath' has no 'normalize' member
Error

Line: 76 Column: 32

              

def is_standalone(filename):
    filename = os.path.abspath(os.path.normalize(filename))
    return _is_standalone(filename)


def _is_standalone(filename):
    return fsutil.is_executable(filename)

            

Reported by Pylint.

Module 'posixpath' has no 'normalize' member
Error

Line: 76 Column: 32

              

def is_standalone(filename):
    filename = os.path.abspath(os.path.normalize(filename))
    return _is_standalone(filename)


def _is_standalone(filename):
    return fsutil.is_executable(filename)

            

Reported by Pylint.

Unused import fnmatch
Error

Line: 3 Column: 1

              import argparse
import contextlib
import fnmatch
import logging
import os
import os.path
import shutil
import sys


            

Reported by Pylint.

Reimport 'logging' (imported line 4)
Error

Line: 10 Column: 1

              import shutil
import sys

from . import fsutil, strutil, iterutil, logging as loggingutil


_NOT_SET = object()



            

Reported by Pylint.

Access to a protected member _getframe of a client class
Error

Line: 52 Column: 13

              

def _find_script():
    frame = sys._getframe(2)
    while frame.f_globals['__name__'] != '__main__':
        frame = frame.f_back

    # This should match sys.argv[0].
    filename = frame.f_globals['__file__']

            

Reported by Pylint.

Redefining name 'logger' from outer scope (line 93)
Error

Line: 96 Column: 33

              logger = logging.getLogger(__name__)


def configure_logger(verbosity, logger=None, **kwargs):
    if logger is None:
        # Configure the root logger.
        logger = logging.getLogger()
    loggingutil.configure_logger(logger, verbosity, **kwargs)


            

Reported by Pylint.

XXX Handle subtraction (leading "-").
Error

Line: 133 Column: 3

                      for value in item.strip().replace(',', ' ').split():
            if not value:
                continue
            # XXX Handle subtraction (leading "-").
            if possible and value not in possible and value != 'all':
                unsupported.append(value)
            _selected.add(value)
    if unsupported:
        raise UnsupportedSelectionError(unsupported, tuple(possible))

            

Reported by Pylint.

Tools/peg_generator/pegen/grammar.py
78 issues
Redefining built-in 'type'
Error

Line: 71 Column: 35

              

class Rule:
    def __init__(self, name: str, type: Optional[str], rhs: Rhs, memo: Optional[object] = None):
        self.name = name
        self.type = type
        self.rhs = rhs
        self.memo = bool(memo)
        self.visited = False

            

Reported by Pylint.

Using a conditional statement with a constant value
Error

Line: 140 Column: 9

                      return self.value

    def __iter__(self) -> Iterable[str]:
        if False:
            yield

    @abstractmethod
    def nullable_visit(self, rules: Dict[str, Rule]) -> bool:
        raise NotImplementedError

            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 262 Column: 57

              

class NamedItem:
    def __init__(self, name: Optional[str], item: Item, type: Optional[str] = None):
        self.name = name
        self.item = item
        self.type = type
        self.nullable = False


            

Reported by Pylint.

Unused argument 'rules'
Error

Line: 301 Column: 30

                  def __iter__(self) -> Iterator[Plain]:
        yield self.node

    def nullable_visit(self, rules: Dict[str, Rule]) -> bool:
        return True

    def initial_names(self) -> AbstractSet[str]:
        return set()


            

Reported by Pylint.

Unused argument 'rules'
Error

Line: 319 Column: 30

                  def __iter__(self) -> Iterator[Plain]:
        yield self.node

    def nullable_visit(self, rules: Dict[str, Rule]) -> bool:
        return True

    def initial_names(self) -> AbstractSet[str]:
        return set()


            

Reported by Pylint.

TODO: Decide whether to use [X] or X? based on type of X
Error

Line: 348 Column: 3

              
    def __str__(self) -> str:
        s = str(self.node)
        # TODO: Decide whether to use [X] or X? based on type of X
        if " " in s:
            return f"[{s}]"
        else:
            return f"{s}?"


            

Reported by Pylint.

Unused argument 'rules'
Error

Line: 360 Column: 30

                  def __iter__(self) -> Iterator[Item]:
        yield self.node

    def nullable_visit(self, rules: Dict[str, Rule]) -> bool:
        return True

    def initial_names(self) -> AbstractSet[str]:
        return self.node.initial_names()


            

Reported by Pylint.

TODO: Decide whether to use (X)* or X* based on type of X
Error

Line: 388 Column: 3

              class Repeat0(Repeat):
    def __str__(self) -> str:
        s = str(self.node)
        # TODO: Decide whether to use (X)* or X* based on type of X
        if " " in s:
            return f"({s})*"
        else:
            return f"{s}*"


            

Reported by Pylint.

TODO: Decide whether to use (X)+ or X+ based on type of X
Error

Line: 404 Column: 3

              class Repeat1(Repeat):
    def __str__(self) -> str:
        s = str(self.node)
        # TODO: Decide whether to use (X)+ or X+ based on type of X
        if " " in s:
            return f"({s})+"
        else:
            return f"{s}+"


            

Reported by Pylint.

__init__ method from base class 'Repeat' is not called
Error

Line: 418 Column: 5

              

class Gather(Repeat):
    def __init__(self, separator: Plain, node: Plain):
        self.separator = separator
        self.node = node

    def __str__(self) -> str:
        return f"{self.separator!s}.{self.node!s}+"

            

Reported by Pylint.

Lib/ctypes/test/test_sizes.py
78 issues
Wildcard import ctypes
Error

Line: 3 Column: 1

              # Test specifically-sized containers.

from ctypes import *

import unittest


class SizesTestCase(unittest.TestCase):
    def test_8(self):

            

Reported by Pylint.

Unused import c_char_p from wildcard import
Error

Line: 3 Column: 1

              # Test specifically-sized containers.

from ctypes import *

import unittest


class SizesTestCase(unittest.TestCase):
    def test_8(self):

            

Reported by Pylint.

Unused import c_char from wildcard import
Error

Line: 3 Column: 1

              # Test specifically-sized containers.

from ctypes import *

import unittest


class SizesTestCase(unittest.TestCase):
    def test_8(self):

            

Reported by Pylint.

Unused import c_byte from wildcard import
Error

Line: 3 Column: 1

              # Test specifically-sized containers.

from ctypes import *

import unittest


class SizesTestCase(unittest.TestCase):
    def test_8(self):

            

Reported by Pylint.

Unused import c_ubyte from wildcard import
Error

Line: 3 Column: 1

              # Test specifically-sized containers.

from ctypes import *

import unittest


class SizesTestCase(unittest.TestCase):
    def test_8(self):

            

Reported by Pylint.

Unused import c_ulonglong from wildcard import
Error

Line: 3 Column: 1

              # Test specifically-sized containers.

from ctypes import *

import unittest


class SizesTestCase(unittest.TestCase):
    def test_8(self):

            

Reported by Pylint.

Unused import c_longlong from wildcard import
Error

Line: 3 Column: 1

              # Test specifically-sized containers.

from ctypes import *

import unittest


class SizesTestCase(unittest.TestCase):
    def test_8(self):

            

Reported by Pylint.

Unused import c_longdouble from wildcard import
Error

Line: 3 Column: 1

              # Test specifically-sized containers.

from ctypes import *

import unittest


class SizesTestCase(unittest.TestCase):
    def test_8(self):

            

Reported by Pylint.

Unused import c_double from wildcard import
Error

Line: 3 Column: 1

              # Test specifically-sized containers.

from ctypes import *

import unittest


class SizesTestCase(unittest.TestCase):
    def test_8(self):

            

Reported by Pylint.

Unused import c_float from wildcard import
Error

Line: 3 Column: 1

              # Test specifically-sized containers.

from ctypes import *

import unittest


class SizesTestCase(unittest.TestCase):
    def test_8(self):

            

Reported by Pylint.

Lib/test/test_importlib/test_main.py
78 issues
Attempted relative import beyond top-level package
Error

Line: 12 Column: 5

              try:
    import pyfakefs.fake_filesystem_unittest as ffs
except ImportError:
    from .stubs import fake_filesystem_unittest as ffs

from . import fixtures
from importlib.metadata import (
    Distribution,
    EntryPoint,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 14 Column: 1

              except ImportError:
    from .stubs import fake_filesystem_unittest as ffs

from . import fixtures
from importlib.metadata import (
    Distribution,
    EntryPoint,
    PackageNotFoundError,
    distributions,

            

Reported by Pylint.

Redefining name 'metadata' from outer scope (line 15)
Error

Line: 85 Column: 9

                      """
        metadata_dir = site_dir / 'my_pkg.dist-info'
        metadata_dir.mkdir()
        metadata = metadata_dir / 'METADATA'
        with metadata.open('w', encoding='utf-8') as strm:
            strm.write('Version: 1.0\n')
        return 'my-pkg'

    def test_dashes_in_dist_name_found_as_underscores(self):

            

Reported by Pylint.

Redefining name 'metadata' from outer scope (line 15)
Error

Line: 104 Column: 9

                      """
        metadata_dir = site_dir / 'CherryPy.dist-info'
        metadata_dir.mkdir()
        metadata = metadata_dir / 'METADATA'
        with metadata.open('w', encoding='utf-8') as strm:
            strm.write('Version: 1.0\n')
        return 'CherryPy'

    def test_dist_name_found_as_any_case(self):

            

Reported by Pylint.

Redefining name 'metadata' from outer scope (line 15)
Error

Line: 126 Column: 9

                      """
        metadata_dir = site_dir / 'portend.dist-info'
        metadata_dir.mkdir()
        metadata = metadata_dir / 'METADATA'
        with metadata.open('w', encoding='utf-8') as fp:
            fp.write('Description: pôrˈtend')
        return 'portend'

    @staticmethod

            

Reported by Pylint.

Redefining name 'metadata' from outer scope (line 15)
Error

Line: 139 Column: 9

                      """
        metadata_dir = site_dir / 'portend.dist-info'
        metadata_dir.mkdir()
        metadata = metadata_dir / 'METADATA'
        with metadata.open('w', encoding='utf-8') as fp:
            fp.write(
                textwrap.dedent(
                    """
                Name: portend

            

Reported by Pylint.

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Security blacklist

Line: 224
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle

                      self.ep = importlib.metadata.EntryPoint('name', 'value', 'group')

    def test_entry_point_pickleable(self):
        revived = pickle.loads(pickle.dumps(self.ep))
        assert revived == self.ep

    def test_immutable(self):
        """EntryPoints should be immutable"""
        with self.assertRaises(AttributeError):

            

Reported by Bandit.

Missing module docstring
Error

Line: 1 Column: 1

              import re
import json
import pickle
import textwrap
import unittest
import warnings
import importlib.metadata

try:

            

Reported by Pylint.

Consider possible security implications associated with pickle module.
Security blacklist

Line: 3
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b403-import-pickle

              import re
import json
import pickle
import textwrap
import unittest
import warnings
import importlib.metadata

try:

            

Reported by Bandit.

standard import "from importlib.metadata import Distribution, EntryPoint, PackageNotFoundError, distributions, entry_points, metadata, version" should be placed before "from . import fixtures"
Error

Line: 15 Column: 1

                  from .stubs import fake_filesystem_unittest as ffs

from . import fixtures
from importlib.metadata import (
    Distribution,
    EntryPoint,
    PackageNotFoundError,
    distributions,
    entry_points,

            

Reported by Pylint.

Lib/turtledemo/round_dance.py
77 issues
Undefined variable 'clearscreen'
Error

Line: 33 Column: 5

              
def main():
    global running
    clearscreen()
    bgcolor("gray10")
    tracer(False)
    shape("triangle")
    f =   0.793402
    phi = 9.064678

            

Reported by Pylint.

Undefined variable 'bgcolor'
Error

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.

Undefined variable 'tracer'
Error

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.

Undefined variable 'shape'
Error

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.

Undefined variable 'shapesize'
Error

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.

Undefined variable 'get_shapepoly'
Error

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.

Undefined variable 'tilt'
Error

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.

Undefined variable 'register_shape'
Error

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.

Undefined variable 'shapesize'
Error

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.

Undefined variable 'shape'
Error

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.