The following issues were found

Tools/c-analyzer/c_parser/__main__.py
43 issues
Attempted relative import beyond top-level package
Error

Line: 18 Column: 1

                  get_prog,
    main_for_filenames,
)
from .preprocessor import get_preprocessor
from .preprocessor.__main__ import (
    add_common_cli as add_preprocessor_cli,
)
from .info import KIND
from . import parse_file as _iter_parsed

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 19 Column: 1

                  main_for_filenames,
)
from .preprocessor import get_preprocessor
from .preprocessor.__main__ import (
    add_common_cli as add_preprocessor_cli,
)
from .info import KIND
from . import parse_file as _iter_parsed


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 22 Column: 1

              from .preprocessor.__main__ import (
    add_common_cli as add_preprocessor_cli,
)
from .info import KIND
from . import parse_file as _iter_parsed


logger = logging.getLogger(__name__)


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 23 Column: 1

                  add_common_cli as add_preprocessor_cli,
)
from .info import KIND
from . import parse_file as _iter_parsed


logger = logging.getLogger(__name__)



            

Reported by Pylint.

Undefined variable 'get_processor'
Error

Line: 54 Column: 12

              

def _get_preprocessor(filename, **kwargs):
    return get_processor(filename,
                         log_err=print,
                         **kwargs
                         )



            

Reported by Pylint.

No value for argument 'filename' in function call
Error

Line: 181 Column: 43

                            **kwargs
              ):
    if 'get_file_preprocessor' not in kwargs:
        kwargs['get_file_preprocessor'] = _get_preprocessor()
    try:
        do_fmt = FORMATS[fmt]
    except KeyError:
        raise ValueError(f'unsupported fmt {fmt!r}')
    for filename, relfile in main_for_filenames(filenames, iter_filenames, relroot):

            

Reported by Pylint.

Unused import os.path
Error

Line: 2 Column: 1

              import logging
import os.path
import sys

from c_common import fsutil
from c_common.scriptutil import (
    CLIArgSpec as Arg,
    add_verbosity_cli,
    add_traceback_cli,

            

Reported by Pylint.

Unused fsutil imported from c_common
Error

Line: 5 Column: 1

              import os.path
import sys

from c_common import fsutil
from c_common.scriptutil import (
    CLIArgSpec as Arg,
    add_verbosity_cli,
    add_traceback_cli,
    add_kind_filtering_cli,

            

Reported by Pylint.

Unused CLIArgSpec imported from c_common.scriptutil as Arg
Error

Line: 6 Column: 1

              import sys

from c_common import fsutil
from c_common.scriptutil import (
    CLIArgSpec as Arg,
    add_verbosity_cli,
    add_traceback_cli,
    add_kind_filtering_cli,
    add_files_cli,

            

Reported by Pylint.

Unused get_preprocessor imported from preprocessor
Error

Line: 18 Column: 1

                  get_prog,
    main_for_filenames,
)
from .preprocessor import get_preprocessor
from .preprocessor.__main__ import (
    add_common_cli as add_preprocessor_cli,
)
from .info import KIND
from . import parse_file as _iter_parsed

            

Reported by Pylint.

Lib/unittest/test/support.py
43 issues
Instance of 'TestEquality' has no 'eq_pairs' member
Error

Line: 9 Column: 29

              
    # Check for a valid __eq__ implementation
    def test_eq(self):
        for obj_1, obj_2 in self.eq_pairs:
            self.assertEqual(obj_1, obj_2)
            self.assertEqual(obj_2, obj_1)

    # Check for a valid __ne__ implementation
    def test_ne(self):

            

Reported by Pylint.

Instance of 'TestEquality' has no 'assertEqual' member
Error

Line: 10 Column: 13

                  # Check for a valid __eq__ implementation
    def test_eq(self):
        for obj_1, obj_2 in self.eq_pairs:
            self.assertEqual(obj_1, obj_2)
            self.assertEqual(obj_2, obj_1)

    # Check for a valid __ne__ implementation
    def test_ne(self):
        for obj_1, obj_2 in self.ne_pairs:

            

Reported by Pylint.

Instance of 'TestEquality' has no 'assertEqual' member
Error

Line: 11 Column: 13

                  def test_eq(self):
        for obj_1, obj_2 in self.eq_pairs:
            self.assertEqual(obj_1, obj_2)
            self.assertEqual(obj_2, obj_1)

    # Check for a valid __ne__ implementation
    def test_ne(self):
        for obj_1, obj_2 in self.ne_pairs:
            self.assertNotEqual(obj_1, obj_2)

            

Reported by Pylint.

Instance of 'TestEquality' has no 'ne_pairs' member
Error

Line: 15 Column: 29

              
    # Check for a valid __ne__ implementation
    def test_ne(self):
        for obj_1, obj_2 in self.ne_pairs:
            self.assertNotEqual(obj_1, obj_2)
            self.assertNotEqual(obj_2, obj_1)

class TestHashing(object):
    """Used as a mixin for TestCase"""

            

Reported by Pylint.

Instance of 'TestEquality' has no 'assertNotEqual' member
Error

Line: 16 Column: 13

                  # Check for a valid __ne__ implementation
    def test_ne(self):
        for obj_1, obj_2 in self.ne_pairs:
            self.assertNotEqual(obj_1, obj_2)
            self.assertNotEqual(obj_2, obj_1)

class TestHashing(object):
    """Used as a mixin for TestCase"""


            

Reported by Pylint.

Instance of 'TestEquality' has no 'assertNotEqual' member
Error

Line: 17 Column: 13

                  def test_ne(self):
        for obj_1, obj_2 in self.ne_pairs:
            self.assertNotEqual(obj_1, obj_2)
            self.assertNotEqual(obj_2, obj_1)

class TestHashing(object):
    """Used as a mixin for TestCase"""

    # Check for a valid __hash__ implementation

            

Reported by Pylint.

Instance of 'TestHashing' has no 'eq_pairs' member
Error

Line: 24 Column: 29

              
    # Check for a valid __hash__ implementation
    def test_hash(self):
        for obj_1, obj_2 in self.eq_pairs:
            try:
                if not hash(obj_1) == hash(obj_2):
                    self.fail("%r and %r do not hash equal" % (obj_1, obj_2))
            except Exception as e:
                self.fail("Problem hashing %r and %r: %s" % (obj_1, obj_2, e))

            

Reported by Pylint.

Instance of 'TestHashing' has no 'fail' member
Error

Line: 27 Column: 21

                      for obj_1, obj_2 in self.eq_pairs:
            try:
                if not hash(obj_1) == hash(obj_2):
                    self.fail("%r and %r do not hash equal" % (obj_1, obj_2))
            except Exception as e:
                self.fail("Problem hashing %r and %r: %s" % (obj_1, obj_2, e))

        for obj_1, obj_2 in self.ne_pairs:
            try:

            

Reported by Pylint.

Instance of 'TestHashing' has no 'fail' member
Error

Line: 29 Column: 17

                              if not hash(obj_1) == hash(obj_2):
                    self.fail("%r and %r do not hash equal" % (obj_1, obj_2))
            except Exception as e:
                self.fail("Problem hashing %r and %r: %s" % (obj_1, obj_2, e))

        for obj_1, obj_2 in self.ne_pairs:
            try:
                if hash(obj_1) == hash(obj_2):
                    self.fail("%s and %s hash equal, but shouldn't" %

            

Reported by Pylint.

Instance of 'TestHashing' has no 'ne_pairs' member
Error

Line: 31 Column: 29

                          except Exception as e:
                self.fail("Problem hashing %r and %r: %s" % (obj_1, obj_2, e))

        for obj_1, obj_2 in self.ne_pairs:
            try:
                if hash(obj_1) == hash(obj_2):
                    self.fail("%s and %s hash equal, but shouldn't" %
                              (obj_1, obj_2))
            except Exception as e:

            

Reported by Pylint.

Lib/copy.py
43 issues
Dangerous default value [] as argument
Error

Line: 128 Column: 1

              
del d, t

def deepcopy(x, memo=None, _nil=[]):
    """Deep copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    """


            

Reported by Pylint.

Redefining name 'd' from outer scope (line 105)
Error

Line: 137 Column: 5

                  if memo is None:
        memo = {}

    d = id(x)
    y = memo.get(d, _nil)
    if y is not _nil:
        return y

    cls = type(x)

            

Reported by Pylint.

Unused argument 'memo'
Error

Line: 182 Column: 25

              
_deepcopy_dispatch = d = {}

def _deepcopy_atomic(x, memo):
    return x
d[type(None)] = _deepcopy_atomic
d[type(Ellipsis)] = _deepcopy_atomic
d[type(NotImplemented)] = _deepcopy_atomic
d[int] = _deepcopy_atomic

            

Reported by Pylint.

Redefining name 'deepcopy' from outer scope (line 128)
Error

Line: 201 Column: 29

              d[weakref.ref] = _deepcopy_atomic
d[property] = _deepcopy_atomic

def _deepcopy_list(x, memo, deepcopy=deepcopy):
    y = []
    memo[id(x)] = y
    append = y.append
    for a in x:
        append(deepcopy(a, memo))

            

Reported by Pylint.

Redefining name 'deepcopy' from outer scope (line 128)
Error

Line: 210 Column: 30

                  return y
d[list] = _deepcopy_list

def _deepcopy_tuple(x, memo, deepcopy=deepcopy):
    y = [deepcopy(a, memo) for a in x]
    # We're not going to put the tuple in the memo, but it's still important we
    # check for it, in case the tuple contains recursive mutable structures.
    try:
        return memo[id(x)]

            

Reported by Pylint.

Redefining name 'deepcopy' from outer scope (line 128)
Error

Line: 227 Column: 29

                  return y
d[tuple] = _deepcopy_tuple

def _deepcopy_dict(x, memo, deepcopy=deepcopy):
    y = {}
    memo[id(x)] = y
    for key, value in x.items():
        y[deepcopy(key, memo)] = deepcopy(value, memo)
    return y

            

Reported by Pylint.

Redefining name 'deepcopy' from outer scope (line 128)
Error

Line: 261 Column: 18

              
def _reconstruct(x, memo, func, args,
                 state=None, listiter=None, dictiter=None,
                 deepcopy=deepcopy):
    deep = memo is not None
    if deep and args:
        args = (deepcopy(arg, memo) for arg in args)
    y = func(*args)
    if deep:

            

Reported by Pylint.

Missing class docstring
Error

Line: 55 Column: 1

              import weakref
from copyreg import dispatch_table

class Error(Exception):
    pass
error = Error   # backward compatibility

try:
    from org.python.core import PyStringMap

            

Reported by Pylint.

Class name "error" doesn't conform to PascalCase naming style
Error

Line: 57 Column: 1

              
class Error(Exception):
    pass
error = Error   # backward compatibility

try:
    from org.python.core import PyStringMap
except ImportError:
    PyStringMap = None

            

Reported by Pylint.

Argument name "x" doesn't conform to snake_case naming style
Error

Line: 66 Column: 1

              
__all__ = ["Error", "copy", "deepcopy"]

def copy(x):
    """Shallow copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    """


            

Reported by Pylint.

Lib/asyncio/base_subprocess.py
43 issues
Attempted relative import beyond top-level package
Error

Line: 5 Column: 1

              import subprocess
import warnings

from . import protocols
from . import transports
from .log import logger


class BaseSubprocessTransport(transports.SubprocessTransport):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              import warnings

from . import protocols
from . import transports
from .log import logger


class BaseSubprocessTransport(transports.SubprocessTransport):


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

              
from . import protocols
from . import transports
from .log import logger


class BaseSubprocessTransport(transports.SubprocessTransport):

    def __init__(self, loop, protocol, args, shell,

            

Reported by Pylint.

Function call with shell=True parameter identified, possible security issue.
Security injection

Line: 36
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b604_any_other_function_with_shell_equals_true.html

              
        # Create the child process: set the _proc attribute
        try:
            self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
                        stderr=stderr, bufsize=bufsize, **kwargs)
        except:
            self.close()
            raise


            

Reported by Bandit.

Catching too general exception BaseException
Error

Line: 187 Column: 16

                          self._pending_calls = None
        except (SystemExit, KeyboardInterrupt):
            raise
        except BaseException as exc:
            if waiter is not None and not waiter.cancelled():
                waiter.set_exception(exc)
        else:
            if waiter is not None and not waiter.cancelled():
                waiter.set_result(None)

            

Reported by Pylint.

Access to a protected member _pipe_connection_lost of a client class
Error

Line: 271 Column: 9

              
    def connection_lost(self, exc):
        self.disconnected = True
        self.proc._pipe_connection_lost(self.fd, exc)
        self.proc = None

    def pause_writing(self):
        self.proc._protocol.pause_writing()


            

Reported by Pylint.

Access to a protected member _protocol of a client class
Error

Line: 275 Column: 9

                      self.proc = None

    def pause_writing(self):
        self.proc._protocol.pause_writing()

    def resume_writing(self):
        self.proc._protocol.resume_writing()



            

Reported by Pylint.

Access to a protected member _protocol of a client class
Error

Line: 278 Column: 9

                      self.proc._protocol.pause_writing()

    def resume_writing(self):
        self.proc._protocol.resume_writing()


class ReadSubprocessPipeProto(WriteSubprocessPipeProto,
                              protocols.Protocol):


            

Reported by Pylint.

Access to a protected member _pipe_data_received of a client class
Error

Line: 285 Column: 9

                                            protocols.Protocol):

    def data_received(self, data):
        self.proc._pipe_data_received(self.fd, data)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import collections
import subprocess
import warnings

from . import protocols
from . import transports
from .log import logger



            

Reported by Pylint.

Lib/importlib/abc.py
43 issues
Attempted relative import beyond top-level package
Error

Line: 2 Column: 1

              """Abstract base classes related to import."""
from . import _bootstrap_external
from . import machinery
try:
    import _frozen_importlib
except ImportError as exc:
    if exc.name != '_frozen_importlib':
        raise
    _frozen_importlib = None

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 3 Column: 1

              """Abstract base classes related to import."""
from . import _bootstrap_external
from . import machinery
try:
    import _frozen_importlib
except ImportError as exc:
    if exc.name != '_frozen_importlib':
        raise
    _frozen_importlib = None

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 14 Column: 1

                  import _frozen_importlib_external
except ImportError:
    _frozen_importlib_external = _bootstrap_external
from ._abc import Loader
import abc
import warnings
from typing import BinaryIO, Iterable, Text
from typing import Protocol, runtime_checkable


            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 50 Column: 6

                                     "or PathEntryFinder instead",
                       DeprecationWarning)

    @abc.abstractmethod
    def find_module(self, fullname, path=None):
        """An abstract method that should find a module.
        The fullname is a str and the optional path is a str or None.
        Returns a Loader object or None.
        """

            

Reported by Pylint.

Instance of 'MetaPathFinder' has no 'find_spec' member
Error

Line: 89 Column: 17

                                    stacklevel=2)
        if not hasattr(self, 'find_spec'):
            return None
        found = self.find_spec(fullname, path)
        return found.loader if found is not None else None

    def invalidate_caches(self):
        """An optional method for clearing the finder's cache, if any.
        This method is used by importlib.invalidate_caches().

            

Reported by Pylint.

Instance of 'PathEntryFinder' has no 'find_spec' member
Error

Line: 130 Column: 17

                                    stacklevel=2)
        if not hasattr(self, 'find_spec'):
            return None, []
        found = self.find_spec(fullname)
        if found is not None:
            if not found.submodule_search_locations:
                portions = []
            else:
                portions = found.submodule_search_locations

            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 159 Column: 6

              
    """

    @abc.abstractmethod
    def get_data(self, path):
        """Abstract method which when implemented should return the bytes for
        the specified path.  The path must be a str."""
        raise OSError


            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 196 Column: 6

                          return None
        return self.source_to_code(source)

    @abc.abstractmethod
    def get_source(self, fullname):
        """Abstract method which should return the source code for the
        module.  The fullname is a str.  Returns a str.

        Raises ImportError if the module cannot be found.

            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 228 Column: 6

              
    """

    @abc.abstractmethod
    def get_filename(self, fullname):
        """Abstract method which should return the value that __file__ is to be
        set to.

        Raises ImportError if the module cannot be found.

            

Reported by Pylint.

Module 'abc' has no 'abstractmethod' member
Error

Line: 315 Column: 6

              class ResourceReader(metaclass=abc.ABCMeta):
    """Abstract base class for loaders to provide resource reading support."""

    @abc.abstractmethod
    def open_resource(self, resource: Text) -> BinaryIO:
        """Return an opened, file-like object for binary reading.

        The 'resource' argument is expected to represent only a file name.
        If the resource cannot be found, FileNotFoundError is raised.

            

Reported by Pylint.

Lib/distutils/tests/test_unixccompiler.py
43 issues
function already defined line 41
Error

Line: 46 Column: 9

                      sysconfig.get_config_var = gcv
        self.assertEqual(self.cc.rpath_foo(), ['+s', '-L/foo'])

        def gcv(v):
            return 'gcc'
        sysconfig.get_config_var = gcv
        self.assertEqual(self.cc.rpath_foo(), ['-Wl,+s', '-L/foo'])

        def gcv(v):

            

Reported by Pylint.

function already defined line 41
Error

Line: 51 Column: 9

                      sysconfig.get_config_var = gcv
        self.assertEqual(self.cc.rpath_foo(), ['-Wl,+s', '-L/foo'])

        def gcv(v):
            return 'g++'
        sysconfig.get_config_var = gcv
        self.assertEqual(self.cc.rpath_foo(), ['-Wl,+s', '-L/foo'])

        sysconfig.get_config_var = old_gcv

            

Reported by Pylint.

function already defined line 41
Error

Line: 60 Column: 9

              
        # GCC GNULD
        sys.platform = 'bar'
        def gcv(v):
            if v == 'CC':
                return 'gcc'
            elif v == 'GNULD':
                return 'yes'
        sysconfig.get_config_var = gcv

            

Reported by Pylint.

function already defined line 41
Error

Line: 70 Column: 9

              
        # GCC non-GNULD
        sys.platform = 'bar'
        def gcv(v):
            if v == 'CC':
                return 'gcc'
            elif v == 'GNULD':
                return 'no'
        sysconfig.get_config_var = gcv

            

Reported by Pylint.

function already defined line 41
Error

Line: 81 Column: 9

                      # GCC GNULD with fully qualified configuration prefix
        # see #7617
        sys.platform = 'bar'
        def gcv(v):
            if v == 'CC':
                return 'x86_64-pc-linux-gnu-gcc-4.4.2'
            elif v == 'GNULD':
                return 'yes'
        sysconfig.get_config_var = gcv

            

Reported by Pylint.

function already defined line 41
Error

Line: 91 Column: 9

              
        # non-GCC GNULD
        sys.platform = 'bar'
        def gcv(v):
            if v == 'CC':
                return 'cc'
            elif v == 'GNULD':
                return 'yes'
        sysconfig.get_config_var = gcv

            

Reported by Pylint.

function already defined line 41
Error

Line: 101 Column: 9

              
        # non-GCC non-GNULD
        sys.platform = 'bar'
        def gcv(v):
            if v == 'CC':
                return 'cc'
            elif v == 'GNULD':
                return 'no'
        sysconfig.get_config_var = gcv

            

Reported by Pylint.

Instance of 'CompilerWrapper' has no 'linker_so' member
Error

Line: 122 Column: 26

                          env['CC'] = 'my_cc'
            del env['LDSHARED']
            sysconfig.customize_compiler(self.cc)
        self.assertEqual(self.cc.linker_so[0], 'my_cc')

    @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for OS X')
    def test_osx_explicit_ldshared(self):
        # Issue #18080:
        # ensure that setting CC env variable does not change

            

Reported by Pylint.

Instance of 'CompilerWrapper' has no 'linker_so' member
Error

Line: 138 Column: 26

                          env['CC'] = 'my_cc'
            env['LDSHARED'] = 'my_ld -bundle -dynamic'
            sysconfig.customize_compiler(self.cc)
        self.assertEqual(self.cc.linker_so[0], 'my_ld')


def test_suite():
    return unittest.makeSuite(UnixCCompilerTestCase)


            

Reported by Pylint.

Access to a protected member _config_vars of a client class
Error

Line: 15 Column: 41

                  def setUp(self):
        self._backup_platform = sys.platform
        self._backup_get_config_var = sysconfig.get_config_var
        self._backup_config_vars = dict(sysconfig._config_vars)
        class CompilerWrapper(UnixCCompiler):
            def rpath_foo(self):
                return self.runtime_library_dir_option('/foo')
        self.cc = CompilerWrapper()


            

Reported by Pylint.

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

Line: 4 Column: 1

              import unittest

from importlib import resources
from . import data01
from .resources import util


class CommonBinaryTests(util.CommonTests, unittest.TestCase):
    def execute(self, package, path):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 5 Column: 1

              
from importlib import resources
from . import data01
from .resources import util


class CommonBinaryTests(util.CommonTests, unittest.TestCase):
    def execute(self, package, path):
        with resources.open_binary(package, path):

            

Reported by Pylint.

Instance of 'OpenTests' has no 'data' member
Error

Line: 22 Column: 36

              
class OpenTests:
    def test_open_binary(self):
        with resources.open_binary(self.data, 'binary.file') as fp:
            result = fp.read()
            self.assertEqual(result, b'\x00\x01\x02\x03')

    def test_open_text_default_encoding(self):
        with resources.open_text(self.data, 'utf-8.file') as fp:

            

Reported by Pylint.

Instance of 'OpenTests' has no 'assertEqual' member
Error

Line: 24 Column: 13

                  def test_open_binary(self):
        with resources.open_binary(self.data, 'binary.file') as fp:
            result = fp.read()
            self.assertEqual(result, b'\x00\x01\x02\x03')

    def test_open_text_default_encoding(self):
        with resources.open_text(self.data, 'utf-8.file') as fp:
            result = fp.read()
            self.assertEqual(result, 'Hello, UTF-8 world!\n')

            

Reported by Pylint.

Instance of 'OpenTests' has no 'data' member
Error

Line: 27 Column: 34

                          self.assertEqual(result, b'\x00\x01\x02\x03')

    def test_open_text_default_encoding(self):
        with resources.open_text(self.data, 'utf-8.file') as fp:
            result = fp.read()
            self.assertEqual(result, 'Hello, UTF-8 world!\n')

    def test_open_text_given_encoding(self):
        with resources.open_text(self.data, 'utf-16.file', 'utf-16', 'strict') as fp:

            

Reported by Pylint.

Instance of 'OpenTests' has no 'assertEqual' member
Error

Line: 29 Column: 13

                  def test_open_text_default_encoding(self):
        with resources.open_text(self.data, 'utf-8.file') as fp:
            result = fp.read()
            self.assertEqual(result, 'Hello, UTF-8 world!\n')

    def test_open_text_given_encoding(self):
        with resources.open_text(self.data, 'utf-16.file', 'utf-16', 'strict') as fp:
            result = fp.read()
        self.assertEqual(result, 'Hello, UTF-16 world!\n')

            

Reported by Pylint.

Instance of 'OpenTests' has no 'data' member
Error

Line: 32 Column: 34

                          self.assertEqual(result, 'Hello, UTF-8 world!\n')

    def test_open_text_given_encoding(self):
        with resources.open_text(self.data, 'utf-16.file', 'utf-16', 'strict') as fp:
            result = fp.read()
        self.assertEqual(result, 'Hello, UTF-16 world!\n')

    def test_open_text_with_errors(self):
        # Raises UnicodeError without the 'errors' argument.

            

Reported by Pylint.

Instance of 'OpenTests' has no 'assertEqual' member
Error

Line: 34 Column: 9

                  def test_open_text_given_encoding(self):
        with resources.open_text(self.data, 'utf-16.file', 'utf-16', 'strict') as fp:
            result = fp.read()
        self.assertEqual(result, 'Hello, UTF-16 world!\n')

    def test_open_text_with_errors(self):
        # Raises UnicodeError without the 'errors' argument.
        with resources.open_text(self.data, 'utf-16.file', 'utf-8', 'strict') as fp:
            self.assertRaises(UnicodeError, fp.read)

            

Reported by Pylint.

Instance of 'OpenTests' has no 'data' member
Error

Line: 38 Column: 34

              
    def test_open_text_with_errors(self):
        # Raises UnicodeError without the 'errors' argument.
        with resources.open_text(self.data, 'utf-16.file', 'utf-8', 'strict') as fp:
            self.assertRaises(UnicodeError, fp.read)
        with resources.open_text(self.data, 'utf-16.file', 'utf-8', 'ignore') as fp:
            result = fp.read()
        self.assertEqual(
            result,

            

Reported by Pylint.

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

Line: 39 Column: 13

                  def test_open_text_with_errors(self):
        # Raises UnicodeError without the 'errors' argument.
        with resources.open_text(self.data, 'utf-16.file', 'utf-8', 'strict') as fp:
            self.assertRaises(UnicodeError, fp.read)
        with resources.open_text(self.data, 'utf-16.file', 'utf-8', 'ignore') as fp:
            result = fp.read()
        self.assertEqual(
            result,
            'H\x00e\x00l\x00l\x00o\x00,\x00 '

            

Reported by Pylint.

Lib/poplib.py
42 issues
Redefining name 'line' from outer scope (line 480)
Error

Line: 114 Column: 24

                          raise ValueError('Non-blocking socket (timeout=0) is not supported')
        return socket.create_connection((self.host, self.port), timeout)

    def _putline(self, line):
        if self._debugging > 1: print('*put*', repr(line))
        sys.audit("poplib.putline", self, line)
        self.sock.sendall(line + CRLF)



            

Reported by Pylint.

Redefining name 'line' from outer scope (line 480)
Error

Line: 122 Column: 23

              
    # Internal: send one command to the server (through _putline())

    def _putcmd(self, line):
        if self._debugging: print('*cmd*', repr(line))
        line = bytes(line, self.encoding)
        self._putline(line)



            

Reported by Pylint.

Redefining name 'line' from outer scope (line 480)
Error

Line: 133 Column: 9

                  # Raise error_proto('-ERR EOF') if the connection is closed.

    def _getline(self):
        line = self.file.readline(_MAXLINE + 1)
        if len(line) > _MAXLINE:
            raise error_proto('line too long')

        if self._debugging > 1: print('*get*', repr(line))
        if not line: raise error_proto('-ERR EOF')

            

Reported by Pylint.

Redefining name 'octets' from outer scope (line 478)
Error

Line: 139 Column: 9

              
        if self._debugging > 1: print('*get*', repr(line))
        if not line: raise error_proto('-ERR EOF')
        octets = len(line)
        # server can send any combination of CR & LF
        # however, 'readline()' returns lines ending in LF
        # so only possibilities are ...LF, ...CRLF, CR...LF
        if line[-2:] == CRLF:
            return line[:-2], octets

            

Reported by Pylint.

Unused variable 'o'
Error

Line: 154 Column: 15

                  # Raise 'error_proto' if the response doesn't start with '+'.

    def _getresp(self):
        resp, o = self._getline()
        if self._debugging > 1: print('*resp*', repr(resp))
        if not resp.startswith(b'+'):
            raise error_proto(resp)
        return resp


            

Reported by Pylint.

Redefining name 'octets' from outer scope (line 478)
Error

Line: 165 Column: 20

              
    def _getlongresp(self):
        resp = self._getresp()
        list = []; octets = 0
        line, o = self._getline()
        while line != b'.':
            if line.startswith(b'..'):
                o = o-1
                line = line[1:]

            

Reported by Pylint.

Redefining built-in 'list'
Error

Line: 165 Column: 9

              
    def _getlongresp(self):
        resp = self._getresp()
        list = []; octets = 0
        line, o = self._getline()
        while line != b'.':
            if line.startswith(b'..'):
                o = o-1
                line = line[1:]

            

Reported by Pylint.

Redefining name 'line' from outer scope (line 480)
Error

Line: 166 Column: 9

                  def _getlongresp(self):
        resp = self._getresp()
        list = []; octets = 0
        line, o = self._getline()
        while line != b'.':
            if line.startswith(b'..'):
                o = o-1
                line = line[1:]
            octets = octets + o

            

Reported by Pylint.

Redefining name 'line' from outer scope (line 480)
Error

Line: 179 Column: 25

              
    # Internal: send a command and get the response

    def _shortcmd(self, line):
        self._putcmd(line)
        return self._getresp()


    # Internal: send a command and get the response plus following text

            

Reported by Pylint.

Redefining name 'line' from outer scope (line 480)
Error

Line: 186 Column: 24

              
    # Internal: send a command and get the response plus following text

    def _longcmd(self, line):
        self._putcmd(line)
        return self._getlongresp()


    # These can be useful:

            

Reported by Pylint.

Lib/test/inspect_stock_annotations.py
42 issues
Redefining name 'a' from outer scope (line 1)
Error

Line: 7 Column: 24

              class MyClass:
    a:int=4
    b:str="bar"
    def __init__(self, a, b):
        self.a = a
        self.b = b
    def __eq__(self, other):
        return isinstance(other, MyClass) and self.a == other.a and self.b == other.b


            

Reported by Pylint.

Redefining name 'b' from outer scope (line 2)
Error

Line: 7 Column: 27

              class MyClass:
    a:int=4
    b:str="bar"
    def __init__(self, a, b):
        self.a = a
        self.b = b
    def __eq__(self, other):
        return isinstance(other, MyClass) and self.a == other.a and self.b == other.b


            

Reported by Pylint.

Redefining name 'b' from outer scope (line 2)
Error

Line: 13 Column: 21

                  def __eq__(self, other):
        return isinstance(other, MyClass) and self.a == other.a and self.b == other.b

def function(a:int, b:str) -> MyClass:
    return MyClass(a, b)


def function2(a:int, b:"str", c:MyClass) -> MyClass:
    pass

            

Reported by Pylint.

Redefining name 'a' from outer scope (line 1)
Error

Line: 13 Column: 14

                  def __eq__(self, other):
        return isinstance(other, MyClass) and self.a == other.a and self.b == other.b

def function(a:int, b:str) -> MyClass:
    return MyClass(a, b)


def function2(a:int, b:"str", c:MyClass) -> MyClass:
    pass

            

Reported by Pylint.

Unused argument 'b'
Error

Line: 17 Column: 22

                  return MyClass(a, b)


def function2(a:int, b:"str", c:MyClass) -> MyClass:
    pass


def function3(a:"int", b:"str", c:"MyClass"):
    pass

            

Reported by Pylint.

Redefining name 'a' from outer scope (line 1)
Error

Line: 17 Column: 15

                  return MyClass(a, b)


def function2(a:int, b:"str", c:MyClass) -> MyClass:
    pass


def function3(a:"int", b:"str", c:"MyClass"):
    pass

            

Reported by Pylint.

Redefining name 'b' from outer scope (line 2)
Error

Line: 17 Column: 22

                  return MyClass(a, b)


def function2(a:int, b:"str", c:MyClass) -> MyClass:
    pass


def function3(a:"int", b:"str", c:"MyClass"):
    pass

            

Reported by Pylint.

Unused argument 'a'
Error

Line: 17 Column: 15

                  return MyClass(a, b)


def function2(a:int, b:"str", c:MyClass) -> MyClass:
    pass


def function3(a:"int", b:"str", c:"MyClass"):
    pass

            

Reported by Pylint.

Unused argument 'c'
Error

Line: 17 Column: 31

                  return MyClass(a, b)


def function2(a:int, b:"str", c:MyClass) -> MyClass:
    pass


def function3(a:"int", b:"str", c:"MyClass"):
    pass

            

Reported by Pylint.

Redefining name 'b' from outer scope (line 2)
Error

Line: 21 Column: 24

                  pass


def function3(a:"int", b:"str", c:"MyClass"):
    pass


class UnannotatedClass:
    pass

            

Reported by Pylint.

Lib/test/test_importlib/util.py
42 issues
Generator 'generator' has no '__enter__' member
Error

Line: 240 Column: 9

              
    def __enter__(self):
        self._uncache = uncache(*self.modules.keys())
        self._uncache.__enter__()
        return self

    def __exit__(self, *exc_info):
        self._uncache.__exit__(None, None, None)


            

Reported by Pylint.

Generator 'generator' has no '__exit__' member
Error

Line: 244 Column: 9

                      return self

    def __exit__(self, *exc_info):
        self._uncache.__exit__(None, None, None)


class mock_modules(_ImporterMock):

    """Importer mock using PEP 302 APIs."""

            

Reported by Pylint.

Generator 'generator' has no '__enter__' member
Error

Line: 383 Column: 9

                          created_paths.append(file_path)
            mapping[name] = file_path
        uncache_manager = uncache(*import_names)
        uncache_manager.__enter__()
        state_manager = import_state(path=[temp_dir])
        state_manager.__enter__()
        yield mapping
    finally:
        if state_manager is not None:

            

Reported by Pylint.

Generator 'generator' has no '__enter__' member
Error

Line: 385 Column: 9

                      uncache_manager = uncache(*import_names)
        uncache_manager.__enter__()
        state_manager = import_state(path=[temp_dir])
        state_manager.__enter__()
        yield mapping
    finally:
        if state_manager is not None:
            state_manager.__exit__(None, None, None)
        if uncache_manager is not None:

            

Reported by Pylint.

Generator 'generator' has no '__exit__' member
Error

Line: 389 Column: 13

                      yield mapping
    finally:
        if state_manager is not None:
            state_manager.__exit__(None, None, None)
        if uncache_manager is not None:
            uncache_manager.__exit__(None, None, None)
        os_helper.rmtree(temp_dir)



            

Reported by Pylint.

Generator 'generator' has no '__exit__' member
Error

Line: 391 Column: 13

                      if state_manager is not None:
            state_manager.__exit__(None, None, None)
        if uncache_manager is not None:
            uncache_manager.__exit__(None, None, None)
        os_helper.rmtree(temp_dir)


def mock_path_hook(*entries, importer):
    """A mock sys.path_hooks entry."""

            

Reported by Pylint.

Instance of 'CASEOKTestBase' has no 'importlib' member
Error

Line: 408 Column: 21

              
    def caseok_env_changed(self, *, should_exist):
        possibilities = b'PYTHONCASEOK', 'PYTHONCASEOK'
        if any(x in self.importlib._bootstrap_external._os.environ
                    for x in possibilities) != should_exist:
            self.skipTest('os.environ changes not reflected in _os.environ')

            

Reported by Pylint.

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

Line: 410 Column: 13

                      possibilities = b'PYTHONCASEOK', 'PYTHONCASEOK'
        if any(x in self.importlib._bootstrap_external._os.environ
                    for x in possibilities) != should_exist:
            self.skipTest('os.environ changes not reflected in _os.environ')

            

Reported by Pylint.

Using the global statement
Error

Line: 33 Column: 5

              EXTENSIONS.name = '_testcapi'

def _extension_details():
    global EXTENSIONS
    for path in sys.path:
        for ext in machinery.EXTENSION_SUFFIXES:
            filename = EXTENSIONS.name + ext
            file_path = os.path.join(path, filename)
            if os.path.exists(file_path):

            

Reported by Pylint.

XXX Support passing in submodule names--load (and cache) them?
Error

Line: 58 Column: 3

              

def specialize_class(cls, kind, base=None, **kwargs):
    # XXX Support passing in submodule names--load (and cache) them?
    # That would clean up the test modules a bit more.
    if base is None:
        base = unittest.TestCase
    elif not isinstance(base, type):
        base = base[kind]

            

Reported by Pylint.